mirror of
https://github.com/MiSTer-devel/Linux-Kernel_MiSTer.git
synced 2026-05-24 03:03:48 +00:00
rtl8188eu Driver upodate
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
config RTL8188EU
|
||||
tristate "Realtek 8188E USB WiFi"
|
||||
tristate "Realtek 8188EU USB WiFi"
|
||||
depends on USB
|
||||
select WIRELESS_EXT
|
||||
help
|
||||
Help message of RTL8188EU
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
58
drivers/net/wireless/realtek/rtl8188eu/README.md
Normal file
58
drivers/net/wireless/realtek/rtl8188eu/README.md
Normal file
@@ -0,0 +1,58 @@
|
||||
IMPORTANT - PLEASE READ:
|
||||
|
||||
Beginning on November 4, 2019, I will NO LONGER support people that have downloaded the source
|
||||
as a zip file. Using git has much more flexibility. In addition, there is much less likelihood
|
||||
that a user will contact me with a problem that is ALREADY fixed.
|
||||
|
||||
If your system says that /lib/modules/...../build does not exist, you have not
|
||||
installed the kernel headers, you have done it incorrectly, or you are not running
|
||||
the kernel for which the headers have been installed. The necessary steps are
|
||||
dependent on which distro you are using. Creating a new issue and asking at
|
||||
GitHub will not be productive.
|
||||
|
||||
Your kernel configuration MUST have CONFIG_WIRELESS_EXT set.
|
||||
|
||||
Unsolicited E-mail sent to my private address will be ignored!!
|
||||
|
||||
If a build fails that previously worked, perform a 'git pull' and retry before
|
||||
reporting a problem. As noted, if you had downloaded the source in zip form, then you would
|
||||
need to get an entirely new source file. That is why using git, which downloads only the changed
|
||||
lines, is required.
|
||||
|
||||
rtl8188eu
|
||||
=========
|
||||
|
||||
Repository for the stand-alone RTL8188EU driver.
|
||||
|
||||
Compiling & Building
|
||||
---------
|
||||
### Dependencies
|
||||
To compile the driver, you need to have make and a compiler installed. In addition,
|
||||
you must have the kernel headers installed. If you do not understand what this means,
|
||||
consult your distro.
|
||||
### Compiling
|
||||
|
||||
> make all
|
||||
|
||||
### Installing
|
||||
|
||||
> sudo make install
|
||||
|
||||
Submitting Issues
|
||||
---------
|
||||
|
||||
Frequently asked Questions
|
||||
---------
|
||||
|
||||
### The network manager says: "Device is not ready"!
|
||||
Make sure you copied the firmware (rtl8188eufw.bin) to /lib/firmware/rtlwifi/
|
||||
|
||||
### NetworkManager does not list SSID
|
||||
NetworkManager changes the Wi-Fi MAC address during scanning to improve privacy but this adapter does not support it. To address this issue, please create `/etc/NetworkManager/conf.d/80-wifi.conf` with content:
|
||||
|
||||
```
|
||||
[device]
|
||||
wifi.scan-rand-mac-address=no
|
||||
```
|
||||
|
||||
and run `systemctl restart NetworkManager`
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,535 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __RTW_MESH_H_
|
||||
#define __RTW_MESH_H_
|
||||
|
||||
#ifndef CONFIG_AP_MODE
|
||||
#error "CONFIG_RTW_MESH can't be enabled when CONFIG_AP_MODE is not defined\n"
|
||||
#endif
|
||||
|
||||
#define RTW_MESH_TTL 31
|
||||
#define RTW_MESH_PERR_MIN_INT 100
|
||||
#define RTW_MESH_DEFAULT_ELEMENT_TTL 31
|
||||
#define RTW_MESH_RANN_INTERVAL 5000
|
||||
#define RTW_MESH_PATH_TO_ROOT_TIMEOUT 6000
|
||||
#define RTW_MESH_DIAM_TRAVERSAL_TIME 50
|
||||
#define RTW_MESH_PATH_TIMEOUT 5000
|
||||
#define RTW_MESH_PREQ_MIN_INT 10
|
||||
#define RTW_MESH_MAX_PREQ_RETRIES 4
|
||||
#define RTW_MESH_MIN_DISCOVERY_TIMEOUT (2 * RTW_MESH_DIAM_TRAVERSAL_TIME)
|
||||
#define RTW_MESH_ROOT_CONFIRMATION_INTERVAL 2000
|
||||
#define RTW_MESH_PATH_REFRESH_TIME 1000
|
||||
#define RTW_MESH_ROOT_INTERVAL 5000
|
||||
|
||||
#define RTW_MESH_SANE_METRIC_DELTA 100
|
||||
#define RTW_MESH_MAX_ROOT_ADD_CHK_CNT 2
|
||||
|
||||
#define RTW_MESH_PLINK_UNKNOWN 0
|
||||
#define RTW_MESH_PLINK_LISTEN 1
|
||||
#define RTW_MESH_PLINK_OPN_SNT 2
|
||||
#define RTW_MESH_PLINK_OPN_RCVD 3
|
||||
#define RTW_MESH_PLINK_CNF_RCVD 4
|
||||
#define RTW_MESH_PLINK_ESTAB 5
|
||||
#define RTW_MESH_PLINK_HOLDING 6
|
||||
#define RTW_MESH_PLINK_BLOCKED 7
|
||||
|
||||
extern const char *_rtw_mesh_plink_str[];
|
||||
#define rtw_mesh_plink_str(s) ((s <= RTW_MESH_PLINK_BLOCKED) ? _rtw_mesh_plink_str[s] : _rtw_mesh_plink_str[RTW_MESH_PLINK_UNKNOWN])
|
||||
|
||||
#define RTW_MESH_PS_UNKNOWN 0
|
||||
#define RTW_MESH_PS_ACTIVE 1
|
||||
#define RTW_MESH_PS_LSLEEP 2
|
||||
#define RTW_MESH_PS_DSLEEP 3
|
||||
|
||||
extern const char *_rtw_mesh_ps_str[];
|
||||
#define rtw_mesh_ps_str(mps) ((mps <= RTW_MESH_PS_DSLEEP) ? _rtw_mesh_ps_str[mps] : _rtw_mesh_ps_str[RTW_MESH_PS_UNKNOWN])
|
||||
|
||||
#define GET_MESH_CONF_ELE_PATH_SEL_PROTO_ID(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 0, 0, 8)
|
||||
#define GET_MESH_CONF_ELE_PATH_SEL_METRIC_ID(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 1, 0, 8)
|
||||
#define GET_MESH_CONF_ELE_CONGEST_CTRL_MODE_ID(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 2, 0, 8)
|
||||
#define GET_MESH_CONF_ELE_SYNC_METHOD_ID(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 3, 0, 8)
|
||||
#define GET_MESH_CONF_ELE_AUTH_PROTO_ID(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 4, 0, 8)
|
||||
|
||||
#define GET_MESH_CONF_ELE_MESH_FORMATION(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 5, 0, 8)
|
||||
#define GET_MESH_CONF_ELE_CTO_MGATE(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 5, 0, 1)
|
||||
#define GET_MESH_CONF_ELE_NUM_OF_PEERINGS(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 5, 1, 6)
|
||||
#define GET_MESH_CONF_ELE_CTO_AS(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 5, 7, 1)
|
||||
|
||||
#define GET_MESH_CONF_ELE_MESH_CAP(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 6, 0, 8)
|
||||
#define GET_MESH_CONF_ELE_ACCEPT_PEERINGS(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 6, 0, 1)
|
||||
#define GET_MESH_CONF_ELE_MCCA_SUP(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 6, 1, 1)
|
||||
#define GET_MESH_CONF_ELE_MCCA_EN(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 6, 2, 1)
|
||||
#define GET_MESH_CONF_ELE_FORWARDING(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 6, 3, 1)
|
||||
#define GET_MESH_CONF_ELE_MBCA_EN(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 6, 4, 1)
|
||||
#define GET_MESH_CONF_ELE_TBTT_ADJ(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 6, 5, 1)
|
||||
#define GET_MESH_CONF_ELE_PS_LEVEL(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 6, 6, 1)
|
||||
|
||||
#define SET_MESH_CONF_ELE_PATH_SEL_PROTO_ID(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 0, 0, 8, _val)
|
||||
#define SET_MESH_CONF_ELE_PATH_SEL_METRIC_ID(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 1, 0, 8, _val)
|
||||
#define SET_MESH_CONF_ELE_CONGEST_CTRL_MODE_ID(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 2, 0, 8, _val)
|
||||
#define SET_MESH_CONF_ELE_SYNC_METHOD_ID(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 3, 0, 8, _val)
|
||||
#define SET_MESH_CONF_ELE_AUTH_PROTO_ID(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 4, 0, 8, _val)
|
||||
|
||||
#define SET_MESH_CONF_ELE_CTO_MGATE(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 5, 0, 1, _val)
|
||||
#define SET_MESH_CONF_ELE_NUM_OF_PEERINGS(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 5, 1, 6, _val)
|
||||
#define SET_MESH_CONF_ELE_CTO_AS(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 5, 7, 1, _val)
|
||||
|
||||
#define SET_MESH_CONF_ELE_ACCEPT_PEERINGS(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 6, 0, 1, _val)
|
||||
#define SET_MESH_CONF_ELE_MCCA_SUP(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 6, 1, 1, _val)
|
||||
#define SET_MESH_CONF_ELE_MCCA_EN(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 6, 2, 1, _val)
|
||||
#define SET_MESH_CONF_ELE_FORWARDING(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 6, 3, 1, _val)
|
||||
#define SET_MESH_CONF_ELE_MBCA_EN(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 6, 4, 1, _val)
|
||||
#define SET_MESH_CONF_ELE_TBTT_ADJ(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 6, 5, 1, _val)
|
||||
#define SET_MESH_CONF_ELE_PS_LEVEL(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 6, 6, 1, _val)
|
||||
|
||||
/* Mesh flags */
|
||||
#define MESH_FLAGS_AE 0x3 /* mask */
|
||||
#define MESH_FLAGS_AE_A4 0x1
|
||||
#define MESH_FLAGS_AE_A5_A6 0x2
|
||||
|
||||
/* Max number of paths */
|
||||
#define RTW_MESH_MAX_PATHS 1024
|
||||
|
||||
#define RTW_PREQ_Q_F_START 0x1
|
||||
#define RTW_PREQ_Q_F_REFRESH 0x2
|
||||
#define RTW_PREQ_Q_F_CHK 0x4
|
||||
#define RTW_PREQ_Q_F_PEER_AKA 0x8
|
||||
#define RTW_PREQ_Q_F_BCAST_PREQ 0x10 /* force path_dicover using broadcast */
|
||||
struct rtw_mesh_preq_queue {
|
||||
_list list;
|
||||
u8 dst[ETH_ALEN];
|
||||
u8 flags;
|
||||
};
|
||||
|
||||
extern const u8 ae_to_mesh_ctrl_len[];
|
||||
|
||||
enum mesh_frame_type {
|
||||
MESH_UCAST_DATA = 0x0,
|
||||
MESH_BMCAST_DATA = 0x1,
|
||||
MESH_UCAST_PX_DATA = 0x2,
|
||||
MESH_BMCAST_PX_DATA = 0x3,
|
||||
MESH_MHOP_UCAST_ACT = 0x4,
|
||||
MESH_MHOP_BMCAST_ACT = 0x5,
|
||||
};
|
||||
|
||||
enum mpath_sel_frame_type {
|
||||
MPATH_PREQ = 0,
|
||||
MPATH_PREP,
|
||||
MPATH_PERR,
|
||||
MPATH_RANN
|
||||
};
|
||||
|
||||
/**
|
||||
* enum rtw_mesh_deferred_task_flags - mesh deferred tasks
|
||||
*
|
||||
*
|
||||
*
|
||||
* @RTW_MESH_WORK_HOUSEKEEPING: run the periodic mesh housekeeping tasks
|
||||
* @RTW_MESH_WORK_ROOT: the mesh root station needs to send a frame
|
||||
* @RTW_MESH_WORK_DRIFT_ADJUST: time to compensate for clock drift relative to other
|
||||
* mesh nodes
|
||||
* @RTW_MESH_WORK_MBSS_CHANGED: rebuild beacon and notify driver of BSS changes
|
||||
*/
|
||||
enum rtw_mesh_deferred_task_flags {
|
||||
RTW_MESH_WORK_HOUSEKEEPING,
|
||||
RTW_MESH_WORK_ROOT,
|
||||
RTW_MESH_WORK_DRIFT_ADJUST,
|
||||
RTW_MESH_WORK_MBSS_CHANGED,
|
||||
};
|
||||
|
||||
#define RTW_MESH_MAX_PEER_CANDIDATES 15 /* aid consideration */
|
||||
#define RTW_MESH_MAX_PEER_LINKS 8
|
||||
#define RTW_MESH_PEER_LINK_TIMEOUT 20
|
||||
|
||||
#define RTW_MESH_PEER_CONF_DISABLED 0 /* special time value means no confirmation ongoing */
|
||||
#if CONFIG_RTW_MESH_PEER_BLACKLIST
|
||||
#define IS_PEER_CONF_DISABLED(plink) ((plink)->peer_conf_end_time == RTW_MESH_PEER_CONF_DISABLED)
|
||||
#define IS_PEER_CONF_TIMEOUT(plink)(!IS_PEER_CONF_DISABLED(plink) && rtw_time_after(rtw_get_current_time(), (plink)->peer_conf_end_time))
|
||||
#define SET_PEER_CONF_DISABLED(plink) (plink)->peer_conf_end_time = RTW_MESH_PEER_CONF_DISABLED
|
||||
#define SET_PEER_CONF_END_TIME(plink, timeout_ms) \
|
||||
do { \
|
||||
(plink)->peer_conf_end_time = rtw_get_current_time() + rtw_ms_to_systime(timeout_ms); \
|
||||
if ((plink)->peer_conf_end_time == RTW_MESH_PEER_CONF_DISABLED) \
|
||||
(plink)->peer_conf_end_time++; \
|
||||
} while (0)
|
||||
#else
|
||||
#define IS_PEER_CONF_DISABLED(plink) 1
|
||||
#define IS_PEER_CONF_TIMEOUT(plink) 0
|
||||
#define SET_PEER_CONF_DISABLED(plink) do {} while (0)
|
||||
#define SET_PEER_CONF_END_TIME(plink, timeout_ms) do {} while (0)
|
||||
#endif /* CONFIG_RTW_MESH_PEER_BLACKLIST */
|
||||
|
||||
#define RTW_MESH_CTO_MGATE_CONF_DISABLED 0 /* special time value means no confirmation ongoing */
|
||||
#if CONFIG_RTW_MESH_CTO_MGATE_BLACKLIST
|
||||
#define IS_CTO_MGATE_CONF_DISABLED(plink) ((plink)->cto_mgate_conf_end_time == RTW_MESH_CTO_MGATE_CONF_DISABLED)
|
||||
#define IS_CTO_MGATE_CONF_TIMEOUT(plink)(!IS_CTO_MGATE_CONF_DISABLED(plink) && rtw_time_after(rtw_get_current_time(), (plink)->cto_mgate_conf_end_time))
|
||||
#define SET_CTO_MGATE_CONF_DISABLED(plink) (plink)->cto_mgate_conf_end_time = RTW_MESH_CTO_MGATE_CONF_DISABLED
|
||||
#define SET_CTO_MGATE_CONF_END_TIME(plink, timeout_ms) \
|
||||
do { \
|
||||
(plink)->cto_mgate_conf_end_time = rtw_get_current_time() + rtw_ms_to_systime(timeout_ms); \
|
||||
if ((plink)->cto_mgate_conf_end_time == RTW_MESH_CTO_MGATE_CONF_DISABLED) \
|
||||
(plink)->cto_mgate_conf_end_time++; \
|
||||
} while (0)
|
||||
#else
|
||||
#define IS_CTO_MGATE_CONF_DISABLED(plink) 1
|
||||
#define IS_CTO_MGATE_CONF_TIMEOUT(plink) 0
|
||||
#define SET_CTO_MGATE_CONF_DISABLED(plink) do {} while (0)
|
||||
#define SET_CTO_MGATE_CONF_END_TIME(plink, timeout_ms) do {} while (0)
|
||||
#endif /* CONFIG_RTW_MESH_CTO_MGATE_BLACKLIST */
|
||||
|
||||
struct mesh_plink_ent {
|
||||
u8 valid;
|
||||
u8 addr[ETH_ALEN];
|
||||
u8 plink_state;
|
||||
|
||||
#ifdef CONFIG_RTW_MESH_AEK
|
||||
u8 aek_valid;
|
||||
u8 aek[32];
|
||||
#endif
|
||||
|
||||
u16 llid;
|
||||
u16 plid;
|
||||
#ifndef CONFIG_RTW_MESH_DRIVER_AID
|
||||
u16 aid; /* aid assigned from upper layer */
|
||||
#endif
|
||||
u16 peer_aid; /* aid assigned from peer */
|
||||
|
||||
u8 chosen_pmk[16];
|
||||
|
||||
#ifdef CONFIG_RTW_MESH_AEK
|
||||
u8 sel_pcs[4];
|
||||
u8 l_nonce[32];
|
||||
u8 p_nonce[32];
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RTW_MESH_DRIVER_AID
|
||||
u8 *tx_conf_ies;
|
||||
u16 tx_conf_ies_len;
|
||||
#endif
|
||||
u8 *rx_conf_ies;
|
||||
u16 rx_conf_ies_len;
|
||||
|
||||
struct wlan_network *scanned;
|
||||
|
||||
#if CONFIG_RTW_MESH_PEER_BLACKLIST
|
||||
systime peer_conf_end_time;
|
||||
#endif
|
||||
#if CONFIG_RTW_MESH_CTO_MGATE_BLACKLIST
|
||||
systime cto_mgate_conf_end_time;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef CONFIG_RTW_MESH_AEK
|
||||
#define MESH_PLINK_AEK_VALID(ent) ent->aek_valid
|
||||
#else
|
||||
#define MESH_PLINK_AEK_VALID(ent) 0
|
||||
#endif
|
||||
|
||||
struct mesh_plink_pool {
|
||||
_lock lock;
|
||||
u8 num; /* current ent being used */
|
||||
struct mesh_plink_ent ent[RTW_MESH_MAX_PEER_CANDIDATES];
|
||||
|
||||
#if CONFIG_RTW_MESH_ACNODE_PREVENT
|
||||
u8 acnode_rsvd;
|
||||
#endif
|
||||
|
||||
#if CONFIG_RTW_MESH_PEER_BLACKLIST
|
||||
_queue peer_blacklist;
|
||||
#endif
|
||||
#if CONFIG_RTW_MESH_CTO_MGATE_BLACKLIST
|
||||
_queue cto_mgate_blacklist;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct mesh_peer_sel_policy {
|
||||
u32 scanr_exp_ms;
|
||||
|
||||
#if CONFIG_RTW_MESH_ACNODE_PREVENT
|
||||
u8 acnode_prevent;
|
||||
u32 acnode_conf_timeout_ms;
|
||||
u32 acnode_notify_timeout_ms;
|
||||
#endif
|
||||
|
||||
#if CONFIG_RTW_MESH_OFFCH_CAND
|
||||
u8 offch_cand;
|
||||
u32 offch_find_int_ms; /* 0 means no offch find triggerred by driver self*/
|
||||
#endif
|
||||
|
||||
#if CONFIG_RTW_MESH_PEER_BLACKLIST
|
||||
u32 peer_conf_timeout_ms;
|
||||
u32 peer_blacklist_timeout_ms;
|
||||
#endif
|
||||
|
||||
#if CONFIG_RTW_MESH_CTO_MGATE_BLACKLIST
|
||||
u8 cto_mgate_require;
|
||||
u32 cto_mgate_conf_timeout_ms;
|
||||
u32 cto_mgate_blacklist_timeout_ms;
|
||||
#endif
|
||||
};
|
||||
|
||||
/* b2u flags */
|
||||
#define RTW_MESH_B2U_ALL BIT0
|
||||
#define RTW_MESH_B2U_GA_UCAST BIT1 /* Group addressed unicast frame, forward only */
|
||||
#define RTW_MESH_B2U_BCAST BIT2
|
||||
#define RTW_MESH_B2U_IP_MCAST BIT3
|
||||
|
||||
#define rtw_msrc_b2u_policy_chk(flags, mda) ( \
|
||||
(flags & RTW_MESH_B2U_ALL) \
|
||||
|| ((flags & RTW_MESH_B2U_BCAST) && is_broadcast_mac_addr(mda)) \
|
||||
|| ((flags & RTW_MESH_B2U_IP_MCAST) && (IP_MCAST_MAC(mda) || ICMPV6_MCAST_MAC(mda))) \
|
||||
)
|
||||
|
||||
#define rtw_mfwd_b2u_policy_chk(flags, mda, ucst) ( \
|
||||
(flags & RTW_MESH_B2U_ALL) \
|
||||
|| ((flags & RTW_MESH_B2U_GA_UCAST) && ucst) \
|
||||
|| ((flags & RTW_MESH_B2U_BCAST) && is_broadcast_mac_addr(mda)) \
|
||||
|| ((flags & RTW_MESH_B2U_IP_MCAST) && (IP_MCAST_MAC(mda) || ICMPV6_MCAST_MAC(mda))) \
|
||||
)
|
||||
|
||||
/**
|
||||
* @sane_metric_delta: Controlling if trigger additional path check mechanism
|
||||
* @max_root_add_chk_cnt: The retry cnt to send additional root confirmation
|
||||
* PREQ through old(last) path
|
||||
*/
|
||||
struct rtw_mesh_cfg {
|
||||
u8 max_peer_links; /* peering limit */
|
||||
u32 plink_timeout; /* seconds */
|
||||
|
||||
u8 dot11MeshTTL;
|
||||
u8 element_ttl;
|
||||
u32 path_refresh_time;
|
||||
u16 dot11MeshHWMPpreqMinInterval;
|
||||
u16 dot11MeshHWMPnetDiameterTraversalTime;
|
||||
u32 dot11MeshHWMPactivePathTimeout;
|
||||
u8 dot11MeshHWMPmaxPREQretries;
|
||||
u16 min_discovery_timeout;
|
||||
u16 dot11MeshHWMPconfirmationInterval;
|
||||
u16 dot11MeshHWMPperrMinInterval;
|
||||
u8 dot11MeshHWMPRootMode;
|
||||
BOOLEAN dot11MeshForwarding;
|
||||
s32 rssi_threshold; /* in dBm, 0: no specified */
|
||||
u16 dot11MeshHWMPRannInterval;
|
||||
BOOLEAN dot11MeshGateAnnouncementProtocol;
|
||||
u32 dot11MeshHWMPactivePathToRootTimeout;
|
||||
u16 dot11MeshHWMProotInterval;
|
||||
u8 path_gate_timeout_factor;
|
||||
#ifdef CONFIG_RTW_MESH_ADD_ROOT_CHK
|
||||
u16 sane_metric_delta;
|
||||
u8 max_root_add_chk_cnt;
|
||||
#endif
|
||||
|
||||
struct mesh_peer_sel_policy peer_sel_policy;
|
||||
|
||||
#if CONFIG_RTW_MESH_DATA_BMC_TO_UC
|
||||
u8 b2u_flags_msrc;
|
||||
u8 b2u_flags_mfwd;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct rtw_mesh_stats {
|
||||
u32 fwded_mcast; /* Mesh forwarded multicast frames */
|
||||
u32 fwded_unicast; /* Mesh forwarded unicast frames */
|
||||
u32 fwded_frames; /* Mesh total forwarded frames */
|
||||
u32 dropped_frames_ttl; /* Not transmitted since mesh_ttl == 0*/
|
||||
u32 dropped_frames_no_route; /* Not transmitted, no route found */
|
||||
u32 dropped_frames_congestion;/* Not forwarded due to congestion */
|
||||
u32 dropped_frames_duplicate;
|
||||
|
||||
u32 mrc_del_qlen; /* MRC entry deleted cause by queue length limit */
|
||||
};
|
||||
|
||||
struct rtw_mrc;
|
||||
|
||||
struct rtw_mesh_info {
|
||||
u8 mesh_id[NDIS_802_11_LENGTH_SSID];
|
||||
size_t mesh_id_len;
|
||||
/* Active Path Selection Protocol Identifier */
|
||||
u8 mesh_pp_id;
|
||||
/* Active Path Selection Metric Identifier */
|
||||
u8 mesh_pm_id;
|
||||
/* Congestion Control Mode Identifier */
|
||||
u8 mesh_cc_id;
|
||||
/* Synchronization Protocol Identifier */
|
||||
u8 mesh_sp_id;
|
||||
/* Authentication Protocol Identifier */
|
||||
u8 mesh_auth_id;
|
||||
|
||||
struct mesh_plink_pool plink_ctl;
|
||||
|
||||
u32 mesh_seqnum;
|
||||
/* MSTA's own hwmp sequence number */
|
||||
u32 sn;
|
||||
systime last_preq;
|
||||
systime last_sn_update;
|
||||
systime next_perr;
|
||||
/* Last used Path Discovery ID */
|
||||
u32 preq_id;
|
||||
|
||||
ATOMIC_T mpaths;
|
||||
struct rtw_mesh_table *mesh_paths;
|
||||
struct rtw_mesh_table *mpp_paths;
|
||||
int mesh_paths_generation;
|
||||
int mpp_paths_generation;
|
||||
|
||||
int num_gates;
|
||||
struct rtw_mesh_path *max_addr_gate;
|
||||
bool max_addr_gate_is_larger_than_self;
|
||||
|
||||
struct rtw_mesh_stats mshstats;
|
||||
|
||||
_queue mpath_tx_queue;
|
||||
u32 mpath_tx_queue_len;
|
||||
_tasklet mpath_tx_tasklet;
|
||||
|
||||
struct rtw_mrc *mrc;
|
||||
|
||||
_lock mesh_preq_queue_lock;
|
||||
struct rtw_mesh_preq_queue preq_queue;
|
||||
int preq_queue_len;
|
||||
};
|
||||
|
||||
extern const char *_action_self_protected_str[];
|
||||
#define action_self_protected_str(action) ((action < RTW_ACT_SELF_PROTECTED_NUM) ? _action_self_protected_str[action] : _action_self_protected_str[0])
|
||||
|
||||
u8 *rtw_set_ie_mesh_id(u8 *buf, u32 *buf_len, const char *mesh_id, u8 id_len);
|
||||
u8 *rtw_set_ie_mesh_config(u8 *buf, u32 *buf_len
|
||||
, u8 path_sel_proto, u8 path_sel_metric, u8 congest_ctl_mode, u8 sync_method, u8 auth_proto
|
||||
, u8 num_of_peerings, bool cto_mgate, bool cto_as
|
||||
, bool accept_peerings, bool mcca_sup, bool mcca_en, bool forwarding
|
||||
, bool mbca_en, bool tbtt_adj, bool ps_level);
|
||||
|
||||
int rtw_bss_is_same_mbss(WLAN_BSSID_EX *a, WLAN_BSSID_EX *b);
|
||||
int rtw_bss_is_candidate_mesh_peer(WLAN_BSSID_EX *self, WLAN_BSSID_EX *target, u8 ch, u8 add_peer);
|
||||
|
||||
void rtw_chk_candidate_peer_notify(_adapter *adapter, struct wlan_network *scanned);
|
||||
|
||||
void rtw_mesh_peer_status_chk(_adapter *adapter);
|
||||
|
||||
#if CONFIG_RTW_MESH_ACNODE_PREVENT
|
||||
void rtw_mesh_update_scanned_acnode_status(_adapter *adapter, struct wlan_network *scanned);
|
||||
bool rtw_mesh_scanned_is_acnode_confirmed(_adapter *adapter, struct wlan_network *scanned);
|
||||
bool rtw_mesh_acnode_prevent_allow_sacrifice(_adapter *adapter);
|
||||
struct sta_info *rtw_mesh_acnode_prevent_pick_sacrifice(_adapter *adapter);
|
||||
void dump_mesh_acnode_prevent_settings(void *sel, _adapter *adapter);
|
||||
#endif
|
||||
|
||||
#if CONFIG_RTW_MESH_OFFCH_CAND
|
||||
u8 rtw_mesh_offch_candidate_accepted(_adapter *adapter);
|
||||
u8 rtw_mesh_select_operating_ch(_adapter *adapter);
|
||||
void dump_mesh_offch_cand_settings(void *sel, _adapter *adapter);
|
||||
#endif
|
||||
|
||||
#if CONFIG_RTW_MESH_PEER_BLACKLIST
|
||||
int rtw_mesh_peer_blacklist_add(_adapter *adapter, const u8 *addr);
|
||||
int rtw_mesh_peer_blacklist_del(_adapter *adapter, const u8 *addr);
|
||||
int rtw_mesh_peer_blacklist_search(_adapter *adapter, const u8 *addr);
|
||||
void rtw_mesh_peer_blacklist_flush(_adapter *adapter);
|
||||
void dump_mesh_peer_blacklist(void *sel, _adapter *adapter);
|
||||
void dump_mesh_peer_blacklist_settings(void *sel, _adapter *adapter);
|
||||
#endif
|
||||
#if CONFIG_RTW_MESH_CTO_MGATE_BLACKLIST
|
||||
u8 rtw_mesh_cto_mgate_required(_adapter *adapter);
|
||||
u8 rtw_mesh_cto_mgate_network_filter(_adapter *adapter, struct wlan_network *scanned);
|
||||
int rtw_mesh_cto_mgate_blacklist_add(_adapter *adapter, const u8 *addr);
|
||||
int rtw_mesh_cto_mgate_blacklist_del(_adapter *adapter, const u8 *addr);
|
||||
int rtw_mesh_cto_mgate_blacklist_search(_adapter *adapter, const u8 *addr);
|
||||
void rtw_mesh_cto_mgate_blacklist_flush(_adapter *adapter);
|
||||
void dump_mesh_cto_mgate_blacklist(void *sel, _adapter *adapter);
|
||||
void dump_mesh_cto_mgate_blacklist_settings(void *sel, _adapter *adapter);
|
||||
#endif
|
||||
void dump_mesh_peer_sel_policy(void *sel, _adapter *adapter);
|
||||
void dump_mesh_networks(void *sel, _adapter *adapter);
|
||||
|
||||
void rtw_mesh_adjust_chbw(u8 req_ch, u8 *req_bw, u8 *req_offset);
|
||||
|
||||
void rtw_mesh_sae_check_frames(_adapter *adapter, const u8 *buf, u32 len, u8 tx, u16 alg, u16 seq, u16 status);
|
||||
int rtw_mesh_check_frames_tx(_adapter *adapter, const u8 **buf, size_t *len);
|
||||
int rtw_mesh_check_frames_rx(_adapter *adapter, const u8 *buf, size_t len);
|
||||
|
||||
int rtw_mesh_on_auth(_adapter *adapter, union recv_frame *rframe);
|
||||
unsigned int on_action_self_protected(_adapter *adapter, union recv_frame *rframe);
|
||||
|
||||
bool rtw_mesh_update_bss_peering_status(_adapter *adapter, WLAN_BSSID_EX *bss);
|
||||
bool rtw_mesh_update_bss_formation_info(_adapter *adapter, WLAN_BSSID_EX *bss);
|
||||
bool rtw_mesh_update_bss_forwarding_state(_adapter *adapter, WLAN_BSSID_EX *bss);
|
||||
|
||||
struct mesh_plink_ent *_rtw_mesh_plink_get(_adapter *adapter, const u8 *hwaddr);
|
||||
struct mesh_plink_ent *rtw_mesh_plink_get(_adapter *adapter, const u8 *hwaddr);
|
||||
struct mesh_plink_ent *rtw_mesh_plink_get_no_estab_by_idx(_adapter *adapter, u8 idx);
|
||||
int _rtw_mesh_plink_add(_adapter *adapter, const u8 *hwaddr);
|
||||
int rtw_mesh_plink_add(_adapter *adapter, const u8 *hwaddr);
|
||||
int rtw_mesh_plink_set_state(_adapter *adapter, const u8 *hwaddr, u8 state);
|
||||
#ifdef CONFIG_RTW_MESH_AEK
|
||||
int rtw_mesh_plink_set_aek(_adapter *adapter, const u8 *hwaddr, const u8 *aek);
|
||||
#endif
|
||||
#if CONFIG_RTW_MESH_PEER_BLACKLIST
|
||||
int rtw_mesh_plink_set_peer_conf_timeout(_adapter *adapter, const u8 *hwaddr);
|
||||
#endif
|
||||
void _rtw_mesh_plink_del_ent(_adapter *adapter, struct mesh_plink_ent *ent);
|
||||
int rtw_mesh_plink_del(_adapter *adapter, const u8 *hwaddr);
|
||||
void rtw_mesh_plink_ctl_init(_adapter *adapter);
|
||||
void rtw_mesh_plink_ctl_deinit(_adapter *adapter);
|
||||
void dump_mesh_plink_ctl(void *sel, _adapter *adapter);
|
||||
|
||||
int rtw_mesh_peer_establish(_adapter *adapter, struct mesh_plink_ent *plink, struct sta_info *sta);
|
||||
void _rtw_mesh_expire_peer_ent(_adapter *adapter, struct mesh_plink_ent *plink);
|
||||
void rtw_mesh_expire_peer(_adapter *adapter, const u8 *peer_addr);
|
||||
u8 rtw_mesh_ps_annc(_adapter *adapter, u8 ps);
|
||||
|
||||
unsigned int on_action_mesh(_adapter *adapter, union recv_frame *rframe);
|
||||
|
||||
void rtw_mesh_cfg_init(_adapter *adapter);
|
||||
void rtw_mesh_cfg_init_max_peer_links(_adapter *adapter, u8 stack_conf);
|
||||
void rtw_mesh_cfg_init_plink_timeout(_adapter *adapter, u32 stack_conf);
|
||||
void rtw_mesh_init_mesh_info(_adapter *adapter);
|
||||
void rtw_mesh_deinit_mesh_info(_adapter *adapter);
|
||||
|
||||
#if CONFIG_RTW_MESH_DATA_BMC_TO_UC
|
||||
void dump_mesh_b2u_flags(void *sel, _adapter *adapter);
|
||||
#endif
|
||||
|
||||
int rtw_mesh_addr_resolve(_adapter *adapter, struct xmit_frame *xframe, _pkt *pkt, _list *b2u_list);
|
||||
|
||||
s8 rtw_mesh_tx_set_whdr_mctrl_len(u8 mesh_frame_mode, struct pkt_attrib *attrib);
|
||||
void rtw_mesh_tx_build_mctrl(_adapter *adapter, struct pkt_attrib *attrib, u8 *buf);
|
||||
u8 rtw_mesh_tx_build_whdr(_adapter *adapter, struct pkt_attrib *attrib
|
||||
, u16 *fctrl, struct rtw_ieee80211_hdr *whdr);
|
||||
|
||||
int rtw_mesh_rx_data_validate_hdr(_adapter *adapter, union recv_frame *rframe, struct sta_info **sta);
|
||||
int rtw_mesh_rx_data_validate_mctrl(_adapter *adapter, union recv_frame *rframe
|
||||
, const struct rtw_ieee80211s_hdr *mctrl, const u8 *mda, const u8 *msa
|
||||
, u8 *mctrl_len, const u8 **da, const u8 **sa);
|
||||
int rtw_mesh_rx_validate_mctrl_non_amsdu(_adapter *adapter, union recv_frame *rframe);
|
||||
|
||||
int rtw_mesh_rx_msdu_act_check(union recv_frame *rframe
|
||||
, const u8 *mda, const u8 *msa
|
||||
, const u8 *da, const u8 *sa
|
||||
, struct rtw_ieee80211s_hdr *mctrl
|
||||
, struct xmit_frame **fwd_frame, _list *b2u_list);
|
||||
|
||||
void dump_mesh_stats(void *sel, _adapter *adapter);
|
||||
|
||||
#if defined(PLATFORM_LINUX) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32))
|
||||
#define rtw_lockdep_assert_held(l) lockdep_assert_held(l)
|
||||
#define rtw_lockdep_is_held(l) lockdep_is_held(l)
|
||||
#else
|
||||
#error "TBD\n"
|
||||
#endif
|
||||
|
||||
#include "rtw_mesh_pathtbl.h"
|
||||
#include "rtw_mesh_hwmp.h"
|
||||
#endif /* __RTW_MESH_H_ */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,60 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __RTW_MESH_HWMP_H_
|
||||
#define __RTW_MESH_HWMP_H_
|
||||
|
||||
#ifndef DBG_RTW_HWMP
|
||||
#define DBG_RTW_HWMP 0
|
||||
#endif
|
||||
#if DBG_RTW_HWMP
|
||||
#define RTW_HWMP_DBG(fmt, arg...) RTW_PRINT(fmt, ##arg)
|
||||
#else
|
||||
#define RTW_HWMP_DBG(fmt, arg...) RTW_DBG(fmt, ##arg)
|
||||
#endif
|
||||
|
||||
#ifndef INFO_RTW_HWMP
|
||||
#define INFO_RTW_HWMP 0
|
||||
#endif
|
||||
#if INFO_RTW_HWMP
|
||||
#define RTW_HWMP_INFO(fmt, arg...) RTW_PRINT(fmt, ##arg)
|
||||
#else
|
||||
#define RTW_HWMP_INFO(fmt, arg...) RTW_INFO(fmt, ##arg)
|
||||
#endif
|
||||
|
||||
|
||||
void rtw_ewma_err_rate_init(struct rtw_ewma_err_rate *e);
|
||||
unsigned long rtw_ewma_err_rate_read(struct rtw_ewma_err_rate *e);
|
||||
void rtw_ewma_err_rate_add(struct rtw_ewma_err_rate *e, unsigned long val);
|
||||
int rtw_mesh_path_error_tx(_adapter *adapter,
|
||||
u8 ttl, const u8 *target, u32 target_sn,
|
||||
u16 target_rcode, const u8 *ra);
|
||||
void rtw_ieee80211s_update_metric(_adapter *adapter, u8 mac_id,
|
||||
u8 per, u8 rate,
|
||||
u8 bw, u8 total_pkt);
|
||||
void rtw_mesh_rx_path_sel_frame(_adapter *adapter, union recv_frame *rframe);
|
||||
void rtw_mesh_queue_preq(struct rtw_mesh_path *mpath, u8 flags);
|
||||
void rtw_mesh_path_start_discovery(_adapter *adapter);
|
||||
void rtw_mesh_path_timer(void *ctx);
|
||||
void rtw_mesh_path_tx_root_frame(_adapter *adapter);
|
||||
void rtw_mesh_work_hdl(_workitem *work);
|
||||
void rtw_ieee80211_mesh_path_timer(void *ctx);
|
||||
void rtw_ieee80211_mesh_path_root_timer(void *ctx);
|
||||
BOOLEAN rtw_ieee80211_mesh_root_setup(_adapter *adapter);
|
||||
void rtw_mesh_work(_workitem *work);
|
||||
void rtw_mesh_atlm_param_req_timer(void *ctx);
|
||||
|
||||
#endif /* __RTW_MESH_HWMP_H_ */
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,211 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __RTW_MESH_PATHTBL_H_
|
||||
#define __RTW_MESH_PATHTBL_H_
|
||||
|
||||
#ifndef DBG_RTW_MPATH
|
||||
#define DBG_RTW_MPATH 1
|
||||
#endif
|
||||
#if DBG_RTW_MPATH
|
||||
#define RTW_MPATH_DBG(fmt, arg...) RTW_PRINT(fmt, ##arg)
|
||||
#else
|
||||
#define RTW_MPATH_DBG(fmt, arg...) do {} while (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* enum rtw_mesh_path_flags - mesh path flags
|
||||
*
|
||||
* @RTW_MESH_PATH_ACTIVE: the mesh path can be used for forwarding
|
||||
* @RTW_MESH_PATH_RESOLVING: the discovery process is running for this mesh path
|
||||
* @RTW_MESH_PATH_SN_VALID: the mesh path contains a valid destination sequence
|
||||
* number
|
||||
* @RTW_MESH_PATH_FIXED: the mesh path has been manually set and should not be
|
||||
* modified
|
||||
* @RTW_MESH_PATH_RESOLVED: the mesh path can has been resolved
|
||||
* @RTW_MESH_PATH_REQ_QUEUED: there is an unsent path request for this destination
|
||||
* already queued up, waiting for the discovery process to start.
|
||||
* @RTW_MESH_PATH_DELETED: the mesh path has been deleted and should no longer
|
||||
* be used
|
||||
* @RTW_MESH_PATH_ROOT_ADD_CHK: root additional check in root mode.
|
||||
* With this flag, It will try the last used rann_snd_addr
|
||||
* @RTW_MESH_PATH_PEER_AKA: only used toward a peer, only used in active keep
|
||||
* alive mechanism. PREQ's da = path dst
|
||||
* @RTW_MESH_PATH_BCAST_PREQ: for re-checking next hop resolve toward root.
|
||||
* Use it to force path_discover sending broadcast PREQ for root.
|
||||
*
|
||||
* RTW_MESH_PATH_RESOLVED is used by the mesh path timer to
|
||||
* decide when to stop or cancel the mesh path discovery.
|
||||
*/
|
||||
enum rtw_mesh_path_flags {
|
||||
RTW_MESH_PATH_ACTIVE = BIT(0),
|
||||
RTW_MESH_PATH_RESOLVING = BIT(1),
|
||||
RTW_MESH_PATH_SN_VALID = BIT(2),
|
||||
RTW_MESH_PATH_FIXED = BIT(3),
|
||||
RTW_MESH_PATH_RESOLVED = BIT(4),
|
||||
RTW_MESH_PATH_REQ_QUEUED = BIT(5),
|
||||
RTW_MESH_PATH_DELETED = BIT(6),
|
||||
RTW_MESH_PATH_ROOT_ADD_CHK = BIT(7),
|
||||
RTW_MESH_PATH_PEER_AKA = BIT(8),
|
||||
RTW_MESH_PATH_BCAST_PREQ = BIT(9),
|
||||
};
|
||||
|
||||
/**
|
||||
* struct rtw_mesh_path - mesh path structure
|
||||
*
|
||||
* @dst: mesh path destination mac address
|
||||
* @mpp: mesh proxy mac address
|
||||
* @rhash: rhashtable list pointer
|
||||
* @gate_list: list pointer for known gates list
|
||||
* @sdata: mesh subif
|
||||
* @next_hop: mesh neighbor to which frames for this destination will be
|
||||
* forwarded
|
||||
* @timer: mesh path discovery timer
|
||||
* @frame_queue: pending queue for frames sent to this destination while the
|
||||
* path is unresolved
|
||||
* @rcu: rcu head for freeing mesh path
|
||||
* @sn: target sequence number
|
||||
* @metric: current metric to this destination
|
||||
* @hop_count: hops to destination
|
||||
* @exp_time: in jiffies, when the path will expire or when it expired
|
||||
* @discovery_timeout: timeout (lapse in jiffies) used for the last discovery
|
||||
* retry
|
||||
* @discovery_retries: number of discovery retries
|
||||
* @flags: mesh path flags, as specified on &enum rtw_mesh_path_flags
|
||||
* @state_lock: mesh path state lock used to protect changes to the
|
||||
* mpath itself. No need to take this lock when adding or removing
|
||||
* an mpath to a hash bucket on a path table.
|
||||
* @rann_snd_addr: the RANN sender address
|
||||
* @rann_metric: the aggregated path metric towards the root node
|
||||
* @last_preq_to_root: Timestamp of last PREQ sent to root
|
||||
* @is_root: the destination station of this path is a root node
|
||||
* @is_gate: the destination station of this path is a mesh gate
|
||||
*
|
||||
*
|
||||
* The dst address is unique in the mesh path table. Since the mesh_path is
|
||||
* protected by RCU, deleting the next_hop STA must remove / substitute the
|
||||
* mesh_path structure and wait until that is no longer reachable before
|
||||
* destroying the STA completely.
|
||||
*/
|
||||
struct rtw_mesh_path {
|
||||
u8 dst[ETH_ALEN];
|
||||
u8 mpp[ETH_ALEN]; /* used for MPP or MAP */
|
||||
rtw_rhash_head rhash;
|
||||
rtw_hlist_node gate_list;
|
||||
_adapter *adapter;
|
||||
struct sta_info __rcu *next_hop;
|
||||
_timer timer;
|
||||
_queue frame_queue;
|
||||
u32 frame_queue_len;
|
||||
rtw_rcu_head rcu;
|
||||
u32 sn;
|
||||
u32 metric;
|
||||
u8 hop_count;
|
||||
systime exp_time;
|
||||
systime discovery_timeout;
|
||||
systime gate_timeout;
|
||||
u32 gate_ann_int; /* gate announce interval */
|
||||
u8 discovery_retries;
|
||||
enum rtw_mesh_path_flags flags;
|
||||
_lock state_lock;
|
||||
u8 rann_snd_addr[ETH_ALEN];
|
||||
#ifdef CONFIG_RTW_MESH_ADD_ROOT_CHK
|
||||
u8 add_chk_rann_snd_addr[ETH_ALEN];
|
||||
#endif
|
||||
u32 rann_metric;
|
||||
unsigned long last_preq_to_root;
|
||||
bool is_root;
|
||||
bool is_gate;
|
||||
bool gate_asked;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct rtw_mesh_table
|
||||
*
|
||||
* @known_gates: list of known mesh gates and their mpaths by the station. The
|
||||
* gate's mpath may or may not be resolved and active.
|
||||
* @gates_lock: protects updates to known_gates
|
||||
* @rhead: the rhashtable containing struct mesh_paths, keyed by dest addr
|
||||
* @entries: number of entries in the table
|
||||
*/
|
||||
struct rtw_mesh_table {
|
||||
rtw_hlist_head known_gates;
|
||||
_lock gates_lock;
|
||||
rtw_rhashtable rhead;
|
||||
ATOMIC_T entries;
|
||||
};
|
||||
|
||||
#define RTW_MESH_PATH_EXPIRE (600 * HZ)
|
||||
|
||||
/* Maximum number of paths per interface */
|
||||
#define RTW_MESH_MAX_MPATHS 1024
|
||||
|
||||
/* Number of frames buffered per destination for unresolved destinations */
|
||||
#define RTW_MESH_FRAME_QUEUE_LEN 10
|
||||
|
||||
int rtw_mesh_nexthop_lookup(_adapter *adapter,
|
||||
const u8 *mda, const u8 *msa, u8 *ra);
|
||||
int rtw_mesh_nexthop_resolve(_adapter *adapter,
|
||||
struct xmit_frame *xframe);
|
||||
|
||||
struct rtw_mesh_path *rtw_mesh_path_lookup(_adapter *adapter,
|
||||
const u8 *dst);
|
||||
struct rtw_mesh_path *rtw_mpp_path_lookup(_adapter *adapter,
|
||||
const u8 *dst);
|
||||
int rtw_mpp_path_add(_adapter *adapter,
|
||||
const u8 *dst, const u8 *mpp);
|
||||
void dump_mpp(void *sel, _adapter *adapter);
|
||||
|
||||
struct rtw_mesh_path *
|
||||
rtw_mesh_path_lookup_by_idx(_adapter *adapter, int idx);
|
||||
void dump_mpath(void *sel, _adapter *adapter);
|
||||
|
||||
struct rtw_mesh_path *
|
||||
rtw_mpp_path_lookup_by_idx(_adapter *adapter, int idx);
|
||||
void rtw_mesh_path_fix_nexthop(struct rtw_mesh_path *mpath, struct sta_info *next_hop);
|
||||
void rtw_mesh_path_expire(_adapter *adapter);
|
||||
|
||||
struct rtw_mesh_path *
|
||||
rtw_mesh_path_add(_adapter *adapter, const u8 *dst);
|
||||
|
||||
int rtw_mesh_path_add_gate(struct rtw_mesh_path *mpath);
|
||||
void rtw_mesh_gate_del(struct rtw_mesh_table *tbl, struct rtw_mesh_path *mpath);
|
||||
bool rtw_mesh_gate_search(struct rtw_mesh_table *tbl, const u8 *addr);
|
||||
int rtw_mesh_path_send_to_gates(struct rtw_mesh_path *mpath);
|
||||
int rtw_mesh_gate_num(_adapter *adapter);
|
||||
bool rtw_mesh_is_primary_gate(_adapter *adapter);
|
||||
void dump_known_gates(void *sel, _adapter *adapter);
|
||||
|
||||
void rtw_mesh_plink_broken(struct sta_info *sta);
|
||||
|
||||
void rtw_mesh_path_assign_nexthop(struct rtw_mesh_path *mpath, struct sta_info *sta);
|
||||
void rtw_mesh_path_flush_pending(struct rtw_mesh_path *mpath);
|
||||
void rtw_mesh_path_tx_pending(struct rtw_mesh_path *mpath);
|
||||
int rtw_mesh_pathtbl_init(_adapter *adapter);
|
||||
void rtw_mesh_pathtbl_unregister(_adapter *adapter);
|
||||
int rtw_mesh_path_del(_adapter *adapter, const u8 *addr);
|
||||
|
||||
void rtw_mesh_path_flush_by_nexthop(struct sta_info *sta);
|
||||
void rtw_mesh_path_discard_frame(_adapter *adapter,
|
||||
struct xmit_frame *xframe);
|
||||
|
||||
static inline void rtw_mesh_path_activate(struct rtw_mesh_path *mpath)
|
||||
{
|
||||
mpath->flags |= RTW_MESH_PATH_ACTIVE | RTW_MESH_PATH_RESOLVED;
|
||||
}
|
||||
|
||||
void rtw_mesh_path_flush_by_iface(_adapter *adapter);
|
||||
|
||||
#endif /* __RTW_MESH_PATHTBL_H_ */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,47 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2013 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <drv_types.h>
|
||||
#include <hal_btcoex_wifionly.h>
|
||||
#include <hal_data.h>
|
||||
|
||||
void rtw_btcoex_wifionly_switchband_notify(PADAPTER padapter)
|
||||
{
|
||||
hal_btcoex_wifionly_switchband_notify(padapter);
|
||||
}
|
||||
|
||||
void rtw_btcoex_wifionly_scan_notify(PADAPTER padapter)
|
||||
{
|
||||
hal_btcoex_wifionly_scan_notify(padapter);
|
||||
}
|
||||
|
||||
void rtw_btcoex_wifionly_connect_notify(PADAPTER padapter)
|
||||
{
|
||||
hal_btcoex_wifionly_connect_notify(padapter);
|
||||
}
|
||||
|
||||
void rtw_btcoex_wifionly_hw_config(PADAPTER padapter)
|
||||
{
|
||||
hal_btcoex_wifionly_hw_config(padapter);
|
||||
}
|
||||
|
||||
void rtw_btcoex_wifionly_initialize(PADAPTER padapter)
|
||||
{
|
||||
hal_btcoex_wifionly_initlizevariables(padapter);
|
||||
}
|
||||
|
||||
void rtw_btcoex_wifionly_AntInfoSetting(PADAPTER padapter)
|
||||
{
|
||||
hal_btcoex_wifionly_AntInfoSetting(padapter);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,183 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2018 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __RTW_CHPLAN_H__
|
||||
#define __RTW_CHPLAN_H__
|
||||
|
||||
enum rtw_chplan_id {
|
||||
/* ===== 0x00 ~ 0x1F, legacy channel plan ===== */
|
||||
RTW_CHPLAN_FCC = 0x00,
|
||||
RTW_CHPLAN_IC = 0x01,
|
||||
RTW_CHPLAN_ETSI = 0x02,
|
||||
RTW_CHPLAN_SPAIN = 0x03,
|
||||
RTW_CHPLAN_FRANCE = 0x04,
|
||||
RTW_CHPLAN_MKK = 0x05,
|
||||
RTW_CHPLAN_MKK1 = 0x06,
|
||||
RTW_CHPLAN_ISRAEL = 0x07,
|
||||
RTW_CHPLAN_TELEC = 0x08,
|
||||
RTW_CHPLAN_GLOBAL_DOAMIN = 0x09,
|
||||
RTW_CHPLAN_WORLD_WIDE_13 = 0x0A,
|
||||
RTW_CHPLAN_TAIWAN = 0x0B,
|
||||
RTW_CHPLAN_CHINA = 0x0C,
|
||||
RTW_CHPLAN_SINGAPORE_INDIA_MEXICO = 0x0D,
|
||||
RTW_CHPLAN_KOREA = 0x0E,
|
||||
RTW_CHPLAN_TURKEY = 0x0F,
|
||||
RTW_CHPLAN_JAPAN = 0x10,
|
||||
RTW_CHPLAN_FCC_NO_DFS = 0x11,
|
||||
RTW_CHPLAN_JAPAN_NO_DFS = 0x12,
|
||||
RTW_CHPLAN_WORLD_WIDE_5G = 0x13,
|
||||
RTW_CHPLAN_TAIWAN_NO_DFS = 0x14,
|
||||
|
||||
/* ===== 0x20 ~ 0x7F, new channel plan ===== */
|
||||
RTW_CHPLAN_WORLD_NULL = 0x20,
|
||||
RTW_CHPLAN_ETSI1_NULL = 0x21,
|
||||
RTW_CHPLAN_FCC1_NULL = 0x22,
|
||||
RTW_CHPLAN_MKK1_NULL = 0x23,
|
||||
RTW_CHPLAN_ETSI2_NULL = 0x24,
|
||||
RTW_CHPLAN_FCC1_FCC1 = 0x25,
|
||||
RTW_CHPLAN_WORLD_ETSI1 = 0x26,
|
||||
RTW_CHPLAN_MKK1_MKK1 = 0x27,
|
||||
RTW_CHPLAN_WORLD_KCC1 = 0x28,
|
||||
RTW_CHPLAN_WORLD_FCC2 = 0x29,
|
||||
RTW_CHPLAN_FCC2_NULL = 0x2A,
|
||||
RTW_CHPLAN_IC1_IC2 = 0x2B,
|
||||
RTW_CHPLAN_MKK2_NULL = 0x2C,
|
||||
RTW_CHPLAN_WORLD_CHILE1= 0x2D,
|
||||
RTW_CHPLAN_WORLD1_WORLD1 = 0x2E,
|
||||
RTW_CHPLAN_WORLD_CHILE2 = 0x2F,
|
||||
RTW_CHPLAN_WORLD_FCC3 = 0x30,
|
||||
RTW_CHPLAN_WORLD_FCC4 = 0x31,
|
||||
RTW_CHPLAN_WORLD_FCC5 = 0x32,
|
||||
RTW_CHPLAN_WORLD_FCC6 = 0x33,
|
||||
RTW_CHPLAN_FCC1_FCC7 = 0x34,
|
||||
RTW_CHPLAN_WORLD_ETSI2 = 0x35,
|
||||
RTW_CHPLAN_WORLD_ETSI3 = 0x36,
|
||||
RTW_CHPLAN_MKK1_MKK2 = 0x37,
|
||||
RTW_CHPLAN_MKK1_MKK3 = 0x38,
|
||||
RTW_CHPLAN_FCC1_NCC1 = 0x39,
|
||||
RTW_CHPLAN_ETSI1_ETSI1 = 0x3A,
|
||||
RTW_CHPLAN_ETSI1_ACMA1 = 0x3B,
|
||||
RTW_CHPLAN_ETSI1_ETSI6 = 0x3C,
|
||||
RTW_CHPLAN_ETSI1_ETSI12 = 0x3D,
|
||||
RTW_CHPLAN_KCC1_KCC2 = 0x3E,
|
||||
RTW_CHPLAN_FCC1_FCC11 = 0x3F,
|
||||
RTW_CHPLAN_FCC1_NCC2 = 0x40,
|
||||
RTW_CHPLAN_GLOBAL_NULL = 0x41,
|
||||
RTW_CHPLAN_ETSI1_ETSI4 = 0x42,
|
||||
RTW_CHPLAN_FCC1_FCC2 = 0x43,
|
||||
RTW_CHPLAN_FCC1_NCC3 = 0x44,
|
||||
RTW_CHPLAN_WORLD_ACMA1 = 0x45,
|
||||
RTW_CHPLAN_FCC1_FCC8 = 0x46,
|
||||
RTW_CHPLAN_WORLD_ETSI6 = 0x47,
|
||||
RTW_CHPLAN_WORLD_ETSI7 = 0x48,
|
||||
RTW_CHPLAN_WORLD_ETSI8 = 0x49,
|
||||
RTW_CHPLAN_IC2_IC2 = 0x4A,
|
||||
RTW_CHPLAN_KCC1_KCC3 = 0x4B,
|
||||
RTW_CHPLAN_FCC1_FCC15 = 0x4C,
|
||||
RTW_CHPLAN_WORLD_ETSI9 = 0x50,
|
||||
RTW_CHPLAN_WORLD_ETSI10 = 0x51,
|
||||
RTW_CHPLAN_WORLD_ETSI11 = 0x52,
|
||||
RTW_CHPLAN_FCC1_NCC4 = 0x53,
|
||||
RTW_CHPLAN_WORLD_ETSI12 = 0x54,
|
||||
RTW_CHPLAN_FCC1_FCC9 = 0x55,
|
||||
RTW_CHPLAN_WORLD_ETSI13 = 0x56,
|
||||
RTW_CHPLAN_FCC1_FCC10 = 0x57,
|
||||
RTW_CHPLAN_MKK2_MKK4 = 0x58,
|
||||
RTW_CHPLAN_WORLD_ETSI14 = 0x59,
|
||||
RTW_CHPLAN_FCC1_FCC5 = 0x60,
|
||||
RTW_CHPLAN_FCC2_FCC7 = 0x61,
|
||||
RTW_CHPLAN_FCC2_FCC1 = 0x62,
|
||||
RTW_CHPLAN_WORLD_ETSI15 = 0x63,
|
||||
RTW_CHPLAN_MKK2_MKK5 = 0x64,
|
||||
RTW_CHPLAN_ETSI1_ETSI16 = 0x65,
|
||||
RTW_CHPLAN_FCC1_FCC14 = 0x66,
|
||||
RTW_CHPLAN_FCC1_FCC12 = 0x67,
|
||||
RTW_CHPLAN_FCC2_FCC14 = 0x68,
|
||||
RTW_CHPLAN_FCC2_FCC12 = 0x69,
|
||||
RTW_CHPLAN_ETSI1_ETSI17 = 0x6A,
|
||||
RTW_CHPLAN_WORLD_FCC16 = 0x6B,
|
||||
RTW_CHPLAN_WORLD_FCC13 = 0x6C,
|
||||
RTW_CHPLAN_FCC2_FCC15 = 0x6D,
|
||||
RTW_CHPLAN_WORLD_FCC12 = 0x6E,
|
||||
RTW_CHPLAN_NULL_ETSI8 = 0x6F,
|
||||
RTW_CHPLAN_NULL_ETSI18 = 0x70,
|
||||
RTW_CHPLAN_NULL_ETSI17 = 0x71,
|
||||
RTW_CHPLAN_NULL_ETSI19 = 0x72,
|
||||
RTW_CHPLAN_WORLD_FCC7 = 0x73,
|
||||
RTW_CHPLAN_FCC2_FCC17 = 0x74,
|
||||
RTW_CHPLAN_WORLD_ETSI20 = 0x75,
|
||||
RTW_CHPLAN_FCC2_FCC11 = 0x76,
|
||||
RTW_CHPLAN_WORLD_ETSI21 = 0x77,
|
||||
RTW_CHPLAN_FCC1_FCC18 = 0x78,
|
||||
RTW_CHPLAN_MKK2_MKK1 = 0x79,
|
||||
|
||||
RTW_CHPLAN_MAX,
|
||||
RTW_CHPLAN_REALTEK_DEFINE = 0x7F,
|
||||
RTW_CHPLAN_UNSPECIFIED = 0xFF,
|
||||
};
|
||||
|
||||
u8 rtw_chplan_get_default_regd(u8 id);
|
||||
bool rtw_chplan_is_empty(u8 id);
|
||||
#define rtw_is_channel_plan_valid(chplan) (((chplan) < RTW_CHPLAN_MAX || (chplan) == RTW_CHPLAN_REALTEK_DEFINE) && !rtw_chplan_is_empty(chplan))
|
||||
#define rtw_is_legacy_channel_plan(chplan) ((chplan) < 0x20)
|
||||
|
||||
struct _RT_CHANNEL_INFO;
|
||||
u8 init_channel_set(_adapter *padapter, u8 ChannelPlan, struct _RT_CHANNEL_INFO *channel_set);
|
||||
|
||||
#define IS_ALPHA2_NO_SPECIFIED(_alpha2) ((*((u16 *)(_alpha2))) == 0xFFFF)
|
||||
|
||||
#define RTW_MODULE_RTL8821AE_HMC_M2 BIT0 /* RTL8821AE(HMC + M.2) */
|
||||
#define RTW_MODULE_RTL8821AU BIT1 /* RTL8821AU */
|
||||
#define RTW_MODULE_RTL8812AENF_NGFF BIT2 /* RTL8812AENF(8812AE+8761)_NGFF */
|
||||
#define RTW_MODULE_RTL8812AEBT_HMC BIT3 /* RTL8812AEBT(8812AE+8761)_HMC */
|
||||
#define RTW_MODULE_RTL8188EE_HMC_M2 BIT4 /* RTL8188EE(HMC + M.2) */
|
||||
#define RTW_MODULE_RTL8723BE_HMC_M2 BIT5 /* RTL8723BE(HMC + M.2) */
|
||||
#define RTW_MODULE_RTL8723BS_NGFF1216 BIT6 /* RTL8723BS(NGFF1216) */
|
||||
#define RTW_MODULE_RTL8192EEBT_HMC_M2 BIT7 /* RTL8192EEBT(8192EE+8761AU)_(HMC + M.2) */
|
||||
#define RTW_MODULE_RTL8723DE_NGFF1630 BIT8 /* RTL8723DE(NGFF1630) */
|
||||
#define RTW_MODULE_RTL8822BE BIT9 /* RTL8822BE */
|
||||
#define RTW_MODULE_RTL8821CE BIT10 /* RTL8821CE */
|
||||
|
||||
struct country_chplan {
|
||||
char alpha2[2];
|
||||
u8 chplan;
|
||||
#ifdef CONFIG_80211AC_VHT
|
||||
u8 en_11ac;
|
||||
#endif
|
||||
#if RTW_DEF_MODULE_REGULATORY_CERT
|
||||
u16 def_module_flags; /* RTW_MODULE_RTLXXX */
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef CONFIG_80211AC_VHT
|
||||
#define COUNTRY_CHPLAN_EN_11AC(_ent) ((_ent)->en_11ac)
|
||||
#else
|
||||
#define COUNTRY_CHPLAN_EN_11AC(_ent) 0
|
||||
#endif
|
||||
|
||||
#if RTW_DEF_MODULE_REGULATORY_CERT
|
||||
#define COUNTRY_CHPLAN_DEF_MODULE_FALGS(_ent) ((_ent)->def_module_flags)
|
||||
#else
|
||||
#define COUNTRY_CHPLAN_DEF_MODULE_FALGS(_ent) 0
|
||||
#endif
|
||||
|
||||
const struct country_chplan *rtw_get_chplan_from_country(const char *country_code);
|
||||
|
||||
void dump_country_chplan(void *sel, const struct country_chplan *ent);
|
||||
void dump_country_chplan_map(void *sel);
|
||||
void dump_chplan_id_list(void *sel);
|
||||
void dump_chplan_test(void *sel);
|
||||
void dump_chplan_ver(void *sel);
|
||||
|
||||
#endif /* __RTW_CHPLAN_H__ */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,329 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define _RTW_EEPROM_C_
|
||||
|
||||
#include <drv_conf.h>
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
|
||||
void up_clk(_adapter *padapter, u16 *x)
|
||||
{
|
||||
*x = *x | _EESK;
|
||||
rtw_write8(padapter, EE_9346CR, (u8)*x);
|
||||
rtw_udelay_os(CLOCK_RATE);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void down_clk(_adapter *padapter, u16 *x)
|
||||
{
|
||||
*x = *x & ~_EESK;
|
||||
rtw_write8(padapter, EE_9346CR, (u8)*x);
|
||||
rtw_udelay_os(CLOCK_RATE);
|
||||
}
|
||||
|
||||
void shift_out_bits(_adapter *padapter, u16 data, u16 count)
|
||||
{
|
||||
u16 x, mask;
|
||||
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
mask = 0x01 << (count - 1);
|
||||
x = rtw_read8(padapter, EE_9346CR);
|
||||
|
||||
x &= ~(_EEDO | _EEDI);
|
||||
|
||||
do {
|
||||
x &= ~_EEDI;
|
||||
if (data & mask)
|
||||
x |= _EEDI;
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
rtw_write8(padapter, EE_9346CR, (u8)x);
|
||||
rtw_udelay_os(CLOCK_RATE);
|
||||
up_clk(padapter, &x);
|
||||
down_clk(padapter, &x);
|
||||
mask = mask >> 1;
|
||||
} while (mask);
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
x &= ~_EEDI;
|
||||
rtw_write8(padapter, EE_9346CR, (u8)x);
|
||||
out:
|
||||
return;
|
||||
}
|
||||
|
||||
u16 shift_in_bits(_adapter *padapter)
|
||||
{
|
||||
u16 x, d = 0, i;
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
x = rtw_read8(padapter, EE_9346CR);
|
||||
|
||||
x &= ~(_EEDO | _EEDI);
|
||||
d = 0;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
d = d << 1;
|
||||
up_clk(padapter, &x);
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
x = rtw_read8(padapter, EE_9346CR);
|
||||
|
||||
x &= ~(_EEDI);
|
||||
if (x & _EEDO)
|
||||
d |= 1;
|
||||
|
||||
down_clk(padapter, &x);
|
||||
}
|
||||
out:
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
void standby(_adapter *padapter)
|
||||
{
|
||||
u8 x;
|
||||
x = rtw_read8(padapter, EE_9346CR);
|
||||
|
||||
x &= ~(_EECS | _EESK);
|
||||
rtw_write8(padapter, EE_9346CR, x);
|
||||
|
||||
rtw_udelay_os(CLOCK_RATE);
|
||||
x |= _EECS;
|
||||
rtw_write8(padapter, EE_9346CR, x);
|
||||
rtw_udelay_os(CLOCK_RATE);
|
||||
}
|
||||
|
||||
u16 wait_eeprom_cmd_done(_adapter *padapter)
|
||||
{
|
||||
u8 x;
|
||||
u16 i, res = _FALSE;
|
||||
standby(padapter);
|
||||
for (i = 0; i < 200; i++) {
|
||||
x = rtw_read8(padapter, EE_9346CR);
|
||||
if (x & _EEDO) {
|
||||
res = _TRUE;
|
||||
goto exit;
|
||||
}
|
||||
rtw_udelay_os(CLOCK_RATE);
|
||||
}
|
||||
exit:
|
||||
return res;
|
||||
}
|
||||
|
||||
void eeprom_clean(_adapter *padapter)
|
||||
{
|
||||
u16 x;
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
x = rtw_read8(padapter, EE_9346CR);
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
x &= ~(_EECS | _EEDI);
|
||||
rtw_write8(padapter, EE_9346CR, (u8)x);
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
up_clk(padapter, &x);
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
down_clk(padapter, &x);
|
||||
out:
|
||||
return;
|
||||
}
|
||||
|
||||
void eeprom_write16(_adapter *padapter, u16 reg, u16 data)
|
||||
{
|
||||
u8 x;
|
||||
x = rtw_read8(padapter, EE_9346CR);
|
||||
|
||||
x &= ~(_EEDI | _EEDO | _EESK | _EEM0);
|
||||
x |= _EEM1 | _EECS;
|
||||
rtw_write8(padapter, EE_9346CR, x);
|
||||
|
||||
shift_out_bits(padapter, EEPROM_EWEN_OPCODE, 5);
|
||||
|
||||
if (padapter->EepromAddressSize == 8) /* CF+ and SDIO */
|
||||
shift_out_bits(padapter, 0, 6);
|
||||
else /* USB */
|
||||
shift_out_bits(padapter, 0, 4);
|
||||
|
||||
standby(padapter);
|
||||
|
||||
/* Commented out by rcnjko, 2004.0
|
||||
* Erase this particular word. Write the erase opcode and register
|
||||
* number in that order. The opcode is 3bits in length; reg is 6 bits long. */
|
||||
/* shift_out_bits(Adapter, EEPROM_ERASE_OPCODE, 3);
|
||||
* shift_out_bits(Adapter, reg, Adapter->EepromAddressSize);
|
||||
*
|
||||
* if (wait_eeprom_cmd_done(Adapter ) == FALSE)
|
||||
* {
|
||||
* return;
|
||||
* } */
|
||||
|
||||
|
||||
standby(padapter);
|
||||
|
||||
/* write the new word to the EEPROM */
|
||||
|
||||
/* send the write opcode the EEPORM */
|
||||
shift_out_bits(padapter, EEPROM_WRITE_OPCODE, 3);
|
||||
|
||||
/* select which word in the EEPROM that we are writing to. */
|
||||
shift_out_bits(padapter, reg, padapter->EepromAddressSize);
|
||||
|
||||
/* write the data to the selected EEPROM word. */
|
||||
shift_out_bits(padapter, data, 16);
|
||||
|
||||
if (wait_eeprom_cmd_done(padapter) == _FALSE)
|
||||
|
||||
goto exit;
|
||||
|
||||
standby(padapter);
|
||||
|
||||
shift_out_bits(padapter, EEPROM_EWDS_OPCODE, 5);
|
||||
shift_out_bits(padapter, reg, 4);
|
||||
|
||||
eeprom_clean(padapter);
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
|
||||
u16 eeprom_read16(_adapter *padapter, u16 reg) /* ReadEEprom */
|
||||
{
|
||||
|
||||
u16 x;
|
||||
u16 data = 0;
|
||||
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
/* select EEPROM, reset bits, set _EECS */
|
||||
x = rtw_read8(padapter, EE_9346CR);
|
||||
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
x &= ~(_EEDI | _EEDO | _EESK | _EEM0);
|
||||
x |= _EEM1 | _EECS;
|
||||
rtw_write8(padapter, EE_9346CR, (unsigned char)x);
|
||||
|
||||
/* write the read opcode and register number in that order */
|
||||
/* The opcode is 3bits in length, reg is 6 bits long */
|
||||
shift_out_bits(padapter, EEPROM_READ_OPCODE, 3);
|
||||
shift_out_bits(padapter, reg, padapter->EepromAddressSize);
|
||||
|
||||
/* Now read the data (16 bits) in from the selected EEPROM word */
|
||||
data = shift_in_bits(padapter);
|
||||
|
||||
eeprom_clean(padapter);
|
||||
out:
|
||||
|
||||
return data;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* From even offset */
|
||||
void eeprom_read_sz(_adapter *padapter, u16 reg, u8 *data, u32 sz)
|
||||
{
|
||||
|
||||
u16 x, data16;
|
||||
u32 i;
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
/* select EEPROM, reset bits, set _EECS */
|
||||
x = rtw_read8(padapter, EE_9346CR);
|
||||
|
||||
if (rtw_is_surprise_removed(padapter)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
x &= ~(_EEDI | _EEDO | _EESK | _EEM0);
|
||||
x |= _EEM1 | _EECS;
|
||||
rtw_write8(padapter, EE_9346CR, (unsigned char)x);
|
||||
|
||||
/* write the read opcode and register number in that order */
|
||||
/* The opcode is 3bits in length, reg is 6 bits long */
|
||||
shift_out_bits(padapter, EEPROM_READ_OPCODE, 3);
|
||||
shift_out_bits(padapter, reg, padapter->EepromAddressSize);
|
||||
|
||||
|
||||
for (i = 0; i < sz; i += 2) {
|
||||
data16 = shift_in_bits(padapter);
|
||||
data[i] = data16 & 0xff;
|
||||
data[i + 1] = data16 >> 8;
|
||||
}
|
||||
|
||||
eeprom_clean(padapter);
|
||||
out:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* addr_off : address offset of the entry in eeprom (not the tuple number of eeprom (reg); that is addr_off !=reg) */
|
||||
u8 eeprom_read(_adapter *padapter, u32 addr_off, u8 sz, u8 *rbuf)
|
||||
{
|
||||
u8 quotient, remainder, addr_2align_odd;
|
||||
u16 reg, stmp , i = 0, idx = 0;
|
||||
reg = (u16)(addr_off >> 1);
|
||||
addr_2align_odd = (u8)(addr_off & 0x1);
|
||||
|
||||
if (addr_2align_odd) { /* read that start at high part: e.g 1,3,5,7,9,... */
|
||||
stmp = eeprom_read16(padapter, reg);
|
||||
rbuf[idx++] = (u8)((stmp >> 8) & 0xff); /* return hogh-part of the short */
|
||||
reg++;
|
||||
sz--;
|
||||
}
|
||||
|
||||
quotient = sz >> 1;
|
||||
remainder = sz & 0x1;
|
||||
|
||||
for (i = 0 ; i < quotient; i++) {
|
||||
stmp = eeprom_read16(padapter, reg + i);
|
||||
rbuf[idx++] = (u8)(stmp & 0xff);
|
||||
rbuf[idx++] = (u8)((stmp >> 8) & 0xff);
|
||||
}
|
||||
|
||||
reg = reg + i;
|
||||
if (remainder) { /* end of read at lower part of short : 0,2,4,6,... */
|
||||
stmp = eeprom_read16(padapter, reg);
|
||||
rbuf[idx] = (u8)(stmp & 0xff);
|
||||
}
|
||||
return _TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void read_eeprom_content(_adapter *padapter)
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
872
drivers/net/wireless/realtek/rtl8188eu/core/rtw_efuse.c
Normal file
872
drivers/net/wireless/realtek/rtl8188eu/core/rtw_efuse.c
Normal file
@@ -0,0 +1,872 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#define _RTW_EFUSE_C_
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
#include <rtw_efuse.h>
|
||||
|
||||
/*------------------------Define local variable------------------------------*/
|
||||
u8 fakeEfuseBank;
|
||||
u32 fakeEfuseUsedBytes;
|
||||
u8 fakeEfuseContent[EFUSE_MAX_HW_SIZE] = {0};
|
||||
u8 fakeEfuseInitMap[EFUSE_MAX_MAP_LEN] = {0};
|
||||
u8 fakeEfuseModifiedMap[EFUSE_MAX_MAP_LEN] = {0};
|
||||
|
||||
u32 BTEfuseUsedBytes;
|
||||
u8 BTEfuseContent[EFUSE_MAX_BT_BANK][EFUSE_MAX_HW_SIZE];
|
||||
u8 BTEfuseInitMap[EFUSE_BT_MAX_MAP_LEN] = {0};
|
||||
u8 BTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN] = {0};
|
||||
|
||||
u32 fakeBTEfuseUsedBytes;
|
||||
u8 fakeBTEfuseContent[EFUSE_MAX_BT_BANK][EFUSE_MAX_HW_SIZE];
|
||||
u8 fakeBTEfuseInitMap[EFUSE_BT_MAX_MAP_LEN] = {0};
|
||||
u8 fakeBTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN] = {0};
|
||||
/*------------------------Define local variable------------------------------*/
|
||||
|
||||
/* */
|
||||
#define REG_EFUSE_CTRL 0x0030
|
||||
#define EFUSE_CTRL REG_EFUSE_CTRL /* E-Fuse Control. */
|
||||
/* */
|
||||
|
||||
bool
|
||||
Efuse_Read1ByteFromFakeContent(
|
||||
struct adapter *pAdapter,
|
||||
u16 Offset,
|
||||
u8 *Value);
|
||||
bool
|
||||
Efuse_Read1ByteFromFakeContent(
|
||||
struct adapter *pAdapter,
|
||||
u16 Offset,
|
||||
u8 *Value)
|
||||
{
|
||||
if (Offset >= EFUSE_MAX_HW_SIZE)
|
||||
return false;
|
||||
if (fakeEfuseBank == 0)
|
||||
*Value = fakeEfuseContent[Offset];
|
||||
else
|
||||
*Value = fakeBTEfuseContent[fakeEfuseBank-1][Offset];
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
Efuse_Write1ByteToFakeContent(
|
||||
struct adapter *pAdapter,
|
||||
u16 Offset,
|
||||
u8 Value)
|
||||
{
|
||||
if (Offset >= EFUSE_MAX_HW_SIZE)
|
||||
return false;
|
||||
if (fakeEfuseBank == 0) {
|
||||
fakeEfuseContent[Offset] = Value;
|
||||
} else {
|
||||
fakeBTEfuseContent[fakeEfuseBank-1][Offset] = Value;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Function: Efuse_PowerSwitch
|
||||
*
|
||||
* Overview: When we want to enable write operation, we should change to
|
||||
* pwr on state. When we stop write, we should switch to 500k mode
|
||||
* and disable LDO 2.5V.
|
||||
*
|
||||
* Input: NONE
|
||||
*
|
||||
* Output: NONE
|
||||
*
|
||||
* Return: NONE
|
||||
*
|
||||
* Revised History:
|
||||
* When Who Remark
|
||||
* 11/17/2008 MHC Create Version 0.
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
void
|
||||
Efuse_PowerSwitch(
|
||||
struct adapter *pAdapter,
|
||||
u8 write,
|
||||
u8 PwrState)
|
||||
{
|
||||
pAdapter->HalFunc.EfusePowerSwitch(pAdapter, write, PwrState);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Function: efuse_GetCurrentSize
|
||||
*
|
||||
* Overview: Get current efuse size!!!
|
||||
*
|
||||
* Input: NONE
|
||||
*
|
||||
* Output: NONE
|
||||
*
|
||||
* Return: NONE
|
||||
*
|
||||
* Revised History:
|
||||
* When Who Remark
|
||||
* 11/16/2008 MHC Create Version 0.
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
u16
|
||||
Efuse_GetCurrentSize(
|
||||
struct adapter *pAdapter,
|
||||
u8 efuseType,
|
||||
bool pseudo)
|
||||
{
|
||||
u16 ret = 0;
|
||||
|
||||
ret = pAdapter->HalFunc.EfuseGetCurrentSize(pAdapter, efuseType, pseudo);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 11/16/2008 MH Add description. Get current efuse area enabled word!!. */
|
||||
u8
|
||||
Efuse_CalculateWordCnts(u8 word_en)
|
||||
{
|
||||
u8 word_cnts = 0;
|
||||
if (!(word_en & BIT(0)))
|
||||
word_cnts++; /* 0 : write enable */
|
||||
if (!(word_en & BIT(1)))
|
||||
word_cnts++;
|
||||
if (!(word_en & BIT(2)))
|
||||
word_cnts++;
|
||||
if (!(word_en & BIT(3)))
|
||||
word_cnts++;
|
||||
return word_cnts;
|
||||
}
|
||||
|
||||
/* */
|
||||
/* Description: */
|
||||
/* Execute E-Fuse read byte operation. */
|
||||
/* Referred from SD1 Richard. */
|
||||
/* */
|
||||
/* Assumption: */
|
||||
/* 1. Boot from E-Fuse and successfully auto-load. */
|
||||
/* 2. PASSIVE_LEVEL (USB interface) */
|
||||
/* */
|
||||
/* Created by Roger, 2008.10.21. */
|
||||
/* */
|
||||
void
|
||||
ReadEFuseByte(
|
||||
struct adapter *Adapter,
|
||||
u16 _offset,
|
||||
u8 *pbuf,
|
||||
bool pseudo)
|
||||
{
|
||||
u32 value32;
|
||||
u8 readbyte;
|
||||
u16 retry;
|
||||
|
||||
if (pseudo) {
|
||||
Efuse_Read1ByteFromFakeContent(Adapter, _offset, pbuf);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Write Address */
|
||||
rtw_write8(Adapter, EFUSE_CTRL+1, (_offset & 0xff));
|
||||
readbyte = rtw_read8(Adapter, EFUSE_CTRL+2);
|
||||
rtw_write8(Adapter, EFUSE_CTRL+2, ((_offset >> 8) & 0x03) | (readbyte & 0xfc));
|
||||
|
||||
/* Write bit 32 0 */
|
||||
readbyte = rtw_read8(Adapter, EFUSE_CTRL+3);
|
||||
rtw_write8(Adapter, EFUSE_CTRL+3, (readbyte & 0x7f));
|
||||
|
||||
/* Check bit 32 read-ready */
|
||||
retry = 0;
|
||||
value32 = rtw_read32(Adapter, EFUSE_CTRL);
|
||||
while (!(((value32 >> 24) & 0xff) & 0x80) && (retry < 10000)) {
|
||||
value32 = rtw_read32(Adapter, EFUSE_CTRL);
|
||||
retry++;
|
||||
}
|
||||
|
||||
/* 20100205 Joseph: Add delay suggested by SD1 Victor. */
|
||||
/* This fix the problem that Efuse read error in high temperature condition. */
|
||||
/* Designer says that there shall be some delay after ready bit is set, or the */
|
||||
/* result will always stay on last data we read. */
|
||||
rtw_udelay_os(50);
|
||||
value32 = rtw_read32(Adapter, EFUSE_CTRL);
|
||||
|
||||
*pbuf = (u8)(value32 & 0xff);
|
||||
}
|
||||
|
||||
/* */
|
||||
/* Description: */
|
||||
/* 1. Execute E-Fuse read byte operation according as map offset and */
|
||||
/* save to E-Fuse table. */
|
||||
/* 2. Referred from SD1 Richard. */
|
||||
/* */
|
||||
/* Assumption: */
|
||||
/* 1. Boot from E-Fuse and successfully auto-load. */
|
||||
/* 2. PASSIVE_LEVEL (USB interface) */
|
||||
/* */
|
||||
/* Created by Roger, 2008.10.21. */
|
||||
/* */
|
||||
/* 2008/12/12 MH 1. Reorganize code flow and reserve bytes. and add description. */
|
||||
/* 2. Add efuse utilization collect. */
|
||||
/* 2008/12/22 MH Read Efuse must check if we write section 1 data again!!! Sec1 */
|
||||
/* write addr must be after sec5. */
|
||||
/* */
|
||||
|
||||
static void efuse_ReadEFuse(struct adapter *Adapter, u8 efuseType, u16 _offset, u16 _size_byte, u8 *pbuf, bool pseudo)
|
||||
{
|
||||
Adapter->HalFunc.ReadEFuse(Adapter, efuseType, _offset, _size_byte, pbuf, pseudo);
|
||||
}
|
||||
|
||||
void EFUSE_GetEfuseDefinition(struct adapter *pAdapter, u8 efuseType, u8 type, void *pOut, bool pseudo
|
||||
)
|
||||
{
|
||||
pAdapter->HalFunc.EFUSEGetEfuseDefinition(pAdapter, efuseType, type, pOut, pseudo);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Function: EFUSE_Read1Byte
|
||||
*
|
||||
* Overview: Copy from WMAC fot EFUSE read 1 byte.
|
||||
*
|
||||
* Input: NONE
|
||||
*
|
||||
* Output: NONE
|
||||
*
|
||||
* Return: NONE
|
||||
*
|
||||
* Revised History:
|
||||
* When Who Remark
|
||||
* 09/23/2008 MHC Copy from WMAC.
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
u8 EFUSE_Read1Byte(struct adapter *Adapter, u16 Address)
|
||||
{
|
||||
u8 data;
|
||||
u8 Bytetemp = {0x00};
|
||||
u8 temp = {0x00};
|
||||
u32 k = 0;
|
||||
u16 contentLen = 0;
|
||||
|
||||
EFUSE_GetEfuseDefinition(Adapter, EFUSE_WIFI , TYPE_EFUSE_REAL_CONTENT_LEN, (void *)&contentLen, false);
|
||||
|
||||
if (Address < contentLen) { /* E-fuse 512Byte */
|
||||
/* Write E-fuse Register address bit0~7 */
|
||||
temp = Address & 0xFF;
|
||||
rtw_write8(Adapter, EFUSE_CTRL+1, temp);
|
||||
Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+2);
|
||||
/* Write E-fuse Register address bit8~9 */
|
||||
temp = ((Address >> 8) & 0x03) | (Bytetemp & 0xFC);
|
||||
rtw_write8(Adapter, EFUSE_CTRL+2, temp);
|
||||
|
||||
/* Write 0x30[31]= 0 */
|
||||
Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3);
|
||||
temp = Bytetemp & 0x7F;
|
||||
rtw_write8(Adapter, EFUSE_CTRL+3, temp);
|
||||
|
||||
/* Wait Write-ready (0x30[31]= 1) */
|
||||
Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3);
|
||||
while (!(Bytetemp & 0x80)) {
|
||||
Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3);
|
||||
k++;
|
||||
if (k == 1000) {
|
||||
k = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
data = rtw_read8(Adapter, EFUSE_CTRL);
|
||||
return data;
|
||||
} else {
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
} /* EFUSE_Read1Byte */
|
||||
|
||||
/* 11/16/2008 MH Read one byte from real Efuse. */
|
||||
u8 efuse_OneByteRead(struct adapter *pAdapter, u16 addr, u8 *data, bool pseudo)
|
||||
{
|
||||
u8 tmpidx = 0;
|
||||
u8 result;
|
||||
|
||||
if (pseudo) {
|
||||
result = Efuse_Read1ByteFromFakeContent(pAdapter, addr, data);
|
||||
return result;
|
||||
}
|
||||
/* -----------------e-fuse reg ctrl --------------------------------- */
|
||||
/* address */
|
||||
rtw_write8(pAdapter, EFUSE_CTRL+1, (u8)(addr & 0xff));
|
||||
rtw_write8(pAdapter, EFUSE_CTRL+2, ((u8)((addr>>8) & 0x03)) |
|
||||
(rtw_read8(pAdapter, EFUSE_CTRL+2) & 0xFC));
|
||||
|
||||
rtw_write8(pAdapter, EFUSE_CTRL+3, 0x72);/* read cmd */
|
||||
|
||||
while (!(0x80 & rtw_read8(pAdapter, EFUSE_CTRL+3)) && (tmpidx < 100))
|
||||
tmpidx++;
|
||||
if (tmpidx < 100) {
|
||||
*data = rtw_read8(pAdapter, EFUSE_CTRL);
|
||||
result = true;
|
||||
} else {
|
||||
*data = 0xff;
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* 11/16/2008 MH Write one byte to reald Efuse. */
|
||||
u8 efuse_OneByteWrite(struct adapter *pAdapter, u16 addr, u8 data, bool pseudo)
|
||||
{
|
||||
u8 tmpidx = 0;
|
||||
u8 result;
|
||||
|
||||
if (pseudo) {
|
||||
result = Efuse_Write1ByteToFakeContent(pAdapter, addr, data);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* -----------------e-fuse reg ctrl --------------------------------- */
|
||||
/* address */
|
||||
rtw_write8(pAdapter, EFUSE_CTRL+1, (u8)(addr&0xff));
|
||||
rtw_write8(pAdapter, EFUSE_CTRL+2,
|
||||
(rtw_read8(pAdapter, EFUSE_CTRL+2) & 0xFC) |
|
||||
(u8)((addr>>8) & 0x03));
|
||||
rtw_write8(pAdapter, EFUSE_CTRL, data);/* data */
|
||||
|
||||
rtw_write8(pAdapter, EFUSE_CTRL+3, 0xF2);/* write cmd */
|
||||
|
||||
while ((0x80 & rtw_read8(pAdapter, EFUSE_CTRL+3)) && (tmpidx < 100))
|
||||
tmpidx++;
|
||||
|
||||
if (tmpidx < 100)
|
||||
result = true;
|
||||
else
|
||||
result = false;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int Efuse_PgPacketRead(struct adapter *pAdapter, u8 offset, u8 *data, bool pseudo)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret = pAdapter->HalFunc.Efuse_PgPacketRead(pAdapter, offset, data, pseudo);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int Efuse_PgPacketWrite(struct adapter *pAdapter, u8 offset, u8 word_en, u8 *data, bool pseudo)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = pAdapter->HalFunc.Efuse_PgPacketWrite(pAdapter, offset, word_en, data, pseudo);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int Efuse_PgPacketWrite_BT(struct adapter *pAdapter, u8 offset, u8 word_en, u8 *data, bool pseudo)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = pAdapter->HalFunc.Efuse_PgPacketWrite_BT(pAdapter, offset, word_en, data, pseudo);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Function: efuse_WordEnableDataRead
|
||||
*
|
||||
* Overview: Read allowed word in current efuse section data.
|
||||
*
|
||||
* Input: NONE
|
||||
*
|
||||
* Output: NONE
|
||||
*
|
||||
* Return: NONE
|
||||
*
|
||||
* Revised History:
|
||||
* When Who Remark
|
||||
* 11/16/2008 MHC Create Version 0.
|
||||
* 11/21/2008 MHC Fix Write bug when we only enable late word.
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
void efuse_WordEnableDataRead(u8 word_en, u8 *sourdata, u8 *targetdata)
|
||||
{
|
||||
if (!(word_en&BIT(0))) {
|
||||
targetdata[0] = sourdata[0];
|
||||
targetdata[1] = sourdata[1];
|
||||
}
|
||||
if (!(word_en&BIT(1))) {
|
||||
targetdata[2] = sourdata[2];
|
||||
targetdata[3] = sourdata[3];
|
||||
}
|
||||
if (!(word_en&BIT(2))) {
|
||||
targetdata[4] = sourdata[4];
|
||||
targetdata[5] = sourdata[5];
|
||||
}
|
||||
if (!(word_en&BIT(3))) {
|
||||
targetdata[6] = sourdata[6];
|
||||
targetdata[7] = sourdata[7];
|
||||
}
|
||||
}
|
||||
|
||||
u8 Efuse_WordEnableDataWrite(struct adapter *pAdapter, u16 efuse_addr, u8 word_en, u8 *data, bool pseudo)
|
||||
{
|
||||
u8 ret = 0;
|
||||
|
||||
ret = pAdapter->HalFunc.Efuse_WordEnableDataWrite(pAdapter, efuse_addr, word_en, data, pseudo);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static u8 efuse_read8(struct adapter *padapter, u16 address, u8 *value)
|
||||
{
|
||||
return efuse_OneByteRead(padapter, address, value, false);
|
||||
}
|
||||
|
||||
static u8 efuse_write8(struct adapter *padapter, u16 address, u8 *value)
|
||||
{
|
||||
return efuse_OneByteWrite(padapter, address, *value, false);
|
||||
}
|
||||
|
||||
/*
|
||||
* read/wirte raw efuse data
|
||||
*/
|
||||
u8 rtw_efuse_access(struct adapter *padapter, u8 write, u16 start_addr, u16 cnts, u8 *data)
|
||||
{
|
||||
int i = 0;
|
||||
u16 real_content_len = 0, max_available_size = 0;
|
||||
u8 res = _FAIL ;
|
||||
u8 (*rw8)(struct adapter *, u16, u8*);
|
||||
|
||||
EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_EFUSE_REAL_CONTENT_LEN, (void *)&real_content_len, false);
|
||||
EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (void *)&max_available_size, false);
|
||||
|
||||
if (start_addr > real_content_len)
|
||||
return _FAIL;
|
||||
|
||||
if (write) {
|
||||
if ((start_addr + cnts) > max_available_size)
|
||||
return _FAIL;
|
||||
rw8 = &efuse_write8;
|
||||
} else {
|
||||
rw8 = &efuse_read8;
|
||||
}
|
||||
|
||||
Efuse_PowerSwitch(padapter, write, true);
|
||||
|
||||
/* e-fuse one byte read / write */
|
||||
for (i = 0; i < cnts; i++) {
|
||||
if (start_addr >= real_content_len) {
|
||||
res = _FAIL;
|
||||
break;
|
||||
}
|
||||
|
||||
res = rw8(padapter, start_addr++, data++);
|
||||
if (_FAIL == res)
|
||||
break;
|
||||
}
|
||||
|
||||
Efuse_PowerSwitch(padapter, write, false);
|
||||
|
||||
return res;
|
||||
}
|
||||
/* */
|
||||
u16 efuse_GetMaxSize(struct adapter *padapter)
|
||||
{
|
||||
u16 max_size;
|
||||
EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI , TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (void *)&max_size, false);
|
||||
return max_size;
|
||||
}
|
||||
/* */
|
||||
u8 efuse_GetCurrentSize(struct adapter *padapter, u16 *size)
|
||||
{
|
||||
Efuse_PowerSwitch(padapter, false, true);
|
||||
*size = Efuse_GetCurrentSize(padapter, EFUSE_WIFI, false);
|
||||
Efuse_PowerSwitch(padapter, false, false);
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
/* */
|
||||
u8 rtw_efuse_map_read(struct adapter *padapter, u16 addr, u16 cnts, u8 *data)
|
||||
{
|
||||
u16 mapLen = 0;
|
||||
|
||||
EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_EFUSE_MAP_LEN, (void *)&mapLen, false);
|
||||
|
||||
if ((addr + cnts) > mapLen)
|
||||
return _FAIL;
|
||||
|
||||
Efuse_PowerSwitch(padapter, false, true);
|
||||
|
||||
efuse_ReadEFuse(padapter, EFUSE_WIFI, addr, cnts, data, false);
|
||||
|
||||
Efuse_PowerSwitch(padapter, false, false);
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
u8 rtw_BT_efuse_map_read(struct adapter *padapter, u16 addr, u16 cnts, u8 *data)
|
||||
{
|
||||
u16 mapLen = 0;
|
||||
|
||||
EFUSE_GetEfuseDefinition(padapter, EFUSE_BT, TYPE_EFUSE_MAP_LEN, (void *)&mapLen, false);
|
||||
|
||||
if ((addr + cnts) > mapLen)
|
||||
return _FAIL;
|
||||
|
||||
Efuse_PowerSwitch(padapter, false, true);
|
||||
|
||||
efuse_ReadEFuse(padapter, EFUSE_BT, addr, cnts, data, false);
|
||||
|
||||
Efuse_PowerSwitch(padapter, false, false);
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
/* */
|
||||
u8 rtw_efuse_map_write(struct adapter *padapter, u16 addr, u16 cnts, u8 *data)
|
||||
{
|
||||
u8 offset, word_en;
|
||||
u8 *map;
|
||||
u8 newdata[PGPKT_DATA_SIZE + 1];
|
||||
s32 i, idx;
|
||||
u8 ret = _SUCCESS;
|
||||
u16 mapLen = 0;
|
||||
|
||||
EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_EFUSE_MAP_LEN, (void *)&mapLen, false);
|
||||
|
||||
if ((addr + cnts) > mapLen)
|
||||
return _FAIL;
|
||||
|
||||
map = rtw_zmalloc(mapLen);
|
||||
if (map == NULL)
|
||||
return _FAIL;
|
||||
|
||||
ret = rtw_efuse_map_read(padapter, 0, mapLen, map);
|
||||
if (ret == _FAIL)
|
||||
goto exit;
|
||||
|
||||
Efuse_PowerSwitch(padapter, true, true);
|
||||
|
||||
offset = (addr >> 3);
|
||||
word_en = 0xF;
|
||||
memset(newdata, 0xFF, PGPKT_DATA_SIZE + 1);
|
||||
i = addr & 0x7; /* index of one package */
|
||||
idx = 0; /* data index */
|
||||
|
||||
if (i & 0x1) {
|
||||
/* odd start */
|
||||
if (data[idx] != map[addr+idx]) {
|
||||
word_en &= ~BIT(i >> 1);
|
||||
newdata[i-1] = map[addr+idx-1];
|
||||
newdata[i] = data[idx];
|
||||
}
|
||||
i++;
|
||||
idx++;
|
||||
}
|
||||
do {
|
||||
for (; i < PGPKT_DATA_SIZE; i += 2) {
|
||||
if (cnts == idx)
|
||||
break;
|
||||
if ((cnts - idx) == 1) {
|
||||
if (data[idx] != map[addr+idx]) {
|
||||
word_en &= ~BIT(i >> 1);
|
||||
newdata[i] = data[idx];
|
||||
newdata[i+1] = map[addr+idx+1];
|
||||
}
|
||||
idx++;
|
||||
break;
|
||||
} else {
|
||||
if ((data[idx] != map[addr+idx]) ||
|
||||
(data[idx+1] != map[addr+idx+1])) {
|
||||
word_en &= ~BIT(i >> 1);
|
||||
newdata[i] = data[idx];
|
||||
newdata[i+1] = data[idx + 1];
|
||||
}
|
||||
idx += 2;
|
||||
}
|
||||
if (idx == cnts)
|
||||
break;
|
||||
}
|
||||
|
||||
if (word_en != 0xF) {
|
||||
ret = Efuse_PgPacketWrite(padapter, offset, word_en, newdata, false);
|
||||
DBG_88E("offset=%x\n", offset);
|
||||
DBG_88E("word_en=%x\n", word_en);
|
||||
|
||||
for (i = 0; i < PGPKT_DATA_SIZE; i++)
|
||||
DBG_88E("data=%x \t", newdata[i]);
|
||||
if (ret == _FAIL)
|
||||
break;
|
||||
}
|
||||
|
||||
if (idx == cnts)
|
||||
break;
|
||||
|
||||
offset++;
|
||||
i = 0;
|
||||
word_en = 0xF;
|
||||
memset(newdata, 0xFF, PGPKT_DATA_SIZE);
|
||||
} while (1);
|
||||
|
||||
Efuse_PowerSwitch(padapter, true, false);
|
||||
exit:
|
||||
kfree(map);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* */
|
||||
u8 rtw_BT_efuse_map_write(struct adapter *padapter, u16 addr, u16 cnts, u8 *data)
|
||||
{
|
||||
u8 offset, word_en;
|
||||
u8 *map;
|
||||
u8 newdata[PGPKT_DATA_SIZE + 1];
|
||||
s32 i, idx;
|
||||
u8 ret = _SUCCESS;
|
||||
u16 mapLen = 0;
|
||||
|
||||
EFUSE_GetEfuseDefinition(padapter, EFUSE_BT, TYPE_EFUSE_MAP_LEN, (void *)&mapLen, false);
|
||||
|
||||
if ((addr + cnts) > mapLen)
|
||||
return _FAIL;
|
||||
|
||||
map = rtw_zmalloc(mapLen);
|
||||
if (map == NULL)
|
||||
return _FAIL;
|
||||
|
||||
ret = rtw_BT_efuse_map_read(padapter, 0, mapLen, map);
|
||||
if (ret == _FAIL)
|
||||
goto exit;
|
||||
|
||||
Efuse_PowerSwitch(padapter, true, true);
|
||||
|
||||
offset = (addr >> 3);
|
||||
word_en = 0xF;
|
||||
memset(newdata, 0xFF, PGPKT_DATA_SIZE + 1);
|
||||
i = addr & 0x7; /* index of one package */
|
||||
idx = 0; /* data index */
|
||||
|
||||
if (i & 0x1) {
|
||||
/* odd start */
|
||||
if (data[idx] != map[addr+idx]) {
|
||||
word_en &= ~BIT(i >> 1);
|
||||
newdata[i-1] = map[addr+idx-1];
|
||||
newdata[i] = data[idx];
|
||||
}
|
||||
i++;
|
||||
idx++;
|
||||
}
|
||||
do {
|
||||
for (; i < PGPKT_DATA_SIZE; i += 2) {
|
||||
if (cnts == idx)
|
||||
break;
|
||||
if ((cnts - idx) == 1) {
|
||||
if (data[idx] != map[addr+idx]) {
|
||||
word_en &= ~BIT(i >> 1);
|
||||
newdata[i] = data[idx];
|
||||
newdata[i+1] = map[addr+idx+1];
|
||||
}
|
||||
idx++;
|
||||
break;
|
||||
} else {
|
||||
if ((data[idx] != map[addr+idx]) ||
|
||||
(data[idx+1] != map[addr+idx+1])) {
|
||||
word_en &= ~BIT(i >> 1);
|
||||
newdata[i] = data[idx];
|
||||
newdata[i+1] = data[idx + 1];
|
||||
}
|
||||
idx += 2;
|
||||
}
|
||||
if (idx == cnts)
|
||||
break;
|
||||
}
|
||||
|
||||
if (word_en != 0xF) {
|
||||
DBG_88E("%s: offset=%#X\n", __func__, offset);
|
||||
DBG_88E("%s: word_en=%#X\n", __func__, word_en);
|
||||
DBG_88E("%s: data=", __func__);
|
||||
for (i = 0; i < PGPKT_DATA_SIZE; i++)
|
||||
DBG_88E("0x%02X ", newdata[i]);
|
||||
DBG_88E("\n");
|
||||
|
||||
ret = Efuse_PgPacketWrite_BT(padapter, offset, word_en, newdata, false);
|
||||
if (ret == _FAIL)
|
||||
break;
|
||||
}
|
||||
|
||||
if (idx == cnts)
|
||||
break;
|
||||
|
||||
offset++;
|
||||
i = 0;
|
||||
word_en = 0xF;
|
||||
memset(newdata, 0xFF, PGPKT_DATA_SIZE);
|
||||
} while (1);
|
||||
|
||||
Efuse_PowerSwitch(padapter, true, false);
|
||||
|
||||
exit:
|
||||
|
||||
kfree(map);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Function: efuse_ShadowRead1Byte
|
||||
* efuse_ShadowRead2Byte
|
||||
* efuse_ShadowRead4Byte
|
||||
*
|
||||
* Overview: Read from efuse init map by one/two/four bytes !!!!!
|
||||
*
|
||||
* Input: NONE
|
||||
*
|
||||
* Output: NONE
|
||||
*
|
||||
* Return: NONE
|
||||
*
|
||||
* Revised History:
|
||||
* When Who Remark
|
||||
* 11/12/2008 MHC Create Version 0.
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
efuse_ShadowRead1Byte(
|
||||
struct adapter *pAdapter,
|
||||
u16 Offset,
|
||||
u8 *Value)
|
||||
{
|
||||
struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
|
||||
|
||||
*Value = pEEPROM->efuse_eeprom_data[Offset];
|
||||
|
||||
} /* EFUSE_ShadowRead1Byte */
|
||||
|
||||
/* Read Two Bytes */
|
||||
static void
|
||||
efuse_ShadowRead2Byte(
|
||||
struct adapter *pAdapter,
|
||||
u16 Offset,
|
||||
u16 *Value)
|
||||
{
|
||||
struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
|
||||
|
||||
*Value = pEEPROM->efuse_eeprom_data[Offset];
|
||||
*Value |= pEEPROM->efuse_eeprom_data[Offset+1]<<8;
|
||||
|
||||
} /* EFUSE_ShadowRead2Byte */
|
||||
|
||||
/* Read Four Bytes */
|
||||
static void
|
||||
efuse_ShadowRead4Byte(
|
||||
struct adapter *pAdapter,
|
||||
u16 Offset,
|
||||
u32 *Value)
|
||||
{
|
||||
struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
|
||||
|
||||
*Value = pEEPROM->efuse_eeprom_data[Offset];
|
||||
*Value |= pEEPROM->efuse_eeprom_data[Offset+1]<<8;
|
||||
*Value |= pEEPROM->efuse_eeprom_data[Offset+2]<<16;
|
||||
*Value |= pEEPROM->efuse_eeprom_data[Offset+3]<<24;
|
||||
|
||||
} /* efuse_ShadowRead4Byte */
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Function: Efuse_ReadAllMap
|
||||
*
|
||||
* Overview: Read All Efuse content
|
||||
*
|
||||
* Input: NONE
|
||||
*
|
||||
* Output: NONE
|
||||
*
|
||||
* Return: NONE
|
||||
*
|
||||
* Revised History:
|
||||
* When Who Remark
|
||||
* 11/11/2008 MHC Create Version 0.
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
static void Efuse_ReadAllMap(struct adapter *pAdapter, u8 efuseType, u8 *Efuse, bool pseudo)
|
||||
{
|
||||
u16 mapLen = 0;
|
||||
|
||||
Efuse_PowerSwitch(pAdapter, false, true);
|
||||
|
||||
EFUSE_GetEfuseDefinition(pAdapter, efuseType, TYPE_EFUSE_MAP_LEN, (void *)&mapLen, pseudo);
|
||||
|
||||
efuse_ReadEFuse(pAdapter, efuseType, 0, mapLen, Efuse, pseudo);
|
||||
|
||||
Efuse_PowerSwitch(pAdapter, false, false);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Function: EFUSE_ShadowMapUpdate
|
||||
*
|
||||
* Overview: Transfer current EFUSE content to shadow init and modify map.
|
||||
*
|
||||
* Input: NONE
|
||||
*
|
||||
* Output: NONE
|
||||
*
|
||||
* Return: NONE
|
||||
*
|
||||
* Revised History:
|
||||
* When Who Remark
|
||||
* 11/13/2008 MHC Create Version 0.
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
void EFUSE_ShadowMapUpdate(
|
||||
struct adapter *pAdapter,
|
||||
u8 efuseType,
|
||||
bool pseudo)
|
||||
{
|
||||
struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
|
||||
u16 mapLen = 0;
|
||||
|
||||
EFUSE_GetEfuseDefinition(pAdapter, efuseType, TYPE_EFUSE_MAP_LEN, (void *)&mapLen, pseudo);
|
||||
|
||||
if (pEEPROM->bautoload_fail_flag)
|
||||
memset(pEEPROM->efuse_eeprom_data, 0xFF, mapLen);
|
||||
else
|
||||
Efuse_ReadAllMap(pAdapter, efuseType, pEEPROM->efuse_eeprom_data, pseudo);
|
||||
} /* EFUSE_ShadowMapUpdate */
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Function: EFUSE_ShadowRead
|
||||
*
|
||||
* Overview: Read from efuse init map !!!!!
|
||||
*
|
||||
* Input: NONE
|
||||
*
|
||||
* Output: NONE
|
||||
*
|
||||
* Return: NONE
|
||||
*
|
||||
* Revised History:
|
||||
* When Who Remark
|
||||
* 11/12/2008 MHC Create Version 0.
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
void EFUSE_ShadowRead(struct adapter *pAdapter, u8 Type, u16 Offset, u32 *Value)
|
||||
{
|
||||
if (Type == 1)
|
||||
efuse_ShadowRead1Byte(pAdapter, Offset, (u8 *)Value);
|
||||
else if (Type == 2)
|
||||
efuse_ShadowRead2Byte(pAdapter, Offset, (u16 *)Value);
|
||||
else if (Type == 4)
|
||||
efuse_ShadowRead4Byte(pAdapter, Offset, (u32 *)Value);
|
||||
|
||||
} /* EFUSE_ShadowRead */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
@@ -11,7 +11,12 @@
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
/*
|
||||
|
||||
The purpose of rtw_io.c
|
||||
@@ -22,20 +27,11 @@ b. provides the protocol engine
|
||||
|
||||
c. provides the software interface between caller and the hardware interface
|
||||
|
||||
|
||||
Compiler Flag Option:
|
||||
|
||||
1. CONFIG_SDIO_HCI:
|
||||
a. USE_SYNC_IRP: Only sync operations are provided.
|
||||
b. USE_ASYNC_IRP:Both sync/async operations are provided.
|
||||
|
||||
2. CONFIG_USB_HCI:
|
||||
USB:
|
||||
a. USE_ASYNC_IRP: Both sync/async operations are provided.
|
||||
|
||||
3. CONFIG_CFIO_HCI:
|
||||
b. USE_SYNC_IRP: Only sync operations are provided.
|
||||
|
||||
|
||||
Only sync read/rtw_write_mem operations are provided.
|
||||
|
||||
jackson@realtek.com.tw
|
||||
@@ -43,337 +39,214 @@ jackson@realtek.com.tw
|
||||
*/
|
||||
|
||||
#define _RTW_IO_C_
|
||||
|
||||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
#include <hal_data.h>
|
||||
#include <rtw_io.h>
|
||||
#include <osdep_intf.h>
|
||||
#include <usb_ops.h>
|
||||
|
||||
#if defined(CONFIG_SDIO_HCI) || defined(CONFIG_PLATFORM_RTL8197D)
|
||||
#define rtw_le16_to_cpu(val) val
|
||||
#define rtw_le32_to_cpu(val) val
|
||||
#define rtw_cpu_to_le16(val) val
|
||||
#define rtw_cpu_to_le32(val) val
|
||||
#else
|
||||
#define rtw_le16_to_cpu(val) le16_to_cpu(val)
|
||||
#define rtw_le32_to_cpu(val) le32_to_cpu(val)
|
||||
#define rtw_cpu_to_le16(val) cpu_to_le16(val)
|
||||
#define rtw_cpu_to_le32(val) cpu_to_le32(val)
|
||||
#endif
|
||||
#define rtw_le16_to_cpu(val) le16_to_cpu(val)
|
||||
#define rtw_le32_to_cpu(val) le32_to_cpu(val)
|
||||
#define rtw_cpu_to_le16(val) cpu_to_le16(val)
|
||||
#define rtw_cpu_to_le32(val) cpu_to_le32(val)
|
||||
|
||||
|
||||
u8 _rtw_read8(_adapter *adapter, u32 addr)
|
||||
u8 _rtw_read8(struct adapter *adapter, u32 addr)
|
||||
{
|
||||
u8 r_val;
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
u8(*_read8)(struct intf_hdl *pintfhdl, u32 addr);
|
||||
_read8 = pintfhdl->io_ops._read8;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
u8 (*_read8)(struct intf_hdl *pintfhdl, u32 addr);
|
||||
|
||||
|
||||
_read8 = pintfhdl->io_ops._read8;
|
||||
r_val = _read8(pintfhdl, addr);
|
||||
|
||||
return r_val;
|
||||
}
|
||||
|
||||
u16 _rtw_read16(_adapter *adapter, u32 addr)
|
||||
u16 _rtw_read16(struct adapter *adapter, u32 addr)
|
||||
{
|
||||
u16 r_val;
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
u16(*_read16)(struct intf_hdl *pintfhdl, u32 addr);
|
||||
u16 (*_read16)(struct intf_hdl *pintfhdl, u32 addr);
|
||||
|
||||
_read16 = pintfhdl->io_ops._read16;
|
||||
|
||||
r_val = _read16(pintfhdl, addr);
|
||||
return rtw_le16_to_cpu(r_val);
|
||||
|
||||
return r_val;
|
||||
}
|
||||
|
||||
u32 _rtw_read32(_adapter *adapter, u32 addr)
|
||||
u32 _rtw_read32(struct adapter *adapter, u32 addr)
|
||||
{
|
||||
u32 r_val;
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
u32(*_read32)(struct intf_hdl *pintfhdl, u32 addr);
|
||||
u32 (*_read32)(struct intf_hdl *pintfhdl, u32 addr);
|
||||
|
||||
_read32 = pintfhdl->io_ops._read32;
|
||||
|
||||
r_val = _read32(pintfhdl, addr);
|
||||
return rtw_le32_to_cpu(r_val);
|
||||
|
||||
return r_val;
|
||||
}
|
||||
|
||||
int _rtw_write8(_adapter *adapter, u32 addr, u8 val)
|
||||
int _rtw_write8(struct adapter *adapter, u32 addr, u8 val)
|
||||
{
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_write8)(struct intf_hdl *pintfhdl, u32 addr, u8 val);
|
||||
int ret;
|
||||
|
||||
_write8 = pintfhdl->io_ops._write8;
|
||||
|
||||
ret = _write8(pintfhdl, addr, val);
|
||||
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
int _rtw_write16(_adapter *adapter, u32 addr, u16 val)
|
||||
|
||||
int _rtw_write16(struct adapter *adapter, u32 addr, u16 val)
|
||||
{
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_write16)(struct intf_hdl *pintfhdl, u32 addr, u16 val);
|
||||
int ret;
|
||||
|
||||
_write16 = pintfhdl->io_ops._write16;
|
||||
|
||||
val = rtw_cpu_to_le16(val);
|
||||
ret = _write16(pintfhdl, addr, val);
|
||||
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
int _rtw_write32(_adapter *adapter, u32 addr, u32 val)
|
||||
int _rtw_write32(struct adapter *adapter, u32 addr, u32 val)
|
||||
{
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_write32)(struct intf_hdl *pintfhdl, u32 addr, u32 val);
|
||||
int ret;
|
||||
|
||||
_write32 = pintfhdl->io_ops._write32;
|
||||
|
||||
val = rtw_cpu_to_le32(val);
|
||||
ret = _write32(pintfhdl, addr, val);
|
||||
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
|
||||
int _rtw_writeN(_adapter *adapter, u32 addr , u32 length , u8 *pdata)
|
||||
int _rtw_writeN(struct adapter *adapter, u32 addr , u32 length , u8 *pdata)
|
||||
{
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = (struct intf_hdl *)(&(pio_priv->intf));
|
||||
struct intf_hdl *pintfhdl = (struct intf_hdl *)(&(pio_priv->intf));
|
||||
int (*_writeN)(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata);
|
||||
int ret;
|
||||
|
||||
_writeN = pintfhdl->io_ops._writeN;
|
||||
|
||||
ret = _writeN(pintfhdl, addr, length, pdata);
|
||||
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SDIO_HCI
|
||||
u8 _rtw_sd_f0_read8(_adapter *adapter, u32 addr)
|
||||
int _rtw_write8_async(struct adapter *adapter, u32 addr, u8 val)
|
||||
{
|
||||
u8 r_val = 0x00;
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
u8(*_sd_f0_read8)(struct intf_hdl *pintfhdl, u32 addr);
|
||||
|
||||
_sd_f0_read8 = pintfhdl->io_ops._sd_f0_read8;
|
||||
|
||||
if (_sd_f0_read8)
|
||||
r_val = _sd_f0_read8(pintfhdl, addr);
|
||||
else
|
||||
RTW_WARN(FUNC_ADPT_FMT" _sd_f0_read8 callback is NULL\n", FUNC_ADPT_ARG(adapter));
|
||||
|
||||
return r_val;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SDIO_INDIRECT_ACCESS
|
||||
u8 _rtw_sd_iread8(_adapter *adapter, u32 addr)
|
||||
{
|
||||
u8 r_val = 0x00;
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
u8(*_sd_iread8)(struct intf_hdl *pintfhdl, u32 addr);
|
||||
|
||||
_sd_iread8 = pintfhdl->io_ops._sd_iread8;
|
||||
|
||||
if (_sd_iread8)
|
||||
r_val = _sd_iread8(pintfhdl, addr);
|
||||
else
|
||||
RTW_ERR(FUNC_ADPT_FMT" _sd_iread8 callback is NULL\n", FUNC_ADPT_ARG(adapter));
|
||||
|
||||
return r_val;
|
||||
}
|
||||
|
||||
u16 _rtw_sd_iread16(_adapter *adapter, u32 addr)
|
||||
{
|
||||
u16 r_val = 0x00;
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
u16(*_sd_iread16)(struct intf_hdl *pintfhdl, u32 addr);
|
||||
|
||||
_sd_iread16 = pintfhdl->io_ops._sd_iread16;
|
||||
|
||||
if (_sd_iread16)
|
||||
r_val = _sd_iread16(pintfhdl, addr);
|
||||
else
|
||||
RTW_ERR(FUNC_ADPT_FMT" _sd_iread16 callback is NULL\n", FUNC_ADPT_ARG(adapter));
|
||||
|
||||
return r_val;
|
||||
}
|
||||
|
||||
u32 _rtw_sd_iread32(_adapter *adapter, u32 addr)
|
||||
{
|
||||
u32 r_val = 0x00;
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
u32(*_sd_iread32)(struct intf_hdl *pintfhdl, u32 addr);
|
||||
|
||||
_sd_iread32 = pintfhdl->io_ops._sd_iread32;
|
||||
|
||||
if (_sd_iread32)
|
||||
r_val = _sd_iread32(pintfhdl, addr);
|
||||
else
|
||||
RTW_ERR(FUNC_ADPT_FMT" _sd_iread32 callback is NULL\n", FUNC_ADPT_ARG(adapter));
|
||||
|
||||
return r_val;
|
||||
}
|
||||
|
||||
int _rtw_sd_iwrite8(_adapter *adapter, u32 addr, u8 val)
|
||||
{
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_sd_iwrite8)(struct intf_hdl *pintfhdl, u32 addr, u8 val);
|
||||
int ret = -1;
|
||||
|
||||
_sd_iwrite8 = pintfhdl->io_ops._sd_iwrite8;
|
||||
|
||||
if (_sd_iwrite8)
|
||||
ret = _sd_iwrite8(pintfhdl, addr, val);
|
||||
else
|
||||
RTW_ERR(FUNC_ADPT_FMT" _sd_iwrite8 callback is NULL\n", FUNC_ADPT_ARG(adapter));
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
|
||||
int _rtw_sd_iwrite16(_adapter *adapter, u32 addr, u16 val)
|
||||
{
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_sd_iwrite16)(struct intf_hdl *pintfhdl, u32 addr, u16 val);
|
||||
int ret = -1;
|
||||
|
||||
_sd_iwrite16 = pintfhdl->io_ops._sd_iwrite16;
|
||||
|
||||
if (_sd_iwrite16)
|
||||
ret = _sd_iwrite16(pintfhdl, addr, val);
|
||||
else
|
||||
RTW_ERR(FUNC_ADPT_FMT" _sd_iwrite16 callback is NULL\n", FUNC_ADPT_ARG(adapter));
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
int _rtw_sd_iwrite32(_adapter *adapter, u32 addr, u32 val)
|
||||
{
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_sd_iwrite32)(struct intf_hdl *pintfhdl, u32 addr, u32 val);
|
||||
int ret = -1;
|
||||
|
||||
_sd_iwrite32 = pintfhdl->io_ops._sd_iwrite32;
|
||||
|
||||
if (_sd_iwrite32)
|
||||
ret = _sd_iwrite32(pintfhdl, addr, val);
|
||||
else
|
||||
RTW_ERR(FUNC_ADPT_FMT" _sd_iwrite32 callback is NULL\n", FUNC_ADPT_ARG(adapter));
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SDIO_INDIRECT_ACCESS */
|
||||
|
||||
#endif /* CONFIG_SDIO_HCI */
|
||||
|
||||
int _rtw_write8_async(_adapter *adapter, u32 addr, u8 val)
|
||||
{
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_write8_async)(struct intf_hdl *pintfhdl, u32 addr, u8 val);
|
||||
int ret;
|
||||
|
||||
_write8_async = pintfhdl->io_ops._write8_async;
|
||||
|
||||
ret = _write8_async(pintfhdl, addr, val);
|
||||
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
int _rtw_write16_async(_adapter *adapter, u32 addr, u16 val)
|
||||
|
||||
int _rtw_write16_async(struct adapter *adapter, u32 addr, u16 val)
|
||||
{
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_write16_async)(struct intf_hdl *pintfhdl, u32 addr, u16 val);
|
||||
int ret;
|
||||
|
||||
_write16_async = pintfhdl->io_ops._write16_async;
|
||||
val = rtw_cpu_to_le16(val);
|
||||
ret = _write16_async(pintfhdl, addr, val);
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
int _rtw_write32_async(_adapter *adapter, u32 addr, u32 val)
|
||||
|
||||
int _rtw_write32_async(struct adapter *adapter, u32 addr, u32 val)
|
||||
{
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
int (*_write32_async)(struct intf_hdl *pintfhdl, u32 addr, u32 val);
|
||||
int ret;
|
||||
|
||||
_write32_async = pintfhdl->io_ops._write32_async;
|
||||
val = rtw_cpu_to_le32(val);
|
||||
ret = _write32_async(pintfhdl, addr, val);
|
||||
|
||||
return RTW_STATUS_CODE(ret);
|
||||
}
|
||||
|
||||
void _rtw_read_mem(_adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
|
||||
void _rtw_read_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
|
||||
{
|
||||
void (*_read_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
|
||||
|
||||
if (RTW_CANNOT_RUN(adapter)) {
|
||||
return;
|
||||
|
||||
if (adapter->bDriverStopped || adapter->bSurpriseRemoved) {
|
||||
RT_TRACE(_module_rtl871x_io_c_, _drv_info_,
|
||||
("rtw_read_mem:bDriverStopped(%d) OR bSurpriseRemoved(%d)",
|
||||
adapter->bDriverStopped, adapter->bSurpriseRemoved));
|
||||
return;
|
||||
}
|
||||
|
||||
_read_mem = pintfhdl->io_ops._read_mem;
|
||||
|
||||
_read_mem(pintfhdl, addr, cnt, pmem);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void _rtw_write_mem(_adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
|
||||
void _rtw_write_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
|
||||
{
|
||||
void (*_write_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
|
||||
|
||||
|
||||
_write_mem = pintfhdl->io_ops._write_mem;
|
||||
|
||||
_write_mem(pintfhdl, addr, cnt, pmem);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void _rtw_read_port(_adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
|
||||
void _rtw_read_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
|
||||
{
|
||||
u32(*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
|
||||
|
||||
|
||||
if (RTW_CANNOT_RUN(adapter)) {
|
||||
return;
|
||||
if (adapter->bDriverStopped || adapter->bSurpriseRemoved) {
|
||||
RT_TRACE(_module_rtl871x_io_c_, _drv_info_,
|
||||
("rtw_read_port:bDriverStopped(%d) OR bSurpriseRemoved(%d)",
|
||||
adapter->bDriverStopped, adapter->bSurpriseRemoved));
|
||||
return;
|
||||
}
|
||||
|
||||
_read_port = pintfhdl->io_ops._read_port;
|
||||
|
||||
_read_port(pintfhdl, addr, cnt, pmem);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void _rtw_read_port_cancel(_adapter *adapter)
|
||||
void _rtw_read_port_cancel(struct adapter *adapter)
|
||||
{
|
||||
void (*_read_port_cancel)(struct intf_hdl *pintfhdl);
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
@@ -381,30 +254,29 @@ void _rtw_read_port_cancel(_adapter *adapter)
|
||||
|
||||
_read_port_cancel = pintfhdl->io_ops._read_port_cancel;
|
||||
|
||||
RTW_DISABLE_FUNC(adapter, DF_RX_BIT);
|
||||
|
||||
if (_read_port_cancel)
|
||||
_read_port_cancel(pintfhdl);
|
||||
}
|
||||
|
||||
u32 _rtw_write_port(_adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
|
||||
u32 _rtw_write_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
|
||||
{
|
||||
u32(*_write_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
|
||||
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
|
||||
u32 (*_write_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
struct intf_hdl *pintfhdl = &(pio_priv->intf);
|
||||
u32 ret = _SUCCESS;
|
||||
|
||||
|
||||
|
||||
_write_port = pintfhdl->io_ops._write_port;
|
||||
|
||||
ret = _write_port(pintfhdl, addr, cnt, pmem);
|
||||
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
u32 _rtw_write_port_and_wait(_adapter *adapter, u32 addr, u32 cnt, u8 *pmem, int timeout_ms)
|
||||
u32 _rtw_write_port_and_wait(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem, int timeout_ms)
|
||||
{
|
||||
int ret = _SUCCESS;
|
||||
struct xmit_buf *pxmitbuf = (struct xmit_buf *)pmem;
|
||||
@@ -415,17 +287,13 @@ u32 _rtw_write_port_and_wait(_adapter *adapter, u32 addr, u32 cnt, u8 *pmem, int
|
||||
|
||||
ret = _rtw_write_port(adapter, addr, cnt, pmem);
|
||||
|
||||
if (ret == _SUCCESS) {
|
||||
ret = rtw_sctx_wait(&sctx, __func__);
|
||||
if (ret == _SUCCESS)
|
||||
ret = rtw_sctx_wait(&sctx);
|
||||
|
||||
if (ret != _SUCCESS)
|
||||
pxmitbuf->sctx = NULL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void _rtw_write_port_cancel(_adapter *adapter)
|
||||
void _rtw_write_port_cancel(struct adapter *adapter)
|
||||
{
|
||||
void (*_write_port_cancel)(struct intf_hdl *pintfhdl);
|
||||
struct io_priv *pio_priv = &adapter->iopriv;
|
||||
@@ -433,12 +301,11 @@ void _rtw_write_port_cancel(_adapter *adapter)
|
||||
|
||||
_write_port_cancel = pintfhdl->io_ops._write_port_cancel;
|
||||
|
||||
RTW_DISABLE_FUNC(adapter, DF_TX_BIT);
|
||||
|
||||
if (_write_port_cancel)
|
||||
_write_port_cancel(pintfhdl);
|
||||
}
|
||||
int rtw_init_io_priv(_adapter *padapter, void (*set_intf_ops)(_adapter *padapter, struct _io_ops *pops))
|
||||
|
||||
int rtw_init_io_priv(struct adapter *padapter, void (*set_intf_ops)(struct _io_ops *pops))
|
||||
{
|
||||
struct io_priv *piopriv = &padapter->iopriv;
|
||||
struct intf_hdl *pintf = &piopriv->intf;
|
||||
@@ -450,445 +317,7 @@ int rtw_init_io_priv(_adapter *padapter, void (*set_intf_ops)(_adapter *padapter
|
||||
pintf->padapter = padapter;
|
||||
pintf->pintf_dev = adapter_to_dvobj(padapter);
|
||||
|
||||
set_intf_ops(padapter, &pintf->io_ops);
|
||||
set_intf_ops(&pintf->io_ops);
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Increase and check if the continual_io_error of this @param dvobjprive is larger than MAX_CONTINUAL_IO_ERR
|
||||
* @return _TRUE:
|
||||
* @return _FALSE:
|
||||
*/
|
||||
int rtw_inc_and_chk_continual_io_error(struct dvobj_priv *dvobj)
|
||||
{
|
||||
int ret = _FALSE;
|
||||
int value;
|
||||
|
||||
value = ATOMIC_INC_RETURN(&dvobj->continual_io_error);
|
||||
if (value > MAX_CONTINUAL_IO_ERR) {
|
||||
RTW_INFO("[dvobj:%p][ERROR] continual_io_error:%d > %d\n", dvobj, value, MAX_CONTINUAL_IO_ERR);
|
||||
ret = _TRUE;
|
||||
} else {
|
||||
/* RTW_INFO("[dvobj:%p] continual_io_error:%d\n", dvobj, value); */
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the continual_io_error of this @param dvobjprive to 0
|
||||
*/
|
||||
void rtw_reset_continual_io_error(struct dvobj_priv *dvobj)
|
||||
{
|
||||
ATOMIC_SET(&dvobj->continual_io_error, 0);
|
||||
}
|
||||
|
||||
#ifdef DBG_IO
|
||||
#define RTW_IO_SNIFF_TYPE_RANGE 0 /* specific address range is accessed */
|
||||
#define RTW_IO_SNIFF_TYPE_VALUE 1 /* value match for sniffed range */
|
||||
|
||||
struct rtw_io_sniff_ent {
|
||||
u8 chip;
|
||||
u8 hci;
|
||||
u32 addr;
|
||||
u8 type;
|
||||
union {
|
||||
u32 end_addr;
|
||||
struct {
|
||||
u32 mask;
|
||||
u32 val;
|
||||
bool equal;
|
||||
} vm; /* value match */
|
||||
} u;
|
||||
bool trace;
|
||||
char *tag;
|
||||
};
|
||||
|
||||
#define RTW_IO_SNIFF_RANGE_ENT(_chip, _hci, _addr, _end_addr, _trace, _tag) \
|
||||
{.chip = _chip, .hci = _hci, .addr = _addr, .u.end_addr = _end_addr, .trace = _trace, .tag = _tag, .type = RTW_IO_SNIFF_TYPE_RANGE,}
|
||||
|
||||
#define RTW_IO_SNIFF_VALUE_ENT(_chip, _hci, _addr, _mask, _val, _equal, _trace, _tag) \
|
||||
{.chip = _chip, .hci = _hci, .addr = _addr, .u.vm.mask = _mask, .u.vm.val = _val, .u.vm.equal = _equal, .trace = _trace, .tag = _tag, .type = RTW_IO_SNIFF_TYPE_VALUE,}
|
||||
|
||||
/* part or all sniffed range is enabled (not all 0) */
|
||||
#define RTW_IO_SNIFF_EN_ENT(_chip, _hci, _addr, _mask, _trace, _tag) \
|
||||
{.chip = _chip, .hci = _hci, .addr = _addr, .u.vm.mask = _mask, .u.vm.val = 0, .u.vm.equal = 0, .trace = _trace, .tag = _tag, .type = RTW_IO_SNIFF_TYPE_VALUE,}
|
||||
|
||||
/* part or all sniffed range is disabled (not all 1) */
|
||||
#define RTW_IO_SNIFF_DIS_ENT(_chip, _hci, _addr, _mask, _trace, _tag) \
|
||||
{.chip = _chip, .hci = _hci, .addr = _addr, .u.vm.mask = _mask, .u.vm.val = 0xFFFFFFFF, .u.vm.equal = 0, .trace = _trace, .tag = _tag, .type = RTW_IO_SNIFF_TYPE_VALUE,}
|
||||
|
||||
const struct rtw_io_sniff_ent read_sniff[] = {
|
||||
#ifdef DBG_IO_HCI_EN_CHK
|
||||
RTW_IO_SNIFF_EN_ENT(MAX_CHIP_TYPE, RTW_SDIO, 0x02, 0x1FC, 1, "SDIO 0x02[8:2] not all 0"),
|
||||
RTW_IO_SNIFF_EN_ENT(MAX_CHIP_TYPE, RTW_USB, 0x02, 0x1E0, 1, "USB 0x02[8:5] not all 0"),
|
||||
RTW_IO_SNIFF_EN_ENT(MAX_CHIP_TYPE, RTW_PCIE, 0x02, 0x01C, 1, "PCI 0x02[4:2] not all 0"),
|
||||
#endif
|
||||
#ifdef DBG_IO_SNIFF_EXAMPLE
|
||||
RTW_IO_SNIFF_RANGE_ENT(MAX_CHIP_TYPE, 0, 0x522, 0x522, 0, "read TXPAUSE"),
|
||||
RTW_IO_SNIFF_DIS_ENT(MAX_CHIP_TYPE, 0, 0x02, 0x3, 0, "0x02[1:0] not all 1"),
|
||||
#endif
|
||||
};
|
||||
|
||||
const int read_sniff_num = sizeof(read_sniff) / sizeof(struct rtw_io_sniff_ent);
|
||||
|
||||
const struct rtw_io_sniff_ent write_sniff[] = {
|
||||
#ifdef DBG_IO_HCI_EN_CHK
|
||||
RTW_IO_SNIFF_EN_ENT(MAX_CHIP_TYPE, RTW_SDIO, 0x02, 0x1FC, 1, "SDIO 0x02[8:2] not all 0"),
|
||||
RTW_IO_SNIFF_EN_ENT(MAX_CHIP_TYPE, RTW_USB, 0x02, 0x1E0, 1, "USB 0x02[8:5] not all 0"),
|
||||
RTW_IO_SNIFF_EN_ENT(MAX_CHIP_TYPE, RTW_PCIE, 0x02, 0x01C, 1, "PCI 0x02[4:2] not all 0"),
|
||||
#endif
|
||||
#ifdef DBG_IO_8822C_1TX_PATH_EN
|
||||
RTW_IO_SNIFF_VALUE_ENT(RTL8822C, 0, 0x1a04, 0xc0000000, 0x02, 1, 0, "write tx_path_en_cck A enabled"),
|
||||
RTW_IO_SNIFF_VALUE_ENT(RTL8822C, 0, 0x1a04, 0xc0000000, 0x01, 1, 0, "write tx_path_en_cck B enabled"),
|
||||
RTW_IO_SNIFF_VALUE_ENT(RTL8822C, 0, 0x1a04, 0xc0000000, 0x03, 1, 1, "write tx_path_en_cck AB enabled"),
|
||||
RTW_IO_SNIFF_VALUE_ENT(RTL8822C, 0, 0x820, 0x03, 0x01, 1, 0, "write tx_path_en_ofdm_1sts A enabled"),
|
||||
RTW_IO_SNIFF_VALUE_ENT(RTL8822C, 0, 0x820, 0x03, 0x02, 1, 0, "write tx_path_en_ofdm_1sts B enabled"),
|
||||
RTW_IO_SNIFF_VALUE_ENT(RTL8822C, 0, 0x820, 0x03, 0x03, 1, 1, "write tx_path_en_ofdm_1sts AB enabled"),
|
||||
RTW_IO_SNIFF_VALUE_ENT(RTL8822C, 0, 0x820, 0x30, 0x01, 1, 0, "write tx_path_en_ofdm_2sts A enabled"),
|
||||
RTW_IO_SNIFF_VALUE_ENT(RTL8822C, 0, 0x820, 0x30, 0x02, 1, 0, "write tx_path_en_ofdm_2sts B enabled"),
|
||||
RTW_IO_SNIFF_VALUE_ENT(RTL8822C, 0, 0x820, 0x30, 0x03, 1, 1, "write tx_path_en_ofdm_2sts AB enabled"),
|
||||
#endif
|
||||
#ifdef DBG_IO_SNIFF_EXAMPLE
|
||||
RTW_IO_SNIFF_RANGE_ENT(MAX_CHIP_TYPE, 0, 0x522, 0x522, 0, "write TXPAUSE"),
|
||||
RTW_IO_SNIFF_DIS_ENT(MAX_CHIP_TYPE, 0, 0x02, 0x3, 0, "0x02[1:0] not all 1"),
|
||||
#endif
|
||||
};
|
||||
|
||||
const int write_sniff_num = sizeof(write_sniff) / sizeof(struct rtw_io_sniff_ent);
|
||||
|
||||
static bool match_io_sniff_ranges(_adapter *adapter
|
||||
, const struct rtw_io_sniff_ent *sniff, int i, u32 addr, u16 len)
|
||||
{
|
||||
|
||||
/* check if IO range after sniff end address */
|
||||
if (addr > sniff->u.end_addr)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static bool match_io_sniff_value(_adapter *adapter
|
||||
, const struct rtw_io_sniff_ent *sniff, int i, u32 addr, u8 len, u32 val)
|
||||
{
|
||||
u8 sniff_len;
|
||||
s8 mask_shift;
|
||||
u32 mask;
|
||||
s8 value_shift;
|
||||
u32 value;
|
||||
bool ret = 0;
|
||||
|
||||
/* check if IO range after sniff end address */
|
||||
sniff_len = 4;
|
||||
while (!(sniff->u.vm.mask & (0xFF << ((sniff_len - 1) * 8)))) {
|
||||
sniff_len--;
|
||||
if (sniff_len == 0)
|
||||
goto exit;
|
||||
}
|
||||
if (sniff->addr + sniff_len <= addr)
|
||||
goto exit;
|
||||
|
||||
/* align to IO addr */
|
||||
mask_shift = (sniff->addr - addr) * 8;
|
||||
value_shift = mask_shift + bitshift(sniff->u.vm.mask);
|
||||
if (mask_shift > 0)
|
||||
mask = sniff->u.vm.mask << mask_shift;
|
||||
else if (mask_shift < 0)
|
||||
mask = sniff->u.vm.mask >> -mask_shift;
|
||||
else
|
||||
mask = sniff->u.vm.mask;
|
||||
|
||||
if (value_shift > 0)
|
||||
value = sniff->u.vm.val << value_shift;
|
||||
else if (mask_shift < 0)
|
||||
value = sniff->u.vm.val >> -value_shift;
|
||||
else
|
||||
value = sniff->u.vm.val;
|
||||
|
||||
if ((sniff->u.vm.equal && (mask & val) == (mask & value))
|
||||
|| (!sniff->u.vm.equal && (mask & val) != (mask & value))
|
||||
) {
|
||||
ret = 1;
|
||||
if (0)
|
||||
RTW_INFO(FUNC_ADPT_FMT" addr:0x%x len:%u val:0x%x (i:%d sniff_len:%u m_shift:%d mask:0x%x v_shifd:%d value:0x%x equal:%d)\n"
|
||||
, FUNC_ADPT_ARG(adapter), addr, len, val, i, sniff_len, mask_shift, mask, value_shift, value, sniff->u.vm.equal);
|
||||
}
|
||||
|
||||
exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool match_io_sniff(_adapter *adapter
|
||||
, const struct rtw_io_sniff_ent *sniff, int i, u32 addr, u8 len, u32 val)
|
||||
{
|
||||
bool ret = 0;
|
||||
|
||||
if (sniff->chip != MAX_CHIP_TYPE
|
||||
&& sniff->chip != rtw_get_chip_type(adapter))
|
||||
goto exit;
|
||||
if (sniff->hci
|
||||
&& !(sniff->hci & rtw_get_intf_type(adapter)))
|
||||
goto exit;
|
||||
if (sniff->addr >= addr + len) /* IO range below sniff start address */
|
||||
goto exit;
|
||||
|
||||
switch (sniff->type) {
|
||||
case RTW_IO_SNIFF_TYPE_RANGE:
|
||||
ret = match_io_sniff_ranges(adapter, sniff, i, addr, len);
|
||||
break;
|
||||
case RTW_IO_SNIFF_TYPE_VALUE:
|
||||
if (len == 1 || len == 2 || len == 4)
|
||||
ret = match_io_sniff_value(adapter, sniff, i, addr, len, val);
|
||||
break;
|
||||
default:
|
||||
rtw_warn_on(1);
|
||||
break;
|
||||
}
|
||||
|
||||
exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
u32 match_read_sniff(_adapter *adapter, u32 addr, u16 len, u32 val)
|
||||
{
|
||||
int i;
|
||||
bool trace = 0;
|
||||
u32 match = 0;
|
||||
|
||||
for (i = 0; i < read_sniff_num; i++) {
|
||||
if (match_io_sniff(adapter, &read_sniff[i], i, addr, len, val)) {
|
||||
match++;
|
||||
trace |= read_sniff[i].trace;
|
||||
if (read_sniff[i].tag)
|
||||
RTW_INFO("DBG_IO TAG %s\n", read_sniff[i].tag);
|
||||
}
|
||||
}
|
||||
|
||||
rtw_warn_on(trace);
|
||||
|
||||
return match;
|
||||
}
|
||||
|
||||
u32 match_write_sniff(_adapter *adapter, u32 addr, u16 len, u32 val)
|
||||
{
|
||||
int i;
|
||||
bool trace = 0;
|
||||
u32 match = 0;
|
||||
|
||||
for (i = 0; i < write_sniff_num; i++) {
|
||||
if (match_io_sniff(adapter, &write_sniff[i], i, addr, len, val)) {
|
||||
match++;
|
||||
trace |= write_sniff[i].trace;
|
||||
if (write_sniff[i].tag)
|
||||
RTW_INFO("DBG_IO TAG %s\n", write_sniff[i].tag);
|
||||
}
|
||||
}
|
||||
|
||||
rtw_warn_on(trace);
|
||||
|
||||
return match;
|
||||
}
|
||||
|
||||
struct rf_sniff_ent {
|
||||
u8 path;
|
||||
u16 reg;
|
||||
u32 mask;
|
||||
};
|
||||
|
||||
struct rf_sniff_ent rf_read_sniff_ranges[] = {
|
||||
/* example for all path addr 0x55 with all RF Reg mask */
|
||||
/* {MAX_RF_PATH, 0x55, bRFRegOffsetMask}, */
|
||||
};
|
||||
|
||||
struct rf_sniff_ent rf_write_sniff_ranges[] = {
|
||||
/* example for all path addr 0x55 with all RF Reg mask */
|
||||
/* {MAX_RF_PATH, 0x55, bRFRegOffsetMask}, */
|
||||
};
|
||||
|
||||
int rf_read_sniff_num = sizeof(rf_read_sniff_ranges) / sizeof(struct rf_sniff_ent);
|
||||
int rf_write_sniff_num = sizeof(rf_write_sniff_ranges) / sizeof(struct rf_sniff_ent);
|
||||
|
||||
bool match_rf_read_sniff_ranges(_adapter *adapter, u8 path, u32 addr, u32 mask)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < rf_read_sniff_num; i++) {
|
||||
if (rf_read_sniff_ranges[i].path == MAX_RF_PATH || rf_read_sniff_ranges[i].path == path)
|
||||
if (addr == rf_read_sniff_ranges[i].reg && (mask & rf_read_sniff_ranges[i].mask))
|
||||
return _TRUE;
|
||||
}
|
||||
|
||||
return _FALSE;
|
||||
}
|
||||
|
||||
bool match_rf_write_sniff_ranges(_adapter *adapter, u8 path, u32 addr, u32 mask)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < rf_write_sniff_num; i++) {
|
||||
if (rf_write_sniff_ranges[i].path == MAX_RF_PATH || rf_write_sniff_ranges[i].path == path)
|
||||
if (addr == rf_write_sniff_ranges[i].reg && (mask & rf_write_sniff_ranges[i].mask))
|
||||
return _TRUE;
|
||||
}
|
||||
|
||||
return _FALSE;
|
||||
}
|
||||
|
||||
u8 dbg_rtw_read8(_adapter *adapter, u32 addr, const char *caller, const int line)
|
||||
{
|
||||
u8 val = _rtw_read8(adapter, addr);
|
||||
|
||||
if (match_read_sniff(adapter, addr, 1, val)) {
|
||||
RTW_INFO("DBG_IO %s:%d rtw_read8(0x%04x) return 0x%02x\n"
|
||||
, caller, line, addr, val);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
u16 dbg_rtw_read16(_adapter *adapter, u32 addr, const char *caller, const int line)
|
||||
{
|
||||
u16 val = _rtw_read16(adapter, addr);
|
||||
|
||||
if (match_read_sniff(adapter, addr, 2, val)) {
|
||||
RTW_INFO("DBG_IO %s:%d rtw_read16(0x%04x) return 0x%04x\n"
|
||||
, caller, line, addr, val);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
u32 dbg_rtw_read32(_adapter *adapter, u32 addr, const char *caller, const int line)
|
||||
{
|
||||
u32 val = _rtw_read32(adapter, addr);
|
||||
|
||||
if (match_read_sniff(adapter, addr, 4, val)) {
|
||||
RTW_INFO("DBG_IO %s:%d rtw_read32(0x%04x) return 0x%08x\n"
|
||||
, caller, line, addr, val);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
int dbg_rtw_write8(_adapter *adapter, u32 addr, u8 val, const char *caller, const int line)
|
||||
{
|
||||
if (match_write_sniff(adapter, addr, 1, val)) {
|
||||
RTW_INFO("DBG_IO %s:%d rtw_write8(0x%04x, 0x%02x)\n"
|
||||
, caller, line, addr, val);
|
||||
}
|
||||
|
||||
return _rtw_write8(adapter, addr, val);
|
||||
}
|
||||
int dbg_rtw_write16(_adapter *adapter, u32 addr, u16 val, const char *caller, const int line)
|
||||
{
|
||||
if (match_write_sniff(adapter, addr, 2, val)) {
|
||||
RTW_INFO("DBG_IO %s:%d rtw_write16(0x%04x, 0x%04x)\n"
|
||||
, caller, line, addr, val);
|
||||
}
|
||||
|
||||
return _rtw_write16(adapter, addr, val);
|
||||
}
|
||||
int dbg_rtw_write32(_adapter *adapter, u32 addr, u32 val, const char *caller, const int line)
|
||||
{
|
||||
if (match_write_sniff(adapter, addr, 4, val)) {
|
||||
RTW_INFO("DBG_IO %s:%d rtw_write32(0x%04x, 0x%08x)\n"
|
||||
, caller, line, addr, val);
|
||||
}
|
||||
|
||||
return _rtw_write32(adapter, addr, val);
|
||||
}
|
||||
int dbg_rtw_writeN(_adapter *adapter, u32 addr , u32 length , u8 *data, const char *caller, const int line)
|
||||
{
|
||||
if (match_write_sniff(adapter, addr, length, 0)) {
|
||||
RTW_INFO("DBG_IO %s:%d rtw_writeN(0x%04x, %u)\n"
|
||||
, caller, line, addr, length);
|
||||
}
|
||||
|
||||
return _rtw_writeN(adapter, addr, length, data);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SDIO_HCI
|
||||
u8 dbg_rtw_sd_f0_read8(_adapter *adapter, u32 addr, const char *caller, const int line)
|
||||
{
|
||||
u8 val = _rtw_sd_f0_read8(adapter, addr);
|
||||
|
||||
#if 0
|
||||
if (match_read_sniff(adapter, addr, 1, val)) {
|
||||
RTW_INFO("DBG_IO %s:%d rtw_sd_f0_read8(0x%04x) return 0x%02x\n"
|
||||
, caller, line, addr, val);
|
||||
}
|
||||
#endif
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SDIO_INDIRECT_ACCESS
|
||||
u8 dbg_rtw_sd_iread8(_adapter *adapter, u32 addr, const char *caller, const int line)
|
||||
{
|
||||
u8 val = rtw_sd_iread8(adapter, addr);
|
||||
|
||||
if (match_read_sniff(adapter, addr, 1, val)) {
|
||||
RTW_INFO("DBG_IO %s:%d rtw_sd_iread8(0x%04x) return 0x%02x\n"
|
||||
, caller, line, addr, val);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
u16 dbg_rtw_sd_iread16(_adapter *adapter, u32 addr, const char *caller, const int line)
|
||||
{
|
||||
u16 val = _rtw_sd_iread16(adapter, addr);
|
||||
|
||||
if (match_read_sniff(adapter, addr, 2, val)) {
|
||||
RTW_INFO("DBG_IO %s:%d rtw_sd_iread16(0x%04x) return 0x%04x\n"
|
||||
, caller, line, addr, val);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
u32 dbg_rtw_sd_iread32(_adapter *adapter, u32 addr, const char *caller, const int line)
|
||||
{
|
||||
u32 val = _rtw_sd_iread32(adapter, addr);
|
||||
|
||||
if (match_read_sniff(adapter, addr, 4, val)) {
|
||||
RTW_INFO("DBG_IO %s:%d rtw_sd_iread32(0x%04x) return 0x%08x\n"
|
||||
, caller, line, addr, val);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
int dbg_rtw_sd_iwrite8(_adapter *adapter, u32 addr, u8 val, const char *caller, const int line)
|
||||
{
|
||||
if (match_write_sniff(adapter, addr, 1, val)) {
|
||||
RTW_INFO("DBG_IO %s:%d rtw_sd_iwrite8(0x%04x, 0x%02x)\n"
|
||||
, caller, line, addr, val);
|
||||
}
|
||||
|
||||
return _rtw_sd_iwrite8(adapter, addr, val);
|
||||
}
|
||||
int dbg_rtw_sd_iwrite16(_adapter *adapter, u32 addr, u16 val, const char *caller, const int line)
|
||||
{
|
||||
if (match_write_sniff(adapter, addr, 2, val)) {
|
||||
RTW_INFO("DBG_IO %s:%d rtw_sd_iwrite16(0x%04x, 0x%04x)\n"
|
||||
, caller, line, addr, val);
|
||||
}
|
||||
|
||||
return _rtw_sd_iwrite16(adapter, addr, val);
|
||||
}
|
||||
int dbg_rtw_sd_iwrite32(_adapter *adapter, u32 addr, u32 val, const char *caller, const int line)
|
||||
{
|
||||
if (match_write_sniff(adapter, addr, 4, val)) {
|
||||
RTW_INFO("DBG_IO %s:%d rtw_sd_iwrite32(0x%04x, 0x%08x)\n"
|
||||
, caller, line, addr, val);
|
||||
}
|
||||
|
||||
return _rtw_sd_iwrite32(adapter, addr, val);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SDIO_INDIRECT_ACCESS */
|
||||
|
||||
#endif /* CONFIG_SDIO_HCI */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define _RTW_IOCTL_QUERY_C_
|
||||
|
||||
#include <drv_types.h>
|
||||
|
||||
|
||||
@@ -1,901 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define _RTW_IOCTL_RTL_C_
|
||||
|
||||
#include <drv_types.h>
|
||||
|
||||
#ifdef CONFIG_MP_INCLUDED
|
||||
#include <rtw_mp_ioctl.h>
|
||||
#endif
|
||||
|
||||
struct oid_obj_priv oid_rtl_seg_01_01[] = {
|
||||
{1, &oid_null_function}, /* 0x80 */
|
||||
{1, &oid_null_function}, /* 0x81 */
|
||||
{1, &oid_null_function}, /* 0x82 */
|
||||
{1, &oid_null_function}, /* 0x83 */ /* OID_RT_SET_SNIFFER_MODE */
|
||||
{1, &oid_rt_get_signal_quality_hdl}, /* 0x84 */
|
||||
{1, &oid_rt_get_small_packet_crc_hdl}, /* 0x85 */
|
||||
{1, &oid_rt_get_middle_packet_crc_hdl}, /* 0x86 */
|
||||
{1, &oid_rt_get_large_packet_crc_hdl}, /* 0x87 */
|
||||
{1, &oid_rt_get_tx_retry_hdl}, /* 0x88 */
|
||||
{1, &oid_rt_get_rx_retry_hdl}, /* 0x89 */
|
||||
{1, &oid_rt_pro_set_fw_dig_state_hdl}, /* 0x8A */
|
||||
{1, &oid_rt_pro_set_fw_ra_state_hdl} , /* 0x8B */
|
||||
{1, &oid_null_function}, /* 0x8C */
|
||||
{1, &oid_null_function}, /* 0x8D */
|
||||
{1, &oid_null_function}, /* 0x8E */
|
||||
{1, &oid_null_function}, /* 0x8F */
|
||||
{1, &oid_rt_get_rx_total_packet_hdl}, /* 0x90 */
|
||||
{1, &oid_rt_get_tx_beacon_ok_hdl}, /* 0x91 */
|
||||
{1, &oid_rt_get_tx_beacon_err_hdl}, /* 0x92 */
|
||||
{1, &oid_rt_get_rx_icv_err_hdl}, /* 0x93 */
|
||||
{1, &oid_rt_set_encryption_algorithm_hdl}, /* 0x94 */
|
||||
{1, &oid_null_function}, /* 0x95 */
|
||||
{1, &oid_rt_get_preamble_mode_hdl}, /* 0x96 */
|
||||
{1, &oid_null_function}, /* 0x97 */
|
||||
{1, &oid_rt_get_ap_ip_hdl}, /* 0x98 */
|
||||
{1, &oid_rt_get_channelplan_hdl}, /* 0x99 */
|
||||
{1, &oid_rt_set_preamble_mode_hdl}, /* 0x9A */
|
||||
{1, &oid_rt_set_bcn_intvl_hdl}, /* 0x9B */
|
||||
{1, &oid_null_function}, /* 0x9C */
|
||||
{1, &oid_rt_dedicate_probe_hdl}, /* 0x9D */
|
||||
{1, &oid_null_function}, /* 0x9E */
|
||||
{1, &oid_null_function}, /* 0x9F */
|
||||
{1, &oid_null_function}, /* 0xA0 */
|
||||
{1, &oid_null_function}, /* 0xA1 */
|
||||
{1, &oid_null_function}, /* 0xA2 */
|
||||
{1, &oid_null_function}, /* 0xA3 */
|
||||
{1, &oid_null_function}, /* 0xA4 */
|
||||
{1, &oid_null_function}, /* 0xA5 */
|
||||
{1, &oid_null_function}, /* 0xA6 */
|
||||
{1, &oid_rt_get_total_tx_bytes_hdl}, /* 0xA7 */
|
||||
{1, &oid_rt_get_total_rx_bytes_hdl}, /* 0xA8 */
|
||||
{1, &oid_rt_current_tx_power_level_hdl}, /* 0xA9 */
|
||||
{1, &oid_rt_get_enc_key_mismatch_count_hdl}, /* 0xAA */
|
||||
{1, &oid_rt_get_enc_key_match_count_hdl}, /* 0xAB */
|
||||
{1, &oid_rt_get_channel_hdl}, /* 0xAC */
|
||||
{1, &oid_rt_set_channelplan_hdl}, /* 0xAD */
|
||||
{1, &oid_rt_get_hardware_radio_off_hdl}, /* 0xAE */
|
||||
{1, &oid_null_function}, /* 0xAF */
|
||||
{1, &oid_null_function}, /* 0xB0 */
|
||||
{1, &oid_null_function}, /* 0xB1 */
|
||||
{1, &oid_null_function}, /* 0xB2 */
|
||||
{1, &oid_null_function}, /* 0xB3 */
|
||||
{1, &oid_rt_get_key_mismatch_hdl}, /* 0xB4 */
|
||||
{1, &oid_null_function}, /* 0xB5 */
|
||||
{1, &oid_null_function}, /* 0xB6 */
|
||||
{1, &oid_null_function}, /* 0xB7 */
|
||||
{1, &oid_null_function}, /* 0xB8 */
|
||||
{1, &oid_null_function}, /* 0xB9 */
|
||||
{1, &oid_null_function}, /* 0xBA */
|
||||
{1, &oid_rt_supported_wireless_mode_hdl}, /* 0xBB */
|
||||
{1, &oid_rt_get_channel_list_hdl}, /* 0xBC */
|
||||
{1, &oid_rt_get_scan_in_progress_hdl}, /* 0xBD */
|
||||
{1, &oid_null_function}, /* 0xBE */
|
||||
{1, &oid_null_function}, /* 0xBF */
|
||||
{1, &oid_null_function}, /* 0xC0 */
|
||||
{1, &oid_rt_forced_data_rate_hdl}, /* 0xC1 */
|
||||
{1, &oid_rt_wireless_mode_for_scan_list_hdl}, /* 0xC2 */
|
||||
{1, &oid_rt_get_bss_wireless_mode_hdl}, /* 0xC3 */
|
||||
{1, &oid_rt_scan_with_magic_packet_hdl}, /* 0xC4 */
|
||||
{1, &oid_null_function}, /* 0xC5 */
|
||||
{1, &oid_null_function}, /* 0xC6 */
|
||||
{1, &oid_null_function}, /* 0xC7 */
|
||||
{1, &oid_null_function}, /* 0xC8 */
|
||||
{1, &oid_null_function}, /* 0xC9 */
|
||||
{1, &oid_null_function}, /* 0xCA */
|
||||
{1, &oid_null_function}, /* 0xCB */
|
||||
{1, &oid_null_function}, /* 0xCC */
|
||||
{1, &oid_null_function}, /* 0xCD */
|
||||
{1, &oid_null_function}, /* 0xCE */
|
||||
{1, &oid_null_function}, /* 0xCF */
|
||||
|
||||
};
|
||||
|
||||
struct oid_obj_priv oid_rtl_seg_01_03[] = {
|
||||
{1, &oid_rt_ap_get_associated_station_list_hdl}, /* 0x00 */
|
||||
{1, &oid_null_function}, /* 0x01 */
|
||||
{1, &oid_rt_ap_switch_into_ap_mode_hdl}, /* 0x02 */
|
||||
{1, &oid_null_function}, /* 0x03 */
|
||||
{1, &oid_rt_ap_supported_hdl}, /* 0x04 */
|
||||
{1, &oid_rt_ap_set_passphrase_hdl}, /* 0x05 */
|
||||
|
||||
};
|
||||
|
||||
struct oid_obj_priv oid_rtl_seg_01_11[] = {
|
||||
{1, &oid_null_function}, /* 0xC0 OID_RT_PRO_RX_FILTER */
|
||||
{1, &oid_null_function}, /* 0xC1 OID_CE_USB_WRITE_REGISTRY */
|
||||
{1, &oid_null_function}, /* 0xC2 OID_CE_USB_READ_REGISTRY */
|
||||
{1, &oid_null_function}, /* 0xC3 OID_RT_PRO_SET_INITIAL_GAIN */
|
||||
{1, &oid_null_function}, /* 0xC4 OID_RT_PRO_SET_BB_RF_STANDBY_MODE */
|
||||
{1, &oid_null_function}, /* 0xC5 OID_RT_PRO_SET_BB_RF_SHUTDOWN_MODE */
|
||||
{1, &oid_null_function}, /* 0xC6 OID_RT_PRO_SET_TX_CHARGE_PUMP */
|
||||
{1, &oid_null_function}, /* 0xC7 OID_RT_PRO_SET_RX_CHARGE_PUMP */
|
||||
{1, &oid_rt_pro_rf_write_registry_hdl}, /* 0xC8 */
|
||||
{1, &oid_rt_pro_rf_read_registry_hdl}, /* 0xC9 */
|
||||
{1, &oid_null_function} /* 0xCA OID_RT_PRO_QUERY_RF_TYPE */
|
||||
|
||||
};
|
||||
|
||||
struct oid_obj_priv oid_rtl_seg_03_00[] = {
|
||||
{1, &oid_null_function}, /* 0x00 */
|
||||
{1, &oid_rt_get_connect_state_hdl}, /* 0x01 */
|
||||
{1, &oid_null_function}, /* 0x02 */
|
||||
{1, &oid_null_function}, /* 0x03 */
|
||||
{1, &oid_rt_set_default_key_id_hdl}, /* 0x04 */
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* ************** oid_rtl_seg_01_01 section start ************** */
|
||||
|
||||
NDIS_STATUS oid_rt_pro_set_fw_dig_state_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
#if 0
|
||||
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
_irqL oldirql;
|
||||
|
||||
|
||||
if (poid_par_priv->type_of_oid != SET_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
_irqlevel_changed_(&oldirql, LOWER);
|
||||
if (poid_par_priv->information_buf_len >= sizeof(struct setdig_parm)) {
|
||||
/* DEBUG_ERR(("===> oid_rt_pro_set_fw_dig_state_hdl. type:0x%02x.\n",*((unsigned char*)poid_par_priv->information_buf ))); */
|
||||
if (!rtw_setfwdig_cmd(Adapter, *((unsigned char *)poid_par_priv->information_buf)))
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
|
||||
} else
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
_irqlevel_changed_(&oldirql, RAISE);
|
||||
#endif
|
||||
return status;
|
||||
}
|
||||
/* ----------------------------------------------------------------------------- */
|
||||
NDIS_STATUS oid_rt_pro_set_fw_ra_state_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
#if 0
|
||||
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
_irqL oldirql;
|
||||
|
||||
if (poid_par_priv->type_of_oid != SET_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
_irqlevel_changed_(&oldirql, LOWER);
|
||||
|
||||
if (poid_par_priv->information_buf_len >= sizeof(struct setra_parm)) {
|
||||
/* DEBUG_ERR(("===> oid_rt_pro_set_fw_ra_state_hdl. type:0x%02x.\n",*((unsigned char*)poid_par_priv->information_buf ))); */
|
||||
if (!rtw_setfwra_cmd(Adapter, *((unsigned char *)poid_par_priv->information_buf)))
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
|
||||
} else
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
_irqlevel_changed_(&oldirql, RAISE);
|
||||
#endif
|
||||
return status;
|
||||
}
|
||||
/* ----------------------------------------------------------------------------- */
|
||||
NDIS_STATUS oid_rt_get_signal_quality_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
/* DEBUG_ERR(("<**********************oid_rt_get_signal_quality_hdl\n")); */
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (pMgntInfo->mAssoc || pMgntInfo->mIbss) {
|
||||
ulInfo = pAdapter->RxStats.SignalQuality;
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
} else {
|
||||
ulInfo = 0xffffffff; /* It stands for -1 in 4-byte integer. */
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
|
||||
NDIS_STATUS oid_rt_get_small_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
|
||||
*(ULONG *)poid_par_priv->information_buf = padapter->recvpriv.rx_smallpacket_crcerr;
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
} else
|
||||
status = NDIS_STATUS_INVALID_LENGTH;
|
||||
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
|
||||
*(ULONG *)poid_par_priv->information_buf = padapter->recvpriv.rx_middlepacket_crcerr;
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
} else
|
||||
status = NDIS_STATUS_INVALID_LENGTH;
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_get_large_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
|
||||
*(ULONG *)poid_par_priv->information_buf = padapter->recvpriv.rx_largepacket_crcerr;
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
} else
|
||||
status = NDIS_STATUS_INVALID_LENGTH;
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_get_tx_retry_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_get_rx_retry_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_get_rx_total_packet_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
|
||||
*(u64 *)poid_par_priv->information_buf = padapter->recvpriv.rx_pkts + padapter->recvpriv.rx_drop;
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
} else
|
||||
status = NDIS_STATUS_INVALID_LENGTH;
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_get_tx_beacon_ok_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_get_tx_beacon_err_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_get_rx_icv_err_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
if (poid_par_priv->information_buf_len >= sizeof(u32)) {
|
||||
/* _rtw_memcpy(*(uint *)poid_par_priv->information_buf,padapter->recvpriv.rx_icv_err,sizeof(u32)); */
|
||||
*(uint *)poid_par_priv->information_buf = padapter->recvpriv.rx_icv_err;
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
} else
|
||||
status = NDIS_STATUS_INVALID_LENGTH ;
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_set_encryption_algorithm_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != SET_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_get_preamble_mode_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
ULONG preamblemode = 0 ;
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
|
||||
if (padapter->registrypriv.preamble == PREAMBLE_LONG)
|
||||
preamblemode = 0;
|
||||
else if (padapter->registrypriv.preamble == PREAMBLE_AUTO)
|
||||
preamblemode = 1;
|
||||
else if (padapter->registrypriv.preamble == PREAMBLE_SHORT)
|
||||
preamblemode = 2;
|
||||
|
||||
|
||||
*(ULONG *)poid_par_priv->information_buf = preamblemode ;
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
} else
|
||||
status = NDIS_STATUS_INVALID_LENGTH ;
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_get_ap_ip_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
NDIS_STATUS oid_rt_get_channelplan_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
struct rf_ctl_t *rfctl = adapter_to_rfctl(padapter);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
*(u16 *)poid_par_priv->information_buf = rfctl->ChannelPlan;
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_set_channelplan_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
struct rf_ctl_t *rfctl = adapter_to_rfctl(padapter);
|
||||
|
||||
if (poid_par_priv->type_of_oid != SET_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
rfctl->ChannelPlan = *(u16 *)poid_par_priv->information_buf;
|
||||
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_set_preamble_mode_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
ULONG preamblemode = 0;
|
||||
if (poid_par_priv->type_of_oid != SET_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
|
||||
preamblemode = *(ULONG *)poid_par_priv->information_buf ;
|
||||
if (preamblemode == 0)
|
||||
padapter->registrypriv.preamble = PREAMBLE_LONG;
|
||||
else if (preamblemode == 1)
|
||||
padapter->registrypriv.preamble = PREAMBLE_AUTO;
|
||||
else if (preamblemode == 2)
|
||||
padapter->registrypriv.preamble = PREAMBLE_SHORT;
|
||||
|
||||
*(ULONG *)poid_par_priv->information_buf = preamblemode ;
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
} else
|
||||
status = NDIS_STATUS_INVALID_LENGTH ;
|
||||
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_set_bcn_intvl_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != SET_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_dedicate_probe_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_get_total_tx_bytes_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
|
||||
*(u64 *)poid_par_priv->information_buf = padapter->xmitpriv.tx_bytes;
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
} else
|
||||
status = NDIS_STATUS_INVALID_LENGTH ;
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_get_total_rx_bytes_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
|
||||
/* _rtw_memcpy(*(uint *)poid_par_priv->information_buf,padapter->recvpriv.rx_icv_err,sizeof(u32)); */
|
||||
*(u64 *)poid_par_priv->information_buf = padapter->recvpriv.rx_bytes;
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
} else
|
||||
status = NDIS_STATUS_INVALID_LENGTH ;
|
||||
return status;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_current_tx_power_level_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_get_enc_key_mismatch_count_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_get_enc_key_match_count_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_get_channel_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
NDIS_802_11_CONFIGURATION *pnic_Config;
|
||||
|
||||
ULONG channelnum;
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
if ((check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) ||
|
||||
(check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE))
|
||||
pnic_Config = &pmlmepriv->cur_network.network.Configuration;
|
||||
else
|
||||
pnic_Config = &padapter->registrypriv.dev_network.Configuration;
|
||||
|
||||
channelnum = pnic_Config->DSConfig;
|
||||
*(ULONG *)poid_par_priv->information_buf = channelnum;
|
||||
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
|
||||
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_get_hardware_radio_off_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_get_key_mismatch_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_supported_wireless_mode_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
ULONG ulInfo = 0 ;
|
||||
/* DEBUG_ERR(("<**********************oid_rt_supported_wireless_mode_hdl\n")); */
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
if (poid_par_priv->information_buf_len >= sizeof(ULONG)) {
|
||||
ulInfo |= 0x0100; /* WIRELESS_MODE_B */
|
||||
ulInfo |= 0x0200; /* WIRELESS_MODE_G */
|
||||
ulInfo |= 0x0400; /* WIRELESS_MODE_A */
|
||||
|
||||
*(ULONG *) poid_par_priv->information_buf = ulInfo;
|
||||
/* DEBUG_ERR(("<===oid_rt_supported_wireless_mode %x\n",ulInfo)); */
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
} else
|
||||
status = NDIS_STATUS_INVALID_LENGTH;
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_get_channel_list_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_get_scan_in_progress_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
NDIS_STATUS oid_rt_forced_data_rate_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_wireless_mode_for_scan_list_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_get_bss_wireless_mode_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
NDIS_STATUS oid_rt_scan_with_magic_packet_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
return status;
|
||||
}
|
||||
/* ************** oid_rtl_seg_01_01 section end ************** */
|
||||
|
||||
/* ************** oid_rtl_seg_01_03 section start ************** */
|
||||
NDIS_STATUS oid_rt_ap_get_associated_station_list_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_ap_switch_into_ap_mode_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_ap_supported_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
return status;
|
||||
}
|
||||
NDIS_STATUS oid_rt_ap_set_passphrase_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != SET_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* ************** oid_rtl_seg_01_03 section end ************** */
|
||||
|
||||
/* **************** oid_rtl_seg_01_11 section start **************** */
|
||||
NDIS_STATUS oid_rt_pro_rf_write_registry_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
_irqL oldirql;
|
||||
/* DEBUG_ERR(("<**********************oid_rt_pro_rf_write_registry_hdl\n")); */
|
||||
if (poid_par_priv->type_of_oid != SET_OID) { /* QUERY_OID */
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
_irqlevel_changed_(&oldirql, LOWER);
|
||||
if (poid_par_priv->information_buf_len == (sizeof(unsigned long) * 3)) {
|
||||
/* RegOffsetValue - The offset of RF register to write. */
|
||||
/* RegDataWidth - The data width of RF register to write. */
|
||||
/* RegDataValue - The value to write. */
|
||||
/* RegOffsetValue = *((unsigned long*)InformationBuffer); */
|
||||
/* RegDataWidth = *((unsigned long*)InformationBuffer+1); */
|
||||
/* RegDataValue = *((unsigned long*)InformationBuffer+2); */
|
||||
if (!rtw_setrfreg_cmd(Adapter,
|
||||
*(unsigned char *)poid_par_priv->information_buf,
|
||||
(unsigned long)(*((unsigned long *)poid_par_priv->information_buf + 2))))
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
|
||||
} else
|
||||
status = NDIS_STATUS_INVALID_LENGTH;
|
||||
_irqlevel_changed_(&oldirql, RAISE);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
NDIS_STATUS oid_rt_pro_rf_read_registry_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
#if 0
|
||||
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
_irqL oldirql;
|
||||
|
||||
/* DEBUG_ERR(("<**********************oid_rt_pro_rf_read_registry_hdl\n")); */
|
||||
if (poid_par_priv->type_of_oid != SET_OID) { /* QUERY_OID */
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
_irqlevel_changed_(&oldirql, LOWER);
|
||||
if (poid_par_priv->information_buf_len == (sizeof(unsigned long) * 3)) {
|
||||
if (Adapter->mppriv.act_in_progress == _TRUE)
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
else {
|
||||
/* init workparam */
|
||||
Adapter->mppriv.act_in_progress = _TRUE;
|
||||
Adapter->mppriv.workparam.bcompleted = _FALSE;
|
||||
Adapter->mppriv.workparam.act_type = MPT_READ_RF;
|
||||
Adapter->mppriv.workparam.io_offset = *(unsigned long *)poid_par_priv->information_buf;
|
||||
Adapter->mppriv.workparam.io_value = 0xcccccccc;
|
||||
|
||||
/* RegOffsetValue - The offset of RF register to read. */
|
||||
/* RegDataWidth - The data width of RF register to read. */
|
||||
/* RegDataValue - The value to read. */
|
||||
/* RegOffsetValue = *((unsigned long*)InformationBuffer); */
|
||||
/* RegDataWidth = *((unsigned long*)InformationBuffer+1); */
|
||||
/* RegDataValue = *((unsigned long*)InformationBuffer+2); */
|
||||
if (!rtw_getrfreg_cmd(Adapter,
|
||||
*(unsigned char *)poid_par_priv->information_buf,
|
||||
(unsigned char *)&Adapter->mppriv.workparam.io_value))
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
}
|
||||
|
||||
|
||||
} else
|
||||
status = NDIS_STATUS_INVALID_LENGTH;
|
||||
_irqlevel_changed_(&oldirql, RAISE);
|
||||
#endif
|
||||
return status;
|
||||
}
|
||||
|
||||
/* **************** oid_rtl_seg_01_11 section end**************** */
|
||||
|
||||
|
||||
/* ************** oid_rtl_seg_03_00 section start ************** */
|
||||
enum _CONNECT_STATE_ {
|
||||
CHECKINGSTATUS,
|
||||
ASSOCIATED,
|
||||
ADHOCMODE,
|
||||
NOTASSOCIATED
|
||||
};
|
||||
|
||||
NDIS_STATUS oid_rt_get_connect_state_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
|
||||
|
||||
ULONG ulInfo;
|
||||
|
||||
if (poid_par_priv->type_of_oid != QUERY_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
/* nStatus==0 CheckingStatus */
|
||||
/* nStatus==1 Associated */
|
||||
/* nStatus==2 AdHocMode */
|
||||
/* nStatus==3 NotAssociated */
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == _TRUE)
|
||||
ulInfo = CHECKINGSTATUS;
|
||||
else if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE)
|
||||
ulInfo = ASSOCIATED;
|
||||
else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == _TRUE)
|
||||
ulInfo = ADHOCMODE;
|
||||
else
|
||||
ulInfo = NOTASSOCIATED ;
|
||||
|
||||
*(ULONG *)poid_par_priv->information_buf = ulInfo;
|
||||
*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
|
||||
|
||||
#if 0
|
||||
/* Rearrange the order to let the UI still shows connection when scan is in progress */
|
||||
if (pMgntInfo->mAssoc)
|
||||
ulInfo = 1;
|
||||
else if (pMgntInfo->mIbss)
|
||||
ulInfo = 2;
|
||||
else if (pMgntInfo->bScanInProgress)
|
||||
ulInfo = 0;
|
||||
else
|
||||
ulInfo = 3;
|
||||
ulInfoLen = sizeof(ULONG);
|
||||
#endif
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
NDIS_STATUS oid_rt_set_default_key_id_hdl(struct oid_par_priv *poid_par_priv)
|
||||
{
|
||||
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
|
||||
PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
|
||||
|
||||
if (poid_par_priv->type_of_oid != SET_OID) {
|
||||
status = NDIS_STATUS_NOT_ACCEPTED;
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
/* ************** oid_rtl_seg_03_00 section end ************** */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
@@ -11,28 +11,31 @@
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include <drv_types.h>
|
||||
#include<rtw_iol.h>
|
||||
|
||||
#ifdef CONFIG_IOL
|
||||
struct xmit_frame *rtw_IOL_accquire_xmit_frame(ADAPTER *adapter)
|
||||
struct xmit_frame *rtw_IOL_accquire_xmit_frame(struct adapter *adapter)
|
||||
{
|
||||
struct xmit_frame *xmit_frame;
|
||||
struct xmit_buf *xmitbuf;
|
||||
struct pkt_attrib *pattrib;
|
||||
struct xmit_priv *pxmitpriv = &(adapter->xmitpriv);
|
||||
|
||||
#if 1
|
||||
xmit_frame = rtw_alloc_xmitframe(pxmitpriv);
|
||||
if (xmit_frame == NULL) {
|
||||
RTW_INFO("%s rtw_alloc_xmitframe return null\n", __FUNCTION__);
|
||||
DBG_88E("%s rtw_alloc_xmitframe return null\n", __func__);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
xmitbuf = rtw_alloc_xmitbuf(pxmitpriv);
|
||||
if (xmitbuf == NULL) {
|
||||
RTW_INFO("%s rtw_alloc_xmitbuf return null\n", __FUNCTION__);
|
||||
DBG_88E("%s rtw_alloc_xmitbuf return null\n", __func__);
|
||||
rtw_free_xmitframe(pxmitpriv, xmit_frame);
|
||||
xmit_frame = NULL;
|
||||
goto exit;
|
||||
@@ -45,27 +48,14 @@ struct xmit_frame *rtw_IOL_accquire_xmit_frame(ADAPTER *adapter)
|
||||
|
||||
pattrib = &xmit_frame->attrib;
|
||||
update_mgntframe_attrib(adapter, pattrib);
|
||||
pattrib->qsel = QSLT_BEACON;/* Beacon */
|
||||
pattrib->qsel = 0x10;/* Beacon */
|
||||
pattrib->subtype = WIFI_BEACON;
|
||||
pattrib->pktlen = pattrib->last_txcmdsz = 0;
|
||||
|
||||
#else
|
||||
xmit_frame = alloc_mgtxmitframe(pxmitpriv);
|
||||
if (xmit_frame == NULL)
|
||||
RTW_INFO("%s alloc_mgtxmitframe return null\n", __FUNCTION__);
|
||||
else {
|
||||
pattrib = &xmit_frame->attrib;
|
||||
update_mgntframe_attrib(adapter, pattrib);
|
||||
pattrib->qsel = QSLT_BEACON;
|
||||
pattrib->pktlen = pattrib->last_txcmdsz = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
pattrib->pktlen = 0;
|
||||
pattrib->last_txcmdsz = 0;
|
||||
exit:
|
||||
return xmit_frame;
|
||||
}
|
||||
|
||||
|
||||
int rtw_IOL_append_cmds(struct xmit_frame *xmit_frame, u8 *IOL_cmds, u32 cmd_len)
|
||||
{
|
||||
struct pkt_attrib *pattrib = &xmit_frame->attrib;
|
||||
@@ -73,138 +63,103 @@ int rtw_IOL_append_cmds(struct xmit_frame *xmit_frame, u8 *IOL_cmds, u32 cmd_len
|
||||
u32 ori_len;
|
||||
|
||||
buf_offset = TXDESC_OFFSET;
|
||||
ori_len = buf_offset + pattrib->pktlen;
|
||||
ori_len = buf_offset+pattrib->pktlen;
|
||||
|
||||
/* check if the io_buf can accommodate new cmds */
|
||||
if (ori_len + cmd_len + 8 > MAX_XMITBUF_SZ) {
|
||||
RTW_INFO("%s %u is large than MAX_XMITBUF_SZ:%u, can't accommodate new cmds\n", __FUNCTION__
|
||||
, ori_len + cmd_len + 8, MAX_XMITBUF_SZ);
|
||||
DBG_88E("%s %u is large than MAX_XMITBUF_SZ:%u, can't accommodate new cmds\n",
|
||||
__func__ , ori_len + cmd_len + 8, MAX_XMITBUF_SZ);
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
_rtw_memcpy(xmit_frame->buf_addr + buf_offset + pattrib->pktlen, IOL_cmds, cmd_len);
|
||||
memcpy(xmit_frame->buf_addr + buf_offset + pattrib->pktlen, IOL_cmds, cmd_len);
|
||||
pattrib->pktlen += cmd_len;
|
||||
pattrib->last_txcmdsz += cmd_len;
|
||||
|
||||
/* RTW_INFO("%s ori:%u + cmd_len:%u = %u\n", __FUNCTION__, ori_len, cmd_len, buf_offset+pattrib->pktlen); */
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
bool rtw_IOL_applied(ADAPTER *adapter)
|
||||
bool rtw_IOL_applied(struct adapter *adapter)
|
||||
{
|
||||
if (1 == adapter->registrypriv.fw_iol)
|
||||
return _TRUE;
|
||||
return true;
|
||||
|
||||
#ifdef CONFIG_USB_HCI
|
||||
if ((2 == adapter->registrypriv.fw_iol) && (IS_FULL_SPEED_USB(adapter)))
|
||||
return _TRUE;
|
||||
#endif
|
||||
|
||||
return _FALSE;
|
||||
if ((2 == adapter->registrypriv.fw_iol) && (!adapter_to_dvobj(adapter)->ishighspeed))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
int rtw_IOL_exec_cmds_sync(ADAPTER *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms, u32 bndy_cnt)
|
||||
int rtw_IOL_exec_cmds_sync(struct adapter *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms, u32 bndy_cnt)
|
||||
{
|
||||
return rtw_hal_iol_cmd(adapter, xmit_frame, max_wating_ms, bndy_cnt);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_IOL_NEW_GENERATION
|
||||
int rtw_IOL_append_LLT_cmd(struct xmit_frame *xmit_frame, u8 page_boundary)
|
||||
{
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, u8 mask)
|
||||
{
|
||||
struct ioreg_cfg cmd = {8, IOREG_CMD_WB_REG, 0x0, 0x0, 0x0};
|
||||
|
||||
/* RTW_PUT_LE16((u8*)&cmd.address, addr); */
|
||||
/* RTW_PUT_LE32((u8*)&cmd.value, (u32)value); */
|
||||
cmd.address = cpu_to_le16(addr);
|
||||
cmd.data = cpu_to_le32(value);
|
||||
|
||||
if (mask != 0xFF) {
|
||||
cmd.length = 12;
|
||||
/* RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); */
|
||||
cmd.mask = cpu_to_le32(mask);
|
||||
}
|
||||
|
||||
/* RTW_INFO("%s addr:0x%04x,value:0x%08x,mask:0x%08x\n", __FUNCTION__, addr,value,mask); */
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, cmd.length);
|
||||
|
||||
}
|
||||
|
||||
int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, u16 mask)
|
||||
{
|
||||
struct ioreg_cfg cmd = {8, IOREG_CMD_WW_REG, 0x0, 0x0, 0x0};
|
||||
|
||||
/* RTW_PUT_LE16((u8*)&cmd.address, addr); */
|
||||
/* RTW_PUT_LE32((u8*)&cmd.value, (u32)value); */
|
||||
cmd.address = cpu_to_le16(addr);
|
||||
cmd.data = cpu_to_le32(value);
|
||||
|
||||
if (mask != 0xFFFF) {
|
||||
cmd.length = 12;
|
||||
/* RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); */
|
||||
cmd.mask = cpu_to_le32(mask);
|
||||
}
|
||||
|
||||
/* RTW_INFO("%s addr:0x%04x,value:0x%08x,mask:0x%08x\n", __FUNCTION__, addr,value,mask); */
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, cmd.length);
|
||||
|
||||
}
|
||||
|
||||
int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, u32 mask)
|
||||
{
|
||||
struct ioreg_cfg cmd = {8, IOREG_CMD_WD_REG, 0x0, 0x0, 0x0};
|
||||
|
||||
/* RTW_PUT_LE16((u8*)&cmd.address, addr); */
|
||||
/* RTW_PUT_LE32((u8*)&cmd.value, (u32)value); */
|
||||
cmd.address = cpu_to_le16(addr);
|
||||
cmd.data = cpu_to_le32(value);
|
||||
|
||||
if (mask != 0xFFFFFFFF) {
|
||||
cmd.length = 12;
|
||||
/* RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); */
|
||||
cmd.mask = cpu_to_le32(mask);
|
||||
}
|
||||
|
||||
/* RTW_INFO("%s addr:0x%04x,value:0x%08x,mask:0x%08x\n", __FU2NCTION__, addr,value,mask); */
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, cmd.length);
|
||||
|
||||
}
|
||||
|
||||
int _rtw_IOL_append_WRF_cmd(struct xmit_frame *xmit_frame, u8 rf_path, u16 addr, u32 value, u32 mask)
|
||||
{
|
||||
struct ioreg_cfg cmd = {8, IOREG_CMD_W_RF, 0x0, 0x0, 0x0};
|
||||
|
||||
/* RTW_PUT_LE16((u8*)&cmd.address, addr); */
|
||||
/* RTW_PUT_LE32((u8*)&cmd.value, (u32)value); */
|
||||
cmd.address = (rf_path << 8) | ((addr) & 0xFF);
|
||||
cmd.address = cpu_to_le16((rf_path<<8) | ((addr) & 0xFF));
|
||||
cmd.data = cpu_to_le32(value);
|
||||
|
||||
if (mask != 0x000FFFFF) {
|
||||
cmd.length = 12;
|
||||
/* RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); */
|
||||
cmd.mask = cpu_to_le32(mask);
|
||||
}
|
||||
|
||||
/* RTW_INFO("%s rf_path:0x%02x addr:0x%04x,value:0x%08x,mask:0x%08x\n", __FU2NCTION__,rf_path, addr,value,mask); */
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, cmd.length);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int rtw_IOL_append_DELAY_US_cmd(struct xmit_frame *xmit_frame, u16 us)
|
||||
{
|
||||
struct ioreg_cfg cmd = {4, IOREG_CMD_DELAY_US, 0x0, 0x0, 0x0};
|
||||
/* RTW_PUT_LE16((u8*)&cmd.address, us); */
|
||||
cmd.address = cpu_to_le16(us);
|
||||
|
||||
/* RTW_INFO("%s %u\n", __FUNCTION__, us); */
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 4);
|
||||
}
|
||||
|
||||
@@ -212,177 +167,43 @@ int rtw_IOL_append_DELAY_MS_cmd(struct xmit_frame *xmit_frame, u16 ms)
|
||||
{
|
||||
struct ioreg_cfg cmd = {4, IOREG_CMD_DELAY_US, 0x0, 0x0, 0x0};
|
||||
|
||||
/* RTW_PUT_LE16((u8*)&cmd.address, ms); */
|
||||
cmd.address = cpu_to_le16(ms);
|
||||
|
||||
/* RTW_INFO("%s %u\n", __FUNCTION__, ms); */
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 4);
|
||||
}
|
||||
|
||||
int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame)
|
||||
{
|
||||
struct ioreg_cfg cmd = {4, IOREG_CMD_END, 0xFFFF, 0xFF, 0x0};
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 4);
|
||||
struct ioreg_cfg cmd = {4, IOREG_CMD_END, cpu_to_le16(0xFFFF), cpu_to_le32(0xFF), 0x0};
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 4);
|
||||
}
|
||||
|
||||
u8 rtw_IOL_cmd_boundary_handle(struct xmit_frame *pxmit_frame)
|
||||
{
|
||||
u8 is_cmd_bndy = _FALSE;
|
||||
if (((pxmit_frame->attrib.pktlen + 32) % 256) + 8 >= 256) {
|
||||
u8 is_cmd_bndy = false;
|
||||
if (((pxmit_frame->attrib.pktlen+32)%256) + 8 >= 256) {
|
||||
rtw_IOL_append_END_cmd(pxmit_frame);
|
||||
pxmit_frame->attrib.pktlen = ((((pxmit_frame->attrib.pktlen + 32) / 256) + 1) * 256);
|
||||
pxmit_frame->attrib.pktlen = ((((pxmit_frame->attrib.pktlen+32)/256)+1)*256);
|
||||
|
||||
/* printk("==> %s, pktlen(%d)\n",__FUNCTION__,pxmit_frame->attrib.pktlen); */
|
||||
pxmit_frame->attrib.last_txcmdsz = pxmit_frame->attrib.pktlen;
|
||||
is_cmd_bndy = _TRUE;
|
||||
is_cmd_bndy = true;
|
||||
}
|
||||
return is_cmd_bndy;
|
||||
}
|
||||
|
||||
void rtw_IOL_cmd_buf_dump(ADAPTER *Adapter, int buf_len, u8 *pbuf)
|
||||
void rtw_IOL_cmd_buf_dump(struct adapter *Adapter, int buf_len, u8 *pbuf)
|
||||
{
|
||||
int i;
|
||||
int j = 1;
|
||||
|
||||
printk("###### %s ######\n", __FUNCTION__);
|
||||
pr_info("###### %s ######\n", __func__);
|
||||
for (i = 0; i < buf_len; i++) {
|
||||
printk("%02x-", *(pbuf + i));
|
||||
printk("%02x-", *(pbuf+i));
|
||||
|
||||
if (j % 32 == 0)
|
||||
if (j%32 == 0)
|
||||
printk("\n");
|
||||
j++;
|
||||
}
|
||||
printk("\n");
|
||||
printk("============= ioreg_cmd len = %d ===============\n", buf_len);
|
||||
pr_info("=============ioreg_cmd len=%d===============\n", buf_len);
|
||||
}
|
||||
|
||||
|
||||
#else /* CONFIG_IOL_NEW_GENERATION */
|
||||
int rtw_IOL_append_LLT_cmd(struct xmit_frame *xmit_frame, u8 page_boundary)
|
||||
{
|
||||
IOL_CMD cmd = {0x0, IOL_CMD_LLT, 0x0, 0x0};
|
||||
|
||||
RTW_PUT_BE32((u8 *)&cmd.value, (u32)page_boundary);
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 8);
|
||||
}
|
||||
|
||||
int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value)
|
||||
{
|
||||
IOL_CMD cmd = {0x0, IOL_CMD_WB_REG, 0x0, 0x0};
|
||||
|
||||
RTW_PUT_BE16((u8 *)&cmd.address, (u16)addr);
|
||||
RTW_PUT_BE32((u8 *)&cmd.value, (u32)value);
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 8);
|
||||
}
|
||||
|
||||
int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value)
|
||||
{
|
||||
IOL_CMD cmd = {0x0, IOL_CMD_WW_REG, 0x0, 0x0};
|
||||
|
||||
RTW_PUT_BE16((u8 *)&cmd.address, (u16)addr);
|
||||
RTW_PUT_BE32((u8 *)&cmd.value, (u32)value);
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 8);
|
||||
}
|
||||
|
||||
int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value)
|
||||
{
|
||||
IOL_CMD cmd = {0x0, IOL_CMD_WD_REG, 0x0, 0x0};
|
||||
u8 *pos = (u8 *)&cmd;
|
||||
|
||||
RTW_PUT_BE16((u8 *)&cmd.address, (u16)addr);
|
||||
RTW_PUT_BE32((u8 *)&cmd.value, (u32)value);
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 8);
|
||||
}
|
||||
|
||||
#ifdef DBG_IO
|
||||
int dbg_rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, const char *caller, const int line)
|
||||
{
|
||||
if (match_write_sniff(xmit_frame->padapter, addr, 1, value)) {
|
||||
RTW_INFO("DBG_IO %s:%d IOL_WB(0x%04x, 0x%02x)\n"
|
||||
, caller, line, addr, value);
|
||||
}
|
||||
|
||||
return _rtw_IOL_append_WB_cmd(xmit_frame, addr, value);
|
||||
}
|
||||
|
||||
int dbg_rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, const char *caller, const int line)
|
||||
{
|
||||
if (match_write_sniff(xmit_frame->padapter, addr, 2, value)) {
|
||||
RTW_INFO("DBG_IO %s:%d IOL_WW(0x%04x, 0x%04x)\n"
|
||||
, caller, line, addr, value);
|
||||
}
|
||||
|
||||
return _rtw_IOL_append_WW_cmd(xmit_frame, addr, value);
|
||||
}
|
||||
|
||||
int dbg_rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, const char *caller, const int line)
|
||||
{
|
||||
if (match_write_sniff(xmit_frame->padapter, addr, 4, value)) {
|
||||
RTW_INFO("DBG_IO %s:%d IOL_WD(0x%04x, 0x%08x)\n"
|
||||
, caller, line, addr, value);
|
||||
}
|
||||
|
||||
return _rtw_IOL_append_WD_cmd(xmit_frame, addr, value);
|
||||
}
|
||||
#endif
|
||||
|
||||
int rtw_IOL_append_DELAY_US_cmd(struct xmit_frame *xmit_frame, u16 us)
|
||||
{
|
||||
IOL_CMD cmd = {0x0, IOL_CMD_DELAY_US, 0x0, 0x0};
|
||||
|
||||
RTW_PUT_BE32((u8 *)&cmd.value, (u32)us);
|
||||
|
||||
/* RTW_INFO("%s %u\n", __FUNCTION__, us); */
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 8);
|
||||
}
|
||||
|
||||
int rtw_IOL_append_DELAY_MS_cmd(struct xmit_frame *xmit_frame, u16 ms)
|
||||
{
|
||||
IOL_CMD cmd = {0x0, IOL_CMD_DELAY_MS, 0x0, 0x0};
|
||||
|
||||
RTW_PUT_BE32((u8 *)&cmd.value, (u32)ms);
|
||||
|
||||
/* RTW_INFO("%s %u\n", __FUNCTION__, ms); */
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 8);
|
||||
}
|
||||
|
||||
int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame)
|
||||
{
|
||||
IOL_CMD end_cmd = {0x0, IOL_CMD_END, 0x0, 0x0};
|
||||
|
||||
|
||||
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&end_cmd, 8);
|
||||
|
||||
}
|
||||
|
||||
int rtw_IOL_exec_cmd_array_sync(PADAPTER adapter, u8 *IOL_cmds, u32 cmd_num, u32 max_wating_ms)
|
||||
{
|
||||
struct xmit_frame *xmit_frame;
|
||||
|
||||
xmit_frame = rtw_IOL_accquire_xmit_frame(adapter);
|
||||
if (xmit_frame == NULL)
|
||||
return _FAIL;
|
||||
|
||||
if (rtw_IOL_append_cmds(xmit_frame, IOL_cmds, cmd_num << 3) == _FAIL)
|
||||
return _FAIL;
|
||||
|
||||
return rtw_IOL_exec_cmds_sync(adapter, xmit_frame, max_wating_ms, 0);
|
||||
}
|
||||
|
||||
int rtw_IOL_exec_empty_cmds_sync(ADAPTER *adapter, u32 max_wating_ms)
|
||||
{
|
||||
IOL_CMD end_cmd = {0x0, IOL_CMD_END, 0x0, 0x0};
|
||||
return rtw_IOL_exec_cmd_array_sync(adapter, (u8 *)&end_cmd, 1, max_wating_ms);
|
||||
}
|
||||
#endif /* CONFIG_IOL_NEW_GENERATION */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* CONFIG_IOL */
|
||||
|
||||
1705
drivers/net/wireless/realtek/rtl8188eu/core/rtw_led.c
Normal file
1705
drivers/net/wireless/realtek/rtl8188eu/core/rtw_led.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,128 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2016 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include <drv_types.h>
|
||||
#include <rtw_mem.h>
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_DESCRIPTION("Realtek Wireless Lan Driver");
|
||||
MODULE_AUTHOR("Realtek Semiconductor Corp.");
|
||||
MODULE_VERSION("DRIVERVERSION");
|
||||
|
||||
struct sk_buff_head rtk_skb_mem_q;
|
||||
struct u8 *rtk_buf_mem[NR_RECVBUFF];
|
||||
|
||||
struct u8 *rtw_get_buf_premem(int index)
|
||||
{
|
||||
printk("%s, rtk_buf_mem index : %d\n", __func__, index);
|
||||
return rtk_buf_mem[index];
|
||||
}
|
||||
|
||||
u16 rtw_rtkm_get_buff_size(void)
|
||||
{
|
||||
return MAX_RTKM_RECVBUF_SZ;
|
||||
}
|
||||
EXPORT_SYMBOL(rtw_rtkm_get_buff_size);
|
||||
|
||||
u8 rtw_rtkm_get_nr_recv_skb(void)
|
||||
{
|
||||
return MAX_RTKM_NR_PREALLOC_RECV_SKB;
|
||||
}
|
||||
EXPORT_SYMBOL(rtw_rtkm_get_nr_recv_skb);
|
||||
|
||||
struct sk_buff *rtw_alloc_skb_premem(u16 in_size)
|
||||
{
|
||||
struct sk_buff *skb = NULL;
|
||||
|
||||
if (in_size > MAX_RTKM_RECVBUF_SZ) {
|
||||
pr_info("warning %s: driver buffer size(%d) > rtkm buffer size(%d)\n", __func__, in_size, MAX_RTKM_RECVBUF_SZ);
|
||||
WARN_ON(1);
|
||||
return skb;
|
||||
}
|
||||
|
||||
skb = skb_dequeue(&rtk_skb_mem_q);
|
||||
|
||||
printk("%s, rtk_skb_mem_q len : %d\n", __func__, skb_queue_len(&rtk_skb_mem_q));
|
||||
|
||||
return skb;
|
||||
}
|
||||
EXPORT_SYMBOL(rtw_alloc_skb_premem);
|
||||
|
||||
int rtw_free_skb_premem(struct sk_buff *pskb)
|
||||
{
|
||||
if (!pskb)
|
||||
return -1;
|
||||
|
||||
if (skb_queue_len(&rtk_skb_mem_q) >= MAX_RTKM_NR_PREALLOC_RECV_SKB)
|
||||
return -1;
|
||||
|
||||
skb_queue_tail(&rtk_skb_mem_q, pskb);
|
||||
|
||||
printk("%s, rtk_skb_mem_q len : %d\n", __func__, skb_queue_len(&rtk_skb_mem_q));
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(rtw_free_skb_premem);
|
||||
|
||||
static int __init rtw_mem_init(void)
|
||||
{
|
||||
int i;
|
||||
SIZE_PTR tmpaddr = 0;
|
||||
SIZE_PTR alignment = 0;
|
||||
struct sk_buff *pskb = NULL;
|
||||
|
||||
printk("%s\n", __func__);
|
||||
pr_info("MAX_RTKM_NR_PREALLOC_RECV_SKB: %d\n", MAX_RTKM_NR_PREALLOC_RECV_SKB);
|
||||
pr_info("MAX_RTKM_RECVBUF_SZ: %d\n", MAX_RTKM_RECVBUF_SZ);
|
||||
|
||||
#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX
|
||||
for (i = 0; i < NR_RECVBUFF; i++)
|
||||
rtk_buf_mem[i] = usb_buffer_alloc(dev, size, (in_interrupt() ? GFP_ATOMIC : GFP_KERNEL), dma);
|
||||
#endif /* CONFIG_USE_USB_BUFFER_ALLOC_RX */
|
||||
|
||||
skb_queue_head_init(&rtk_skb_mem_q);
|
||||
|
||||
for (i = 0; i < MAX_RTKM_NR_PREALLOC_RECV_SKB; i++) {
|
||||
pskb = __dev_alloc_skb(MAX_RTKM_RECVBUF_SZ + RECVBUFF_ALIGN_SZ, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
|
||||
if (pskb) {
|
||||
tmpaddr = (SIZE_PTR)pskb->data;
|
||||
alignment = tmpaddr & (RECVBUFF_ALIGN_SZ - 1);
|
||||
skb_reserve(pskb, (RECVBUFF_ALIGN_SZ - alignment));
|
||||
|
||||
skb_queue_tail(&rtk_skb_mem_q, pskb);
|
||||
} else
|
||||
printk("%s, alloc skb memory fail!\n", __func__);
|
||||
|
||||
pskb = NULL;
|
||||
}
|
||||
|
||||
printk("%s, rtk_skb_mem_q len : %d\n", __func__, skb_queue_len(&rtk_skb_mem_q));
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
static void __exit rtw_mem_exit(void)
|
||||
{
|
||||
if (skb_queue_len(&rtk_skb_mem_q))
|
||||
printk("%s, rtk_skb_mem_q len : %d\n", __func__, skb_queue_len(&rtk_skb_mem_q));
|
||||
|
||||
skb_queue_purge(&rtk_skb_mem_q);
|
||||
|
||||
printk("%s\n", __func__);
|
||||
}
|
||||
|
||||
module_init(rtw_mem_init);
|
||||
module_exit(rtw_mem_exit);
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,647 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2013 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include <rtw_odm.h>
|
||||
#include <hal_data.h>
|
||||
|
||||
u32 rtw_phydm_ability_ops(_adapter *adapter, HAL_PHYDM_OPS ops, u32 ability)
|
||||
{
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(adapter);
|
||||
struct dm_struct *podmpriv = &pHalData->odmpriv;
|
||||
u32 result = 0;
|
||||
|
||||
switch (ops) {
|
||||
case HAL_PHYDM_DIS_ALL_FUNC:
|
||||
podmpriv->support_ability = DYNAMIC_FUNC_DISABLE;
|
||||
halrf_cmn_info_set(podmpriv, HALRF_CMNINFO_ABILITY, DYNAMIC_FUNC_DISABLE);
|
||||
break;
|
||||
case HAL_PHYDM_FUNC_SET:
|
||||
podmpriv->support_ability |= ability;
|
||||
break;
|
||||
case HAL_PHYDM_FUNC_CLR:
|
||||
podmpriv->support_ability &= ~(ability);
|
||||
break;
|
||||
case HAL_PHYDM_ABILITY_BK:
|
||||
/* dm flag backup*/
|
||||
podmpriv->bk_support_ability = podmpriv->support_ability;
|
||||
pHalData->bk_rf_ability = halrf_cmn_info_get(podmpriv, HALRF_CMNINFO_ABILITY);
|
||||
break;
|
||||
case HAL_PHYDM_ABILITY_RESTORE:
|
||||
/* restore dm flag */
|
||||
podmpriv->support_ability = podmpriv->bk_support_ability;
|
||||
halrf_cmn_info_set(podmpriv, HALRF_CMNINFO_ABILITY, pHalData->bk_rf_ability);
|
||||
break;
|
||||
case HAL_PHYDM_ABILITY_SET:
|
||||
podmpriv->support_ability = ability;
|
||||
break;
|
||||
case HAL_PHYDM_ABILITY_GET:
|
||||
result = podmpriv->support_ability;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* set ODM_CMNINFO_IC_TYPE based on chip_type */
|
||||
void rtw_odm_init_ic_type(_adapter *adapter)
|
||||
{
|
||||
struct dm_struct *odm = adapter_to_phydm(adapter);
|
||||
u32 ic_type = chip_type_to_odm_ic_type(rtw_get_chip_type(adapter));
|
||||
|
||||
rtw_warn_on(!ic_type);
|
||||
|
||||
odm_cmn_info_init(odm, ODM_CMNINFO_IC_TYPE, ic_type);
|
||||
}
|
||||
|
||||
void rtw_odm_adaptivity_ver_msg(void *sel, _adapter *adapter)
|
||||
{
|
||||
RTW_PRINT_SEL(sel, "ADAPTIVITY_VERSION "ADAPTIVITY_VERSION"\n");
|
||||
}
|
||||
|
||||
#define RTW_ADAPTIVITY_EN_DISABLE 0
|
||||
#define RTW_ADAPTIVITY_EN_ENABLE 1
|
||||
|
||||
void rtw_odm_adaptivity_en_msg(void *sel, _adapter *adapter)
|
||||
{
|
||||
struct registry_priv *regsty = &adapter->registrypriv;
|
||||
|
||||
RTW_PRINT_SEL(sel, "RTW_ADAPTIVITY_EN_");
|
||||
|
||||
if (regsty->adaptivity_en == RTW_ADAPTIVITY_EN_DISABLE)
|
||||
_RTW_PRINT_SEL(sel, "DISABLE\n");
|
||||
else if (regsty->adaptivity_en == RTW_ADAPTIVITY_EN_ENABLE)
|
||||
_RTW_PRINT_SEL(sel, "ENABLE\n");
|
||||
else
|
||||
_RTW_PRINT_SEL(sel, "INVALID\n");
|
||||
}
|
||||
|
||||
#define RTW_ADAPTIVITY_MODE_NORMAL 0
|
||||
#define RTW_ADAPTIVITY_MODE_CARRIER_SENSE 1
|
||||
|
||||
void rtw_odm_adaptivity_mode_msg(void *sel, _adapter *adapter)
|
||||
{
|
||||
struct registry_priv *regsty = &adapter->registrypriv;
|
||||
|
||||
RTW_PRINT_SEL(sel, "RTW_ADAPTIVITY_MODE_");
|
||||
|
||||
if (regsty->adaptivity_mode == RTW_ADAPTIVITY_MODE_NORMAL)
|
||||
_RTW_PRINT_SEL(sel, "NORMAL\n");
|
||||
else if (regsty->adaptivity_mode == RTW_ADAPTIVITY_MODE_CARRIER_SENSE)
|
||||
_RTW_PRINT_SEL(sel, "CARRIER_SENSE\n");
|
||||
else
|
||||
_RTW_PRINT_SEL(sel, "INVALID\n");
|
||||
}
|
||||
|
||||
void rtw_odm_adaptivity_config_msg(void *sel, _adapter *adapter)
|
||||
{
|
||||
rtw_odm_adaptivity_ver_msg(sel, adapter);
|
||||
rtw_odm_adaptivity_en_msg(sel, adapter);
|
||||
rtw_odm_adaptivity_mode_msg(sel, adapter);
|
||||
}
|
||||
|
||||
bool rtw_odm_adaptivity_needed(_adapter *adapter)
|
||||
{
|
||||
struct registry_priv *regsty = &adapter->registrypriv;
|
||||
bool ret = _FALSE;
|
||||
|
||||
if (regsty->adaptivity_en == RTW_ADAPTIVITY_EN_ENABLE)
|
||||
ret = _TRUE;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void rtw_odm_adaptivity_parm_msg(void *sel, _adapter *adapter)
|
||||
{
|
||||
struct dm_struct *odm = adapter_to_phydm(adapter);
|
||||
|
||||
rtw_odm_adaptivity_config_msg(sel, adapter);
|
||||
|
||||
RTW_PRINT_SEL(sel, "%10s %16s\n"
|
||||
, "th_l2h_ini", "th_edcca_hl_diff");
|
||||
RTW_PRINT_SEL(sel, "0x%-8x %-16d\n"
|
||||
, (u8)odm->th_l2h_ini
|
||||
, odm->th_edcca_hl_diff
|
||||
);
|
||||
}
|
||||
|
||||
void rtw_odm_adaptivity_parm_set(_adapter *adapter, s8 th_l2h_ini, s8 th_edcca_hl_diff)
|
||||
{
|
||||
struct dm_struct *odm = adapter_to_phydm(adapter);
|
||||
|
||||
odm->th_l2h_ini = th_l2h_ini;
|
||||
odm->th_edcca_hl_diff = th_edcca_hl_diff;
|
||||
}
|
||||
|
||||
void rtw_odm_get_perpkt_rssi(void *sel, _adapter *adapter)
|
||||
{
|
||||
struct dm_struct *odm = adapter_to_phydm(adapter);
|
||||
|
||||
RTW_PRINT_SEL(sel, "rx_rate = %s, rssi_a = %d(%%), rssi_b = %d(%%)\n",
|
||||
HDATA_RATE(odm->rx_rate), odm->rssi_a, odm->rssi_b);
|
||||
}
|
||||
|
||||
|
||||
void rtw_odm_acquirespinlock(_adapter *adapter, enum rt_spinlock_type type)
|
||||
{
|
||||
PHAL_DATA_TYPE pHalData = GET_HAL_DATA(adapter);
|
||||
_irqL irqL;
|
||||
|
||||
switch (type) {
|
||||
case RT_IQK_SPINLOCK:
|
||||
_enter_critical_bh(&pHalData->IQKSpinLock, &irqL);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void rtw_odm_releasespinlock(_adapter *adapter, enum rt_spinlock_type type)
|
||||
{
|
||||
PHAL_DATA_TYPE pHalData = GET_HAL_DATA(adapter);
|
||||
_irqL irqL;
|
||||
|
||||
switch (type) {
|
||||
case RT_IQK_SPINLOCK:
|
||||
_exit_critical_bh(&pHalData->IQKSpinLock, &irqL);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
inline u8 rtw_odm_get_dfs_domain(struct dvobj_priv *dvobj)
|
||||
{
|
||||
#ifdef CONFIG_DFS_MASTER
|
||||
struct dm_struct *pDM_Odm = dvobj_to_phydm(dvobj);
|
||||
|
||||
return pDM_Odm->dfs_region_domain;
|
||||
#else
|
||||
return PHYDM_DFS_DOMAIN_UNKNOWN;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline u8 rtw_odm_dfs_domain_unknown(struct dvobj_priv *dvobj)
|
||||
{
|
||||
#ifdef CONFIG_DFS_MASTER
|
||||
return rtw_odm_get_dfs_domain(dvobj) == PHYDM_DFS_DOMAIN_UNKNOWN;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DFS_MASTER
|
||||
inline void rtw_odm_radar_detect_reset(_adapter *adapter)
|
||||
{
|
||||
phydm_radar_detect_reset(adapter_to_phydm(adapter));
|
||||
}
|
||||
|
||||
inline void rtw_odm_radar_detect_disable(_adapter *adapter)
|
||||
{
|
||||
phydm_radar_detect_disable(adapter_to_phydm(adapter));
|
||||
}
|
||||
|
||||
/* called after ch, bw is set */
|
||||
inline void rtw_odm_radar_detect_enable(_adapter *adapter)
|
||||
{
|
||||
phydm_radar_detect_enable(adapter_to_phydm(adapter));
|
||||
}
|
||||
|
||||
inline BOOLEAN rtw_odm_radar_detect(_adapter *adapter)
|
||||
{
|
||||
return phydm_radar_detect(adapter_to_phydm(adapter));
|
||||
}
|
||||
|
||||
inline u8 rtw_odm_radar_detect_polling_int_ms(struct dvobj_priv *dvobj)
|
||||
{
|
||||
return phydm_dfs_polling_time(dvobj_to_phydm(dvobj));
|
||||
}
|
||||
#endif /* CONFIG_DFS_MASTER */
|
||||
|
||||
void rtw_odm_parse_rx_phy_status_chinfo(union recv_frame *rframe, u8 *phys)
|
||||
{
|
||||
#ifndef DBG_RX_PHYSTATUS_CHINFO
|
||||
#define DBG_RX_PHYSTATUS_CHINFO 0
|
||||
#endif
|
||||
|
||||
#if (ODM_PHY_STATUS_NEW_TYPE_SUPPORT == 1)
|
||||
_adapter *adapter = rframe->u.hdr.adapter;
|
||||
struct dm_struct *phydm = adapter_to_phydm(adapter);
|
||||
struct rx_pkt_attrib *attrib = &rframe->u.hdr.attrib;
|
||||
u8 *wlanhdr = get_recvframe_data(rframe);
|
||||
|
||||
if (phydm->support_ic_type & PHYSTS_2ND_TYPE_IC) {
|
||||
/*
|
||||
* 8723D:
|
||||
* type_0(CCK)
|
||||
* l_rxsc
|
||||
* is filled with primary channel SC, not real rxsc.
|
||||
* 0:LSC, 1:USC
|
||||
* type_1(OFDM)
|
||||
* rf_mode
|
||||
* RF bandwidth when RX
|
||||
* l_rxsc(legacy), ht_rxsc
|
||||
* see below RXSC N-series
|
||||
* type_2(Not used)
|
||||
*/
|
||||
/*
|
||||
* 8821C, 8822B:
|
||||
* type_0(CCK)
|
||||
* l_rxsc
|
||||
* is filled with primary channel SC, not real rxsc.
|
||||
* 0:LSC, 1:USC
|
||||
* type_1(OFDM)
|
||||
* rf_mode
|
||||
* RF bandwidth when RX
|
||||
* l_rxsc(legacy), ht_rxsc
|
||||
* see below RXSC AC-series
|
||||
* type_2(Not used)
|
||||
*/
|
||||
|
||||
if ((*phys & 0xf) == 0) {
|
||||
struct phy_sts_rpt_jgr2_type0 *phys_t0 = (struct phy_sts_rpt_jgr2_type0 *)phys;
|
||||
|
||||
if (DBG_RX_PHYSTATUS_CHINFO) {
|
||||
RTW_PRINT("phys_t%u ta="MAC_FMT" %s, %s(band:%u, ch:%u, l_rxsc:%u)\n"
|
||||
, *phys & 0xf
|
||||
, MAC_ARG(get_ta(wlanhdr))
|
||||
, is_broadcast_mac_addr(get_ra(wlanhdr)) ? "BC" : is_multicast_mac_addr(get_ra(wlanhdr)) ? "MC" : "UC"
|
||||
, HDATA_RATE(attrib->data_rate)
|
||||
, phys_t0->band, phys_t0->channel, phys_t0->rxsc
|
||||
);
|
||||
}
|
||||
|
||||
} else if ((*phys & 0xf) == 1) {
|
||||
struct phy_sts_rpt_jgr2_type1 *phys_t1 = (struct phy_sts_rpt_jgr2_type1 *)phys;
|
||||
u8 rxsc = (attrib->data_rate > DESC_RATE11M && attrib->data_rate < DESC_RATEMCS0) ? phys_t1->l_rxsc : phys_t1->ht_rxsc;
|
||||
u8 pkt_cch = 0;
|
||||
u8 pkt_bw = CHANNEL_WIDTH_20;
|
||||
|
||||
#if ODM_IC_11N_SERIES_SUPPORT
|
||||
if (phydm->support_ic_type & ODM_IC_11N_SERIES) {
|
||||
/* RXSC N-series */
|
||||
#define RXSC_DUP 0
|
||||
#define RXSC_LSC 1
|
||||
#define RXSC_USC 2
|
||||
#define RXSC_40M 3
|
||||
|
||||
static const s8 cch_offset_by_rxsc[4] = {0, -2, 2, 0};
|
||||
|
||||
if (phys_t1->rf_mode == 0) {
|
||||
pkt_cch = phys_t1->channel;
|
||||
pkt_bw = CHANNEL_WIDTH_20;
|
||||
} else if (phys_t1->rf_mode == 1) {
|
||||
if (rxsc == RXSC_LSC || rxsc == RXSC_USC) {
|
||||
pkt_cch = phys_t1->channel + cch_offset_by_rxsc[rxsc];
|
||||
pkt_bw = CHANNEL_WIDTH_20;
|
||||
} else if (rxsc == RXSC_40M) {
|
||||
pkt_cch = phys_t1->channel;
|
||||
pkt_bw = CHANNEL_WIDTH_40;
|
||||
}
|
||||
} else
|
||||
rtw_warn_on(1);
|
||||
|
||||
goto type1_end;
|
||||
}
|
||||
#endif /* ODM_IC_11N_SERIES_SUPPORT */
|
||||
|
||||
#if ODM_IC_11AC_SERIES_SUPPORT
|
||||
if (phydm->support_ic_type & ODM_IC_11AC_SERIES) {
|
||||
/* RXSC AC-series */
|
||||
#define RXSC_DUP 0 /* 0: RX from all SC of current rf_mode */
|
||||
|
||||
#define RXSC_LL20M_OF_160M 8 /* 1~8: RX from 20MHz SC */
|
||||
#define RXSC_L20M_OF_160M 6
|
||||
#define RXSC_L20M_OF_80M 4
|
||||
#define RXSC_L20M_OF_40M 2
|
||||
#define RXSC_U20M_OF_40M 1
|
||||
#define RXSC_U20M_OF_80M 3
|
||||
#define RXSC_U20M_OF_160M 5
|
||||
#define RXSC_UU20M_OF_160M 7
|
||||
|
||||
#define RXSC_L40M_OF_160M 12 /* 9~12: RX from 40MHz SC */
|
||||
#define RXSC_L40M_OF_80M 10
|
||||
#define RXSC_U40M_OF_80M 9
|
||||
#define RXSC_U40M_OF_160M 11
|
||||
|
||||
#define RXSC_L80M_OF_160M 14 /* 13~14: RX from 80MHz SC */
|
||||
#define RXSC_U80M_OF_160M 13
|
||||
|
||||
static const s8 cch_offset_by_rxsc[15] = {0, 2, -2, 6, -6, 10, -10, 14, -14, 4, -4, 12, -12, 8, -8};
|
||||
|
||||
if (phys_t1->rf_mode > 3) {
|
||||
/* invalid rf_mode */
|
||||
rtw_warn_on(1);
|
||||
goto type1_end;
|
||||
}
|
||||
|
||||
if (phys_t1->rf_mode == 0) {
|
||||
/* RF 20MHz */
|
||||
pkt_cch = phys_t1->channel;
|
||||
pkt_bw = CHANNEL_WIDTH_20;
|
||||
goto type1_end;
|
||||
}
|
||||
|
||||
if (rxsc == 0) {
|
||||
/* RF and RX with same BW */
|
||||
if (attrib->data_rate >= DESC_RATEMCS0) {
|
||||
pkt_cch = phys_t1->channel;
|
||||
pkt_bw = phys_t1->rf_mode;
|
||||
}
|
||||
goto type1_end;
|
||||
}
|
||||
|
||||
if ((phys_t1->rf_mode == 1 && rxsc >= 1 && rxsc <= 2) /* RF 40MHz, RX 20MHz */
|
||||
|| (phys_t1->rf_mode == 2 && rxsc >= 1 && rxsc <= 4) /* RF 80MHz, RX 20MHz */
|
||||
|| (phys_t1->rf_mode == 3 && rxsc >= 1 && rxsc <= 8) /* RF 160MHz, RX 20MHz */
|
||||
) {
|
||||
pkt_cch = phys_t1->channel + cch_offset_by_rxsc[rxsc];
|
||||
pkt_bw = CHANNEL_WIDTH_20;
|
||||
} else if ((phys_t1->rf_mode == 2 && rxsc >= 9 && rxsc <= 10) /* RF 80MHz, RX 40MHz */
|
||||
|| (phys_t1->rf_mode == 3 && rxsc >= 9 && rxsc <= 12) /* RF 160MHz, RX 40MHz */
|
||||
) {
|
||||
if (attrib->data_rate >= DESC_RATEMCS0) {
|
||||
pkt_cch = phys_t1->channel + cch_offset_by_rxsc[rxsc];
|
||||
pkt_bw = CHANNEL_WIDTH_40;
|
||||
}
|
||||
} else if ((phys_t1->rf_mode == 3 && rxsc >= 13 && rxsc <= 14) /* RF 160MHz, RX 80MHz */
|
||||
) {
|
||||
if (attrib->data_rate >= DESC_RATEMCS0) {
|
||||
pkt_cch = phys_t1->channel + cch_offset_by_rxsc[rxsc];
|
||||
pkt_bw = CHANNEL_WIDTH_80;
|
||||
}
|
||||
} else
|
||||
rtw_warn_on(1);
|
||||
|
||||
}
|
||||
#endif /* ODM_IC_11AC_SERIES_SUPPORT */
|
||||
|
||||
type1_end:
|
||||
if (DBG_RX_PHYSTATUS_CHINFO) {
|
||||
RTW_PRINT("phys_t%u ta="MAC_FMT" %s, %s(band:%u, ch:%u, rf_mode:%u, l_rxsc:%u, ht_rxsc:%u) => %u,%u\n"
|
||||
, *phys & 0xf
|
||||
, MAC_ARG(get_ta(wlanhdr))
|
||||
, is_broadcast_mac_addr(get_ra(wlanhdr)) ? "BC" : is_multicast_mac_addr(get_ra(wlanhdr)) ? "MC" : "UC"
|
||||
, HDATA_RATE(attrib->data_rate)
|
||||
, phys_t1->band, phys_t1->channel, phys_t1->rf_mode, phys_t1->l_rxsc, phys_t1->ht_rxsc
|
||||
, pkt_cch, pkt_bw
|
||||
);
|
||||
}
|
||||
|
||||
/* for now, only return cneter channel of 20MHz packet */
|
||||
if (pkt_cch && pkt_bw == CHANNEL_WIDTH_20)
|
||||
attrib->ch = pkt_cch;
|
||||
|
||||
} else {
|
||||
struct phy_sts_rpt_jgr2_type2 *phys_t2 = (struct phy_sts_rpt_jgr2_type2 *)phys;
|
||||
|
||||
if (DBG_RX_PHYSTATUS_CHINFO) {
|
||||
RTW_PRINT("phys_t%u ta="MAC_FMT" %s, %s(band:%u, ch:%u, l_rxsc:%u, ht_rxsc:%u)\n"
|
||||
, *phys & 0xf
|
||||
, MAC_ARG(get_ta(wlanhdr))
|
||||
, is_broadcast_mac_addr(get_ra(wlanhdr)) ? "BC" : is_multicast_mac_addr(get_ra(wlanhdr)) ? "MC" : "UC"
|
||||
, HDATA_RATE(attrib->data_rate)
|
||||
, phys_t2->band, phys_t2->channel, phys_t2->l_rxsc, phys_t2->ht_rxsc
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* (ODM_PHY_STATUS_NEW_TYPE_SUPPORT == 1) */
|
||||
|
||||
}
|
||||
|
||||
#if defined(CONFIG_RTL8822C) && defined(CONFIG_LPS_PG)
|
||||
void odm_iqk_get_cfir2fw_8822c(void *dm_void, u8 *buf, u32 *buf_size)
|
||||
{
|
||||
struct dm_struct *dm = (struct dm_struct *)dm_void;
|
||||
struct dm_iqk_info *iqk_info = &dm->IQK_info;
|
||||
|
||||
if (buf) {
|
||||
u16 offset = 0;
|
||||
|
||||
odm_move_memory(dm, buf, iqk_info->iqk_channel, sizeof(iqk_info->iqk_channel));
|
||||
offset += sizeof(iqk_info->iqk_channel);
|
||||
odm_move_memory(dm, buf + offset, &iqk_info->iqk_cfir_real[0][0], sizeof(iqk_info->iqk_cfir_real[0][0]));
|
||||
offset += sizeof(iqk_info->iqk_cfir_real[0][0]);
|
||||
odm_move_memory(dm, buf + offset, &iqk_info->iqk_cfir_real[0][1], sizeof(iqk_info->iqk_cfir_real[0][1]));
|
||||
offset += sizeof(iqk_info->iqk_cfir_real[0][1]);
|
||||
odm_move_memory(dm, buf + offset, &iqk_info->iqk_cfir_real[1][0], sizeof(iqk_info->iqk_cfir_real[1][0]));
|
||||
offset += sizeof(iqk_info->iqk_cfir_real[1][0]);
|
||||
odm_move_memory(dm, buf + offset, &iqk_info->iqk_cfir_real[1][1], sizeof(iqk_info->iqk_cfir_real[1][1]));
|
||||
offset += sizeof(iqk_info->iqk_cfir_real[1][1]);
|
||||
odm_move_memory(dm, buf + offset, &iqk_info->iqk_cfir_imag[0][0], sizeof(iqk_info->iqk_cfir_imag[0][0]));
|
||||
offset += sizeof(iqk_info->iqk_cfir_imag[0][0]);
|
||||
odm_move_memory(dm, buf + offset, &iqk_info->iqk_cfir_imag[0][1], sizeof(iqk_info->iqk_cfir_imag[0][1]));
|
||||
offset += sizeof(iqk_info->iqk_cfir_imag[0][1]);
|
||||
odm_move_memory(dm, buf + offset, &iqk_info->iqk_cfir_imag[1][0], sizeof(iqk_info->iqk_cfir_imag[1][0]));
|
||||
offset += sizeof(iqk_info->iqk_cfir_imag[1][0]);
|
||||
odm_move_memory(dm, buf + offset, &iqk_info->iqk_cfir_imag[1][1], sizeof(iqk_info->iqk_cfir_imag[1][1]));
|
||||
offset += sizeof(iqk_info->iqk_cfir_imag[1][1]);
|
||||
odm_move_memory(dm, buf + offset, &iqk_info->lok_idac[0][0], sizeof(iqk_info->lok_idac[0][0]));
|
||||
offset += sizeof(iqk_info->lok_idac[0][0]);
|
||||
odm_move_memory(dm, buf + offset, &iqk_info->lok_idac[0][1], sizeof(iqk_info->lok_idac[0][1]));
|
||||
offset += sizeof(iqk_info->lok_idac[0][1]);
|
||||
odm_move_memory(dm, buf + offset, &iqk_info->lok_idac[1][0], sizeof(iqk_info->lok_idac[1][0]));
|
||||
offset += sizeof(iqk_info->lok_idac[1][0]);
|
||||
odm_move_memory(dm, buf + offset, &iqk_info->lok_idac[1][1], sizeof(iqk_info->lok_idac[1][1]));
|
||||
offset += sizeof(iqk_info->lok_idac[1][1]);
|
||||
}
|
||||
|
||||
if (buf_size)
|
||||
*buf_size = RSVDPAGE_8822C_LPS_PG_IQK_INFO_LEN;
|
||||
}
|
||||
|
||||
void
|
||||
debug_DACK(
|
||||
struct dm_struct *dm
|
||||
)
|
||||
{
|
||||
//P_PHYDM_FUNC dm;
|
||||
//dm = &(SysMib.ODM.Phydm);
|
||||
//PIQK_OFFLOAD_PARM pIQK_info;
|
||||
//pIQK_info= &(SysMib.ODM.IQKParm);
|
||||
u8 i;
|
||||
u32 temp1, temp2, temp3;
|
||||
|
||||
temp1 = odm_get_bb_reg(dm, 0x1860, bMaskDWord);
|
||||
temp2 = odm_get_bb_reg(dm, 0x4160, bMaskDWord);
|
||||
temp3 = odm_get_bb_reg(dm, 0x9b4, bMaskDWord);
|
||||
|
||||
odm_set_bb_reg(dm, 0x9b4, bMaskDWord, 0xdb66db00);
|
||||
|
||||
//pathA
|
||||
odm_set_bb_reg(dm, 0x1830, BIT(30), 0x0);
|
||||
odm_set_bb_reg(dm, 0x1860, 0xfc000000, 0x3c);
|
||||
|
||||
RTW_INFO("path A i\n");
|
||||
//i
|
||||
for (i = 0; i < 0xf; i++) {
|
||||
odm_set_bb_reg(dm, 0x18b0, 0xf0000000, i);
|
||||
RTW_INFO("[0][0][%d] = 0x%08x\n", i, (u16)odm_get_bb_reg(dm,0x2810,0x7fc0000));
|
||||
//pIQK_info->msbk_d[0][0][i] = (u16)odm_get_bb_reg(dm,0x2810,0x7fc0000);
|
||||
}
|
||||
RTW_INFO("path A q\n");
|
||||
//q
|
||||
for (i = 0; i < 0xf; i++) {
|
||||
odm_set_bb_reg(dm, 0x18cc, 0xf0000000, i);
|
||||
RTW_INFO("[0][1][%d] = 0x%08x\n", i, (u16)odm_get_bb_reg(dm,0x283c,0x7fc0000));
|
||||
//pIQK_info->msbk_d[0][1][i] = (u16)odm_get_bb_reg(dm,0x283c,0x7fc0000);
|
||||
}
|
||||
//pathB
|
||||
odm_set_bb_reg(dm, 0x4130, BIT(30), 0x0);
|
||||
odm_set_bb_reg(dm, 0x4160, 0xfc000000, 0x3c);
|
||||
|
||||
RTW_INFO("\npath B i\n");
|
||||
//i
|
||||
for (i = 0; i < 0xf; i++) {
|
||||
odm_set_bb_reg(dm, 0x41b0, 0xf0000000, i);
|
||||
RTW_INFO("[1][0][%d] = 0x%08x\n", i, (u16)odm_get_bb_reg(dm,0x4510,0x7fc0000));
|
||||
//pIQK_info->msbk_d[1][0][i] = (u16)odm_get_bb_reg(dm,0x2810,0x7fc0000);
|
||||
}
|
||||
RTW_INFO("path B q\n");
|
||||
//q
|
||||
for (i = 0; i < 0xf; i++) {
|
||||
odm_set_bb_reg(dm, 0x41cc, 0xf0000000, i);
|
||||
RTW_INFO("[1][1][%d] = 0x%08x\n", i, (u16)odm_get_bb_reg(dm,0x453c,0x7fc0000));
|
||||
//pIQK_info->msbk_d[1][1][i] = (u16)odm_get_bb_reg(dm,0x283c,0x7fc0000);
|
||||
}
|
||||
|
||||
//restore to normal
|
||||
odm_set_bb_reg(dm, 0x1830, BIT(30), 0x1);
|
||||
odm_set_bb_reg(dm, 0x4130, BIT(30), 0x1);
|
||||
odm_set_bb_reg(dm, 0x1860, bMaskDWord, temp1);
|
||||
odm_set_bb_reg(dm, 0x4160, bMaskDWord, temp2);
|
||||
odm_set_bb_reg(dm, 0x9b4, bMaskDWord, temp3);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
debug_IQK(
|
||||
struct dm_struct *dm,
|
||||
IN u8 idx,
|
||||
IN u8 path
|
||||
)
|
||||
{
|
||||
u8 i, ch;
|
||||
u32 tmp;
|
||||
u32 bit_mask_20_16 = BIT(20) | BIT(19) | BIT(18) | BIT(17) | BIT(16);
|
||||
|
||||
RTW_INFO("idx = %d, path = %d\n", idx, path);
|
||||
|
||||
odm_set_bb_reg(dm, 0x1b00, MASKDWORD, 0x8 | path << 1);
|
||||
|
||||
if (idx == TX_IQK) {//TXCFIR
|
||||
odm_set_bb_reg(dm, R_0x1b20, BIT(31) | BIT(30), 0x3);
|
||||
} else {//RXCFIR
|
||||
odm_set_bb_reg(dm, R_0x1b20, BIT(31) | BIT(30), 0x1);
|
||||
}
|
||||
odm_set_bb_reg(dm, R_0x1bd4, BIT(21), 0x1);
|
||||
odm_set_bb_reg(dm, R_0x1bd4, bit_mask_20_16, 0x10);
|
||||
for (i = 0; i <= 16; i++) {
|
||||
odm_set_bb_reg(dm, R_0x1bd8, MASKDWORD, 0xe0000001 | i << 2);
|
||||
tmp = odm_get_bb_reg(dm, R_0x1bfc, MASKDWORD);
|
||||
RTW_INFO("iqk_cfir_real[%d][%d][%d] = 0x%x\n", path, idx, i, ((tmp & 0x0fff0000) >> 16));
|
||||
//iqk_info->iqk_cfir_real[ch][path][idx][i] =
|
||||
// (tmp & 0x0fff0000) >> 16;
|
||||
RTW_INFO("iqk_cfir_imag[%d][%d][%d] = 0x%x\n", path, idx, i, (tmp & 0x0fff));
|
||||
//iqk_info->iqk_cfir_imag[ch][path][idx][i] = tmp & 0x0fff;
|
||||
}
|
||||
odm_set_bb_reg(dm, R_0x1b20, BIT(31) | BIT(30), 0x0);
|
||||
//odm_set_bb_reg(dm, R_0x1bd8, MASKDWORD, 0x0);
|
||||
}
|
||||
|
||||
__odm_func__ void
|
||||
debug_information_8822c(
|
||||
struct dm_struct *dm)
|
||||
{
|
||||
struct dm_dpk_info *dpk_info = &dm->dpk_info;
|
||||
|
||||
u32 reg_rf18;
|
||||
|
||||
if (odm_get_bb_reg(dm, R_0x1e7c, BIT(30)))
|
||||
dpk_info->is_tssi_mode = true;
|
||||
else
|
||||
dpk_info->is_tssi_mode = false;
|
||||
|
||||
reg_rf18 = odm_get_rf_reg(dm, RF_PATH_A, RF_0x18, RFREG_MASK);
|
||||
|
||||
dpk_info->dpk_band = (u8)((reg_rf18 & BIT(16)) >> 16); /*0/1:G/A*/
|
||||
dpk_info->dpk_ch = (u8)reg_rf18 & 0xff;
|
||||
dpk_info->dpk_bw = (u8)((reg_rf18 & 0x3000) >> 12); /*3/2/1:20/40/80*/
|
||||
|
||||
RTW_INFO("[DPK] TSSI/ Band/ CH/ BW = %d / %s / %d / %s\n",
|
||||
dpk_info->is_tssi_mode, dpk_info->dpk_band == 0 ? "2G" : "5G",
|
||||
dpk_info->dpk_ch,
|
||||
dpk_info->dpk_bw == 3 ? "20M" : (dpk_info->dpk_bw == 2 ? "40M" : "80M"));
|
||||
}
|
||||
|
||||
extern void _dpk_get_coef_8822c(void *dm_void, u8 path);
|
||||
|
||||
__odm_func__ void
|
||||
debug_reload_data_8822c(
|
||||
void *dm_void)
|
||||
{
|
||||
struct dm_struct *dm = (struct dm_struct *)dm_void;
|
||||
struct dm_dpk_info *dpk_info = &dm->dpk_info;
|
||||
|
||||
u8 path;
|
||||
u32 u32tmp;
|
||||
|
||||
debug_information_8822c(dm);
|
||||
|
||||
for (path = 0; path < DPK_RF_PATH_NUM_8822C; path++) {
|
||||
|
||||
RTW_INFO("[DPK] Reload path: 0x%x\n", path);
|
||||
|
||||
odm_set_bb_reg(dm, R_0x1b00, MASKDWORD, 0x8 | (path << 1));
|
||||
|
||||
/*txagc bnd*/
|
||||
if (dpk_info->dpk_band == 0x0)
|
||||
u32tmp = odm_get_bb_reg(dm, R_0x1b60, MASKDWORD);
|
||||
else
|
||||
u32tmp = odm_get_bb_reg(dm, R_0x1b60, MASKDWORD);
|
||||
|
||||
RTW_INFO("[DPK] txagc bnd = 0x%08x\n", u32tmp);
|
||||
|
||||
u32tmp = odm_get_bb_reg(dm, R_0x1b64, MASKBYTE3);
|
||||
RTW_INFO("[DPK] dpk_txagc = 0x%08x\n", u32tmp);
|
||||
|
||||
//debug_coef_write_8822c(dm, path, dpk_info->dpk_path_ok & BIT(path) >> path);
|
||||
_dpk_get_coef_8822c(dm, path);
|
||||
|
||||
//debug_one_shot_8822c(dm, path, DPK_ON);
|
||||
|
||||
odm_set_bb_reg(dm, R_0x1b00, 0x0000000f, 0xc);
|
||||
|
||||
if (path == RF_PATH_A)
|
||||
u32tmp = odm_get_bb_reg(dm, R_0x1b04, 0x0fffffff);
|
||||
else
|
||||
u32tmp = odm_get_bb_reg(dm, R_0x1b5c, 0x0fffffff);
|
||||
|
||||
RTW_INFO("[DPK] dpk_gs = 0x%08x\n", u32tmp);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void odm_lps_pg_debug_8822c(void *dm_void)
|
||||
{
|
||||
struct dm_struct *dm = (struct dm_struct *)dm_void;
|
||||
|
||||
debug_DACK(dm);
|
||||
debug_IQK(dm, TX_IQK, RF_PATH_A);
|
||||
debug_IQK(dm, RX_IQK, RF_PATH_A);
|
||||
debug_IQK(dm, TX_IQK, RF_PATH_B);
|
||||
debug_IQK(dm, RX_IQK, RF_PATH_B);
|
||||
debug_reload_data_8822c(dm);
|
||||
}
|
||||
#endif /* defined(CONFIG_RTL8822C) && defined(CONFIG_LPS_PG) */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,998 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include <drv_types.h>
|
||||
#include <hal_data.h>
|
||||
#include "rtw_rm_fsm.h"
|
||||
|
||||
#ifdef CONFIG_RTW_80211K
|
||||
|
||||
struct fsm_state {
|
||||
u8 *name;
|
||||
int(*fsm_func)(struct rm_obj *prm, enum RM_EV_ID evid);
|
||||
};
|
||||
|
||||
static void rm_state_initial(struct rm_obj *prm);
|
||||
static void rm_state_goto(struct rm_obj *prm, enum RM_STATE rm_state);
|
||||
static void rm_state_run(struct rm_obj *prm, enum RM_EV_ID evid);
|
||||
static struct rm_event *rm_dequeue_ev(_queue *queue);
|
||||
static struct rm_obj *rm_dequeue_rm(_queue *queue);
|
||||
|
||||
void rm_timer_callback(void *data)
|
||||
{
|
||||
int i;
|
||||
_adapter *padapter = (_adapter *)data;
|
||||
struct rm_priv *prmpriv = &padapter->rmpriv;
|
||||
struct rm_clock *pclock;
|
||||
|
||||
|
||||
/* deal with clock */
|
||||
for (i=0;i<RM_TIMER_NUM;i++) {
|
||||
pclock = &prmpriv->clock[i];
|
||||
if (pclock->prm == NULL
|
||||
||(ATOMIC_READ(&(pclock->counter)) == 0))
|
||||
continue;
|
||||
|
||||
ATOMIC_DEC(&(pclock->counter));
|
||||
|
||||
if (ATOMIC_READ(&(pclock->counter)) == 0)
|
||||
rm_post_event(pclock->prm->psta->padapter,
|
||||
pclock->prm->rmid, prmpriv->clock[i].evid);
|
||||
}
|
||||
_set_timer(&prmpriv->rm_timer, CLOCK_UNIT);
|
||||
}
|
||||
|
||||
int rtw_init_rm(_adapter *padapter)
|
||||
{
|
||||
struct rm_priv *prmpriv = &padapter->rmpriv;
|
||||
|
||||
|
||||
RTW_INFO("RM: %s\n",__func__);
|
||||
_rtw_init_queue(&(prmpriv->rm_queue));
|
||||
_rtw_init_queue(&(prmpriv->ev_queue));
|
||||
|
||||
/* bit 0-7 */
|
||||
prmpriv->rm_en_cap_def[0] = 0
|
||||
/*| BIT(RM_LINK_MEAS_CAP_EN)*/
|
||||
| BIT(RM_NB_REP_CAP_EN)
|
||||
/*| BIT(RM_PARAL_MEAS_CAP_EN)*/
|
||||
| BIT(RM_REPEAT_MEAS_CAP_EN)
|
||||
| BIT(RM_BCN_PASSIVE_MEAS_CAP_EN)
|
||||
| BIT(RM_BCN_ACTIVE_MEAS_CAP_EN)
|
||||
| BIT(RM_BCN_TABLE_MEAS_CAP_EN)
|
||||
/*| BIT(RM_BCN_MEAS_REP_COND_CAP_EN)*/;
|
||||
|
||||
/* bit 8-15 */
|
||||
prmpriv->rm_en_cap_def[1] = 0
|
||||
/*| BIT(RM_FRAME_MEAS_CAP_EN - 8)*/
|
||||
#ifdef CONFIG_RTW_ACS
|
||||
| BIT(RM_CH_LOAD_CAP_EN - 8)
|
||||
| BIT(RM_NOISE_HISTO_CAP_EN - 8)
|
||||
#endif
|
||||
/*| BIT(RM_STATIS_MEAS_CAP_EN - 8)*/
|
||||
/*| BIT(RM_LCI_MEAS_CAP_EN - 8)*/
|
||||
/*| BIT(RM_LCI_AMIMUTH_CAP_EN - 8)*/
|
||||
/*| BIT(RM_TRANS_STREAM_CAT_MEAS_CAP_EN - 8)*/
|
||||
/*| BIT(RM_TRIG_TRANS_STREAM_CAT_MEAS_CAP_EN - 8)*/;
|
||||
|
||||
/* bit 16-23 */
|
||||
prmpriv->rm_en_cap_def[2] = 0
|
||||
/*| BIT(RM_AP_CH_REP_CAP_EN - 16)*/
|
||||
/*| BIT(RM_RM_MIB_CAP_EN - 16)*/
|
||||
/*| BIT(RM_OP_CH_MAX_MEAS_DUR0 - 16)*/
|
||||
/*| BIT(RM_OP_CH_MAX_MEAS_DUR1 - 16)*/
|
||||
/*| BIT(RM_OP_CH_MAX_MEAS_DUR2 - 16)*/
|
||||
/*| BIT(RM_NONOP_CH_MAX_MEAS_DUR0 - 16)*/
|
||||
/*| BIT(RM_NONOP_CH_MAX_MEAS_DUR1 - 16)*/
|
||||
/*| BIT(RM_NONOP_CH_MAX_MEAS_DUR2 - 16)*/;
|
||||
|
||||
/* bit 24-31 */
|
||||
prmpriv->rm_en_cap_def[3] = 0
|
||||
/*| BIT(RM_MEAS_PILOT_CAP0 - 24)*/
|
||||
/*| BIT(RM_MEAS_PILOT_CAP1 - 24)*/
|
||||
/*| BIT(RM_MEAS_PILOT_CAP2 - 24)*/
|
||||
/*| BIT(RM_MEAS_PILOT_TRANS_INFO_CAP_EN - 24)*/
|
||||
/*| BIT(RM_NB_REP_TSF_OFFSET_CAP_EN - 24)*/
|
||||
| BIT(RM_RCPI_MEAS_CAP_EN - 24)
|
||||
| BIT(RM_RSNI_MEAS_CAP_EN - 24)
|
||||
/*| BIT(RM_BSS_AVG_ACCESS_DELAY_CAP_EN - 24)*/;
|
||||
|
||||
/* bit 32-39 */
|
||||
prmpriv->rm_en_cap_def[4] = 0
|
||||
/*| BIT(RM_BSS_AVG_ACCESS_DELAY_CAP_EN - 32)*/
|
||||
/*| BIT(RM_AVALB_ADMIS_CAPACITY_CAP_EN - 32)*/
|
||||
/*| BIT(RM_ANT_CAP_EN - 32)*/;
|
||||
|
||||
prmpriv->enable = _TRUE;
|
||||
|
||||
/* clock timer */
|
||||
rtw_init_timer(&prmpriv->rm_timer,
|
||||
padapter, rm_timer_callback, padapter);
|
||||
_set_timer(&prmpriv->rm_timer, CLOCK_UNIT);
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
int rtw_deinit_rm(_adapter *padapter)
|
||||
{
|
||||
struct rm_priv *prmpriv = &padapter->rmpriv;
|
||||
struct rm_obj *prm;
|
||||
struct rm_event *pev;
|
||||
|
||||
|
||||
RTW_INFO("RM: %s\n",__func__);
|
||||
prmpriv->enable = _FALSE;
|
||||
_cancel_timer_ex(&prmpriv->rm_timer);
|
||||
|
||||
/* free all events and measurements */
|
||||
while((pev = rm_dequeue_ev(&prmpriv->ev_queue)) != NULL)
|
||||
rtw_mfree((void *)pev, sizeof(struct rm_event));
|
||||
|
||||
while((prm = rm_dequeue_rm(&prmpriv->rm_queue)) != NULL)
|
||||
rm_state_run(prm, RM_EV_cancel);
|
||||
|
||||
_rtw_deinit_queue(&(prmpriv->rm_queue));
|
||||
_rtw_deinit_queue(&(prmpriv->ev_queue));
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
int rtw_free_rm_priv(_adapter *padapter)
|
||||
{
|
||||
return rtw_deinit_rm(padapter);
|
||||
}
|
||||
|
||||
static int rm_enqueue_ev(_queue *queue, struct rm_event *obj, bool to_head)
|
||||
{
|
||||
_irqL irqL;
|
||||
|
||||
|
||||
if (obj == NULL)
|
||||
return _FAIL;
|
||||
|
||||
_enter_critical(&queue->lock, &irqL);
|
||||
|
||||
if (to_head)
|
||||
rtw_list_insert_head(&obj->list, &queue->queue);
|
||||
else
|
||||
rtw_list_insert_tail(&obj->list, &queue->queue);
|
||||
|
||||
_exit_critical(&queue->lock, &irqL);
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
static void rm_set_clock(struct rm_obj *prm, u32 ms, enum RM_EV_ID evid)
|
||||
{
|
||||
ATOMIC_SET(&(prm->pclock->counter), (ms/CLOCK_UNIT));
|
||||
prm->pclock->evid = evid;
|
||||
}
|
||||
|
||||
static struct rm_clock *rm_alloc_clock(_adapter *padapter, struct rm_obj *prm)
|
||||
{
|
||||
int i;
|
||||
struct rm_priv *prmpriv = &padapter->rmpriv;
|
||||
struct rm_clock *pclock = NULL;
|
||||
|
||||
|
||||
for (i=0;i<RM_TIMER_NUM;i++) {
|
||||
pclock = &prmpriv->clock[i];
|
||||
|
||||
if (pclock->prm == NULL) {
|
||||
pclock->prm = prm;
|
||||
ATOMIC_SET(&(pclock->counter), 0);
|
||||
pclock->evid = RM_EV_max;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return pclock;
|
||||
}
|
||||
|
||||
static void rm_cancel_clock(struct rm_obj *prm)
|
||||
{
|
||||
ATOMIC_SET(&(prm->pclock->counter), 0);
|
||||
prm->pclock->evid = RM_EV_max;
|
||||
}
|
||||
|
||||
static void rm_free_clock(struct rm_clock *pclock)
|
||||
{
|
||||
pclock->prm = NULL;
|
||||
ATOMIC_SET(&(pclock->counter), 0);
|
||||
pclock->evid = RM_EV_max;
|
||||
}
|
||||
|
||||
static int is_list_linked(const struct list_head *head)
|
||||
{
|
||||
return head->prev != NULL;
|
||||
}
|
||||
|
||||
void rm_free_rmobj(struct rm_obj *prm)
|
||||
{
|
||||
if (is_list_linked(&prm->list))
|
||||
rtw_list_delete(&prm->list);
|
||||
|
||||
if (prm->q.pssid)
|
||||
rtw_mfree(prm->q.pssid, strlen(prm->q.pssid)+1);
|
||||
|
||||
if (prm->q.opt.bcn.req_start)
|
||||
rtw_mfree(prm->q.opt.bcn.req_start,
|
||||
prm->q.opt.bcn.req_len);
|
||||
|
||||
if (prm->pclock)
|
||||
rm_free_clock(prm->pclock);
|
||||
|
||||
rtw_mfree((void *)prm, sizeof(struct rm_obj));
|
||||
}
|
||||
|
||||
struct rm_obj *rm_alloc_rmobj(_adapter *padapter)
|
||||
{
|
||||
struct rm_obj *prm;
|
||||
|
||||
|
||||
prm = (struct rm_obj *)rtw_malloc(sizeof(struct rm_obj));
|
||||
if (prm == NULL)
|
||||
return NULL;
|
||||
|
||||
_rtw_memset(prm, 0, sizeof(struct rm_obj));
|
||||
|
||||
/* alloc timer */
|
||||
if ((prm->pclock = rm_alloc_clock(padapter, prm)) == NULL) {
|
||||
rm_free_rmobj(prm);
|
||||
return NULL;
|
||||
}
|
||||
return prm;
|
||||
}
|
||||
|
||||
int rm_enqueue_rmobj(_adapter *padapter, struct rm_obj *prm, bool to_head)
|
||||
{
|
||||
_irqL irqL;
|
||||
struct rm_priv *prmpriv = &padapter->rmpriv;
|
||||
_queue *queue = &prmpriv->rm_queue;
|
||||
|
||||
|
||||
if (prm == NULL)
|
||||
return _FAIL;
|
||||
|
||||
_enter_critical(&queue->lock, &irqL);
|
||||
if (to_head)
|
||||
rtw_list_insert_head(&prm->list, &queue->queue);
|
||||
else
|
||||
rtw_list_insert_tail(&prm->list, &queue->queue);
|
||||
_exit_critical(&queue->lock, &irqL);
|
||||
|
||||
rm_state_initial(prm);
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
static struct rm_obj *rm_dequeue_rm(_queue *queue)
|
||||
{
|
||||
_irqL irqL;
|
||||
struct rm_obj *prm;
|
||||
|
||||
|
||||
_enter_critical(&queue->lock, &irqL);
|
||||
if (rtw_is_list_empty(&(queue->queue)))
|
||||
prm = NULL;
|
||||
else {
|
||||
prm = LIST_CONTAINOR(get_next(&(queue->queue)),
|
||||
struct rm_obj, list);
|
||||
/* rtw_list_delete(&prm->list); */
|
||||
}
|
||||
_exit_critical(&queue->lock, &irqL);
|
||||
|
||||
return prm;
|
||||
}
|
||||
|
||||
static struct rm_event *rm_dequeue_ev(_queue *queue)
|
||||
{
|
||||
_irqL irqL;
|
||||
struct rm_event *ev;
|
||||
|
||||
|
||||
_enter_critical(&queue->lock, &irqL);
|
||||
if (rtw_is_list_empty(&(queue->queue)))
|
||||
ev = NULL;
|
||||
else {
|
||||
ev = LIST_CONTAINOR(get_next(&(queue->queue)),
|
||||
struct rm_event, list);
|
||||
rtw_list_delete(&ev->list);
|
||||
}
|
||||
_exit_critical(&queue->lock, &irqL);
|
||||
|
||||
return ev;
|
||||
}
|
||||
|
||||
static struct rm_obj *_rm_get_rmobj(_queue *queue, u32 rmid)
|
||||
{
|
||||
_irqL irqL;
|
||||
_list *phead, *plist;
|
||||
struct rm_obj *prm = NULL;
|
||||
|
||||
|
||||
if (rmid == 0)
|
||||
return NULL;
|
||||
|
||||
_enter_critical(&queue->lock, &irqL);
|
||||
|
||||
phead = get_list_head(queue);
|
||||
plist = get_next(phead);
|
||||
while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) {
|
||||
|
||||
prm = LIST_CONTAINOR(plist, struct rm_obj, list);
|
||||
if (rmid == (prm->rmid)) {
|
||||
_exit_critical(&queue->lock, &irqL);
|
||||
return prm;
|
||||
}
|
||||
plist = get_next(plist);
|
||||
}
|
||||
_exit_critical(&queue->lock, &irqL);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct sta_info *rm_get_psta(_adapter *padapter, u32 rmid)
|
||||
{
|
||||
struct rm_priv *prmpriv = &padapter->rmpriv;
|
||||
struct rm_obj *prm;
|
||||
|
||||
|
||||
prm = _rm_get_rmobj(&prmpriv->rm_queue, rmid);
|
||||
|
||||
if (prm)
|
||||
return prm->psta;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct rm_obj *rm_get_rmobj(_adapter *padapter, u32 rmid)
|
||||
{
|
||||
struct rm_priv *prmpriv = &padapter->rmpriv;
|
||||
|
||||
return _rm_get_rmobj(&prmpriv->rm_queue, rmid);
|
||||
}
|
||||
|
||||
u8 rtw_rm_post_envent_cmd(_adapter *padapter, u32 rmid, u8 evid)
|
||||
{
|
||||
struct cmd_obj *pcmd;
|
||||
struct rm_event *pev;
|
||||
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
|
||||
u8 res = _SUCCESS;
|
||||
|
||||
|
||||
pcmd = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (pcmd == NULL) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
pev = (struct rm_event*)rtw_zmalloc(sizeof(struct rm_event));
|
||||
|
||||
if (pev == NULL) {
|
||||
rtw_mfree((u8 *) pcmd, sizeof(struct cmd_obj));
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
pev->rmid = rmid;
|
||||
pev->evid = evid;
|
||||
|
||||
init_h2fwcmd_w_parm_no_rsp(pcmd, pev, GEN_CMD_CODE(_RM_POST_EVENT));
|
||||
res = rtw_enqueue_cmd(pcmdpriv, pcmd);
|
||||
exit:
|
||||
return res;
|
||||
}
|
||||
|
||||
int rm_post_event(_adapter *padapter, u32 rmid, enum RM_EV_ID evid)
|
||||
{
|
||||
if (padapter->rmpriv.enable == _FALSE)
|
||||
return _FALSE;
|
||||
|
||||
RTW_INFO("RM: post asyn %s to rmid=%x\n", rm_event_name(evid), rmid);
|
||||
rtw_rm_post_envent_cmd(padapter, rmid, evid);
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
int _rm_post_event(_adapter *padapter, u32 rmid, enum RM_EV_ID evid)
|
||||
{
|
||||
struct rm_priv *prmpriv = &padapter->rmpriv;
|
||||
struct rm_event *pev;
|
||||
|
||||
if (evid >= RM_EV_max || rmid == 0)
|
||||
return _FALSE;
|
||||
|
||||
pev = (struct rm_event *)rtw_malloc(sizeof(struct rm_event));
|
||||
if (pev == NULL)
|
||||
return _FALSE;
|
||||
|
||||
pev->rmid = rmid;
|
||||
pev->evid = evid;
|
||||
|
||||
RTW_INFO("RM: post sync %s to rmid=%x\n", rm_event_name(evid), rmid);
|
||||
rm_enqueue_ev(&prmpriv->ev_queue, pev, FALSE);
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
static void rm_bcast_aid_handler(_adapter *padapter, struct rm_event *pev)
|
||||
{
|
||||
_irqL irqL;
|
||||
_list *phead, *plist;
|
||||
_queue *queue = &padapter->rmpriv.rm_queue;
|
||||
struct rm_obj *prm;
|
||||
|
||||
|
||||
_enter_critical(&queue->lock, &irqL);
|
||||
phead = get_list_head(queue);
|
||||
plist = get_next(phead);
|
||||
while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) {
|
||||
|
||||
prm = LIST_CONTAINOR(plist, struct rm_obj, list);
|
||||
plist = get_next(plist);
|
||||
if (RM_GET_AID(pev->rmid) == RM_GET_AID(prm->rmid)) {
|
||||
_exit_critical(&queue->lock, &irqL);
|
||||
rm_state_run(prm, pev->evid);
|
||||
_enter_critical(&queue->lock, &irqL);
|
||||
}
|
||||
}
|
||||
_exit_critical(&queue->lock, &irqL);
|
||||
return;
|
||||
}
|
||||
|
||||
/* main handler of RM (Resource Management) */
|
||||
void rm_handler(_adapter *padapter, struct rm_event *pe)
|
||||
{
|
||||
int i;
|
||||
struct rm_priv *prmpriv = &padapter->rmpriv;
|
||||
struct rm_obj *prm;
|
||||
struct rm_event *pev;
|
||||
|
||||
|
||||
/* dequeue event */
|
||||
while((pev = rm_dequeue_ev(&prmpriv->ev_queue)) != NULL)
|
||||
{
|
||||
if (RM_IS_ID_FOR_ALL(pev->rmid)) {
|
||||
/* apply to all aid mateched measurement */
|
||||
rm_bcast_aid_handler(padapter, pev);
|
||||
rtw_mfree((void *)pev, sizeof(struct rm_event));
|
||||
continue;
|
||||
}
|
||||
|
||||
/* retrieve rmobj */
|
||||
prm = _rm_get_rmobj(&prmpriv->rm_queue, pev->rmid);
|
||||
if (prm == NULL) {
|
||||
RTW_ERR("RM: rmid=%x event=%s doesn't find rm obj\n",
|
||||
pev->rmid, rm_event_name(pev->evid));
|
||||
rtw_mfree((void *)pev, sizeof(struct rm_event));
|
||||
return;
|
||||
}
|
||||
/* run state machine */
|
||||
rm_state_run(prm, pev->evid);
|
||||
rtw_mfree((void *)pev, sizeof(struct rm_event));
|
||||
}
|
||||
}
|
||||
|
||||
static int rm_issue_meas_req(struct rm_obj *prm)
|
||||
{
|
||||
switch (prm->q.action_code) {
|
||||
case RM_ACT_RADIO_MEAS_REQ:
|
||||
switch (prm->q.m_type) {
|
||||
case bcn_req:
|
||||
case ch_load_req:
|
||||
case noise_histo_req:
|
||||
issue_radio_meas_req(prm);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
} /* meas_type */
|
||||
break;
|
||||
case RM_ACT_NB_REP_REQ:
|
||||
/* issue neighbor request */
|
||||
issue_nb_req(prm);
|
||||
break;
|
||||
case RM_ACT_LINK_MEAS_REQ:
|
||||
default:
|
||||
return _FALSE;
|
||||
} /* action_code */
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* RM state machine
|
||||
*/
|
||||
|
||||
static int rm_state_idle(struct rm_obj *prm, enum RM_EV_ID evid)
|
||||
{
|
||||
_adapter *padapter = prm->psta->padapter;
|
||||
u8 val8;
|
||||
u32 val32;
|
||||
|
||||
|
||||
prm->p.category = RTW_WLAN_CATEGORY_RADIO_MEAS;
|
||||
|
||||
switch (evid) {
|
||||
case RM_EV_state_in:
|
||||
switch (prm->q.action_code) {
|
||||
case RM_ACT_RADIO_MEAS_REQ:
|
||||
/* copy attrib from meas_req to meas_rep */
|
||||
prm->p.action_code = RM_ACT_RADIO_MEAS_REP;
|
||||
prm->p.diag_token = prm->q.diag_token;
|
||||
prm->p.e_id = _MEAS_RSP_IE_;
|
||||
prm->p.m_token = prm->q.m_token;
|
||||
prm->p.m_type = prm->q.m_type;
|
||||
prm->p.rpt = prm->q.rpt;
|
||||
prm->p.ch_num = prm->q.ch_num;
|
||||
prm->p.op_class = prm->q.op_class;
|
||||
|
||||
if (prm->q.m_type == ch_load_req
|
||||
|| prm->q.m_type == noise_histo_req) {
|
||||
/*
|
||||
* phydm measure current ch periodically
|
||||
* scan current ch is not necessary
|
||||
*/
|
||||
val8 = padapter->mlmeextpriv.cur_channel;
|
||||
if (prm->q.ch_num == val8)
|
||||
prm->poll_mode = 1;
|
||||
}
|
||||
RTW_INFO("RM: rmid=%x %s switch in repeat=%u\n",
|
||||
prm->rmid, rm_type_req_name(prm->q.m_type),
|
||||
prm->q.rpt);
|
||||
break;
|
||||
case RM_ACT_NB_REP_REQ:
|
||||
prm->p.action_code = RM_ACT_NB_REP_RESP;
|
||||
RTW_INFO("RM: rmid=%x Neighbor request switch in\n",
|
||||
prm->rmid);
|
||||
break;
|
||||
case RM_ACT_LINK_MEAS_REQ:
|
||||
prm->p.action_code = RM_ACT_LINK_MEAS_REP;
|
||||
rm_set_rep_mode(prm, MEAS_REP_MOD_INCAP);
|
||||
RTW_INFO("RM: rmid=%x Link meas switch in\n",
|
||||
prm->rmid);
|
||||
break;
|
||||
default:
|
||||
prm->p.action_code = prm->q.action_code;
|
||||
rm_set_rep_mode(prm, MEAS_REP_MOD_INCAP);
|
||||
RTW_INFO("RM: rmid=%x recv unknown action %d\n",
|
||||
prm->rmid,prm->p.action_code);
|
||||
break;
|
||||
} /* switch() */
|
||||
|
||||
if (prm->rmid & RM_MASTER) {
|
||||
if (rm_issue_meas_req(prm) == _SUCCESS)
|
||||
rm_state_goto(prm, RM_ST_WAIT_MEAS);
|
||||
else
|
||||
rm_state_goto(prm, RM_ST_END);
|
||||
return _SUCCESS;
|
||||
} else {
|
||||
rm_state_goto(prm, RM_ST_DO_MEAS);
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
if (prm->p.m_mode) {
|
||||
issue_null_reply(prm);
|
||||
rm_state_goto(prm, RM_ST_END);
|
||||
return _SUCCESS;
|
||||
}
|
||||
if (prm->q.rand_intvl) {
|
||||
/* get low tsf to generate random interval */
|
||||
val32 = rtw_read32(padapter, REG_TSFTR);
|
||||
val32 = val32 % prm->q.rand_intvl;
|
||||
RTW_INFO("RM: rmid=%x rand_intval=%d, rand=%d\n",
|
||||
prm->rmid, (int)prm->q.rand_intvl,val32);
|
||||
rm_set_clock(prm, prm->q.rand_intvl,
|
||||
RM_EV_delay_timer_expire);
|
||||
return _SUCCESS;
|
||||
}
|
||||
break;
|
||||
case RM_EV_delay_timer_expire:
|
||||
rm_state_goto(prm, RM_ST_DO_MEAS);
|
||||
break;
|
||||
case RM_EV_cancel:
|
||||
rm_state_goto(prm, RM_ST_END);
|
||||
break;
|
||||
case RM_EV_state_out:
|
||||
rm_cancel_clock(prm);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
/* we do the measuring */
|
||||
static int rm_state_do_meas(struct rm_obj *prm, enum RM_EV_ID evid)
|
||||
{
|
||||
_adapter *padapter = prm->psta->padapter;
|
||||
u8 val8;
|
||||
u64 val64;
|
||||
|
||||
|
||||
switch (evid) {
|
||||
case RM_EV_state_in:
|
||||
if (prm->q.action_code == RM_ACT_RADIO_MEAS_REQ) {
|
||||
switch (prm->q.m_type) {
|
||||
case bcn_req:
|
||||
if (prm->q.m_mode == bcn_req_bcn_table) {
|
||||
RTW_INFO("RM: rmid=%x Beacon table\n",
|
||||
prm->rmid);
|
||||
_rm_post_event(padapter, prm->rmid,
|
||||
RM_EV_survey_done);
|
||||
return _SUCCESS;
|
||||
}
|
||||
break;
|
||||
case ch_load_req:
|
||||
case noise_histo_req:
|
||||
if (prm->poll_mode)
|
||||
_rm_post_event(padapter, prm->rmid,
|
||||
RM_EV_survey_done);
|
||||
return _SUCCESS;
|
||||
default:
|
||||
rm_state_goto(prm, RM_ST_END);
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
if (!ready_for_scan(prm)) {
|
||||
prm->wait_busy = RM_BUSY_TRAFFIC_TIMES;
|
||||
RTW_INFO("RM: wait busy traffic - %d\n",
|
||||
prm->wait_busy);
|
||||
rm_set_clock(prm, RM_WAIT_BUSY_TIMEOUT,
|
||||
RM_EV_busy_timer_expire);
|
||||
return _SUCCESS;
|
||||
}
|
||||
}
|
||||
_rm_post_event(padapter, prm->rmid, RM_EV_start_meas);
|
||||
break;
|
||||
case RM_EV_start_meas:
|
||||
if (prm->q.action_code == RM_ACT_RADIO_MEAS_REQ) {
|
||||
/* resotre measurement start time */
|
||||
prm->meas_start_time = rtw_hal_get_tsftr_by_port(padapter
|
||||
, rtw_hal_get_port(padapter));
|
||||
|
||||
switch (prm->q.m_type) {
|
||||
case bcn_req:
|
||||
val8 = 1; /* Enable free run counter */
|
||||
rtw_hal_set_hwreg(padapter,
|
||||
HW_VAR_FREECNT, &val8);
|
||||
rm_sitesurvey(prm);
|
||||
break;
|
||||
case ch_load_req:
|
||||
case noise_histo_req:
|
||||
rm_sitesurvey(prm);
|
||||
break;
|
||||
default:
|
||||
rm_state_goto(prm, RM_ST_END);
|
||||
return _SUCCESS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* handle measurement timeout */
|
||||
rm_set_clock(prm, RM_MEAS_TIMEOUT, RM_EV_meas_timer_expire);
|
||||
break;
|
||||
case RM_EV_survey_done:
|
||||
if (prm->q.action_code == RM_ACT_RADIO_MEAS_REQ) {
|
||||
switch (prm->q.m_type) {
|
||||
case bcn_req:
|
||||
rm_cancel_clock(prm);
|
||||
rm_state_goto(prm, RM_ST_SEND_REPORT);
|
||||
return _SUCCESS;
|
||||
case ch_load_req:
|
||||
case noise_histo_req:
|
||||
retrieve_radio_meas_result(prm);
|
||||
|
||||
if (rm_radio_meas_report_cond(prm) == _SUCCESS)
|
||||
rm_state_goto(prm, RM_ST_SEND_REPORT);
|
||||
else
|
||||
rm_set_clock(prm, RM_COND_INTVL,
|
||||
RM_EV_retry_timer_expire);
|
||||
break;
|
||||
default:
|
||||
rm_state_goto(prm, RM_ST_END);
|
||||
return _SUCCESS;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RM_EV_meas_timer_expire:
|
||||
RTW_INFO("RM: rmid=%x measurement timeount\n",prm->rmid);
|
||||
rm_set_rep_mode(prm, MEAS_REP_MOD_REFUSE);
|
||||
issue_null_reply(prm);
|
||||
rm_state_goto(prm, RM_ST_END);
|
||||
break;
|
||||
case RM_EV_busy_timer_expire:
|
||||
if (!ready_for_scan(prm) && prm->wait_busy--) {
|
||||
RTW_INFO("RM: wait busy - %d\n",prm->wait_busy);
|
||||
rm_set_clock(prm, RM_WAIT_BUSY_TIMEOUT,
|
||||
RM_EV_busy_timer_expire);
|
||||
break;
|
||||
}
|
||||
else if (prm->wait_busy <= 0) {
|
||||
RTW_INFO("RM: wait busy timeout\n");
|
||||
rm_set_rep_mode(prm, MEAS_REP_MOD_REFUSE);
|
||||
issue_null_reply(prm);
|
||||
rm_state_goto(prm, RM_ST_END);
|
||||
return _SUCCESS;
|
||||
}
|
||||
_rm_post_event(padapter, prm->rmid, RM_EV_start_meas);
|
||||
break;
|
||||
case RM_EV_request_timer_expire:
|
||||
rm_set_rep_mode(prm, MEAS_REP_MOD_REFUSE);
|
||||
issue_null_reply(prm);
|
||||
rm_state_goto(prm, RM_ST_END);
|
||||
break;
|
||||
case RM_EV_retry_timer_expire:
|
||||
/* expired due to meas condition mismatch, meas again */
|
||||
_rm_post_event(padapter, prm->rmid, RM_EV_start_meas);
|
||||
break;
|
||||
case RM_EV_cancel:
|
||||
rm_set_rep_mode(prm, MEAS_REP_MOD_REFUSE);
|
||||
issue_null_reply(prm);
|
||||
rm_state_goto(prm, RM_ST_END);
|
||||
break;
|
||||
case RM_EV_state_out:
|
||||
rm_cancel_clock(prm);
|
||||
/* resotre measurement end time */
|
||||
prm->meas_end_time = rtw_hal_get_tsftr_by_port(padapter
|
||||
, rtw_hal_get_port(padapter));
|
||||
|
||||
val8 = 0; /* Disable free run counter */
|
||||
rtw_hal_set_hwreg(padapter, HW_VAR_FREECNT, &val8);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
static int rm_state_wait_meas(struct rm_obj *prm, enum RM_EV_ID evid)
|
||||
{
|
||||
u8 val8;
|
||||
u64 val64;
|
||||
|
||||
|
||||
switch (evid) {
|
||||
case RM_EV_state_in:
|
||||
/* we create meas_req, waiting for peer report */
|
||||
rm_set_clock(prm, RM_REQ_TIMEOUT,
|
||||
RM_EV_request_timer_expire);
|
||||
break;
|
||||
case RM_EV_recv_rep:
|
||||
rm_state_goto(prm, RM_ST_RECV_REPORT);
|
||||
break;
|
||||
case RM_EV_request_timer_expire:
|
||||
case RM_EV_cancel:
|
||||
rm_state_goto(prm, RM_ST_END);
|
||||
break;
|
||||
case RM_EV_state_out:
|
||||
rm_cancel_clock(prm);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
static int rm_state_send_report(struct rm_obj *prm, enum RM_EV_ID evid)
|
||||
{
|
||||
u8 val8;
|
||||
|
||||
|
||||
switch (evid) {
|
||||
case RM_EV_state_in:
|
||||
/* we have to issue report */
|
||||
switch (prm->q.m_type) {
|
||||
case bcn_req:
|
||||
issue_beacon_rep(prm);
|
||||
break;
|
||||
case ch_load_req:
|
||||
case noise_histo_req:
|
||||
issue_radio_meas_rep(prm);
|
||||
break;
|
||||
default:
|
||||
rm_state_goto(prm, RM_ST_END);
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
/* check repeat */
|
||||
if (prm->p.rpt) {
|
||||
RTW_INFO("RM: rmid=%x repeat=%u/%u\n",
|
||||
prm->rmid, prm->p.rpt,
|
||||
prm->q.rpt);
|
||||
prm->p.rpt--;
|
||||
/*
|
||||
* we recv meas_req,
|
||||
* delay for a wihile and than meas again
|
||||
*/
|
||||
if (prm->poll_mode)
|
||||
rm_set_clock(prm, RM_REPT_POLL_INTVL,
|
||||
RM_EV_repeat_delay_expire);
|
||||
else
|
||||
rm_set_clock(prm, RM_REPT_SCAN_INTVL,
|
||||
RM_EV_repeat_delay_expire);
|
||||
return _SUCCESS;
|
||||
}
|
||||
/* we are done */
|
||||
rm_state_goto(prm, RM_ST_END);
|
||||
break;
|
||||
case RM_EV_repeat_delay_expire:
|
||||
rm_state_goto(prm, RM_ST_DO_MEAS);
|
||||
break;
|
||||
case RM_EV_cancel:
|
||||
rm_state_goto(prm, RM_ST_END);
|
||||
break;
|
||||
case RM_EV_state_out:
|
||||
rm_cancel_clock(prm);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
static int rm_state_recv_report(struct rm_obj *prm, enum RM_EV_ID evid)
|
||||
{
|
||||
u8 val8;
|
||||
|
||||
|
||||
switch (evid) {
|
||||
case RM_EV_state_in:
|
||||
/* we issue meas_req, got peer's meas report */
|
||||
switch (prm->p.action_code) {
|
||||
case RM_ACT_RADIO_MEAS_REP:
|
||||
/* check refuse, incapable and repeat */
|
||||
val8 = prm->p.m_mode;
|
||||
if (val8) {
|
||||
RTW_INFO("RM: rmid=%x peer reject (%s repeat=%d)\n",
|
||||
prm->rmid,
|
||||
val8|MEAS_REP_MOD_INCAP?"INCAP":
|
||||
val8|MEAS_REP_MOD_REFUSE?"REFUSE":
|
||||
val8|MEAS_REP_MOD_LATE?"LATE":"",
|
||||
prm->p.rpt);
|
||||
rm_state_goto(prm, RM_ST_END);
|
||||
return _SUCCESS;
|
||||
}
|
||||
break;
|
||||
case RM_ACT_NB_REP_RESP:
|
||||
/* report to upper layer if needing */
|
||||
rm_state_goto(prm, RM_ST_END);
|
||||
return _SUCCESS;
|
||||
default:
|
||||
rm_state_goto(prm, RM_ST_END);
|
||||
return _SUCCESS;
|
||||
}
|
||||
/* check repeat */
|
||||
if (prm->p.rpt) {
|
||||
RTW_INFO("RM: rmid=%x repeat=%u/%u\n",
|
||||
prm->rmid, prm->p.rpt,
|
||||
prm->q.rpt);
|
||||
prm->p.rpt--;
|
||||
/* waitting more report */
|
||||
rm_state_goto(prm, RM_ST_WAIT_MEAS);
|
||||
break;
|
||||
}
|
||||
/* we are done */
|
||||
rm_state_goto(prm, RM_ST_END);
|
||||
break;
|
||||
case RM_EV_cancel:
|
||||
rm_state_goto(prm, RM_ST_END);
|
||||
break;
|
||||
case RM_EV_state_out:
|
||||
rm_cancel_clock(prm);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
static int rm_state_end(struct rm_obj *prm, enum RM_EV_ID evid)
|
||||
{
|
||||
switch (evid) {
|
||||
case RM_EV_state_in:
|
||||
_rm_post_event(prm->psta->padapter, prm->rmid, RM_EV_state_out);
|
||||
break;
|
||||
|
||||
case RM_EV_cancel:
|
||||
case RM_EV_state_out:
|
||||
default:
|
||||
rm_free_rmobj(prm);
|
||||
break;
|
||||
}
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
struct fsm_state rm_fsm[] = {
|
||||
{"RM_ST_IDLE", rm_state_idle},
|
||||
{"RM_ST_DO_MEAS", rm_state_do_meas},
|
||||
{"RM_ST_WAIT_MEAS", rm_state_wait_meas},
|
||||
{"RM_ST_SEND_REPORT", rm_state_send_report},
|
||||
{"RM_ST_RECV_REPORT", rm_state_recv_report},
|
||||
{"RM_ST_END", rm_state_end}
|
||||
};
|
||||
|
||||
char *rm_state_name(enum RM_STATE state)
|
||||
{
|
||||
return rm_fsm[state].name;
|
||||
}
|
||||
|
||||
char *rm_event_name(enum RM_EV_ID evid)
|
||||
{
|
||||
switch(evid) {
|
||||
case RM_EV_state_in:
|
||||
return "RM_EV_state_in";
|
||||
case RM_EV_busy_timer_expire:
|
||||
return "RM_EV_busy_timer_expire";
|
||||
case RM_EV_delay_timer_expire:
|
||||
return "RM_EV_delay_timer_expire";
|
||||
case RM_EV_meas_timer_expire:
|
||||
return "RM_EV_meas_timer_expire";
|
||||
case RM_EV_repeat_delay_expire:
|
||||
return "RM_EV_repeat_delay_expire";
|
||||
case RM_EV_retry_timer_expire:
|
||||
return "RM_EV_retry_timer_expire";
|
||||
case RM_EV_request_timer_expire:
|
||||
return "RM_EV_request_timer_expire";
|
||||
case RM_EV_wait_report:
|
||||
return "RM_EV_wait_report";
|
||||
case RM_EV_start_meas:
|
||||
return "RM_EV_start_meas";
|
||||
case RM_EV_survey_done:
|
||||
return "RM_EV_survey_done";
|
||||
case RM_EV_recv_rep:
|
||||
return "RM_EV_recv_report";
|
||||
case RM_EV_cancel:
|
||||
return "RM_EV_cancel";
|
||||
case RM_EV_state_out:
|
||||
return "RM_EV_state_out";
|
||||
case RM_EV_max:
|
||||
return "RM_EV_max";
|
||||
default:
|
||||
return "RM_EV_unknown";
|
||||
}
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
static void rm_state_initial(struct rm_obj *prm)
|
||||
{
|
||||
prm->state = RM_ST_IDLE;
|
||||
|
||||
RTW_INFO("\n");
|
||||
RTW_INFO("RM: rmid=%x %-18s -> %s\n",prm->rmid,
|
||||
"new measurement", rm_fsm[prm->state].name);
|
||||
|
||||
rm_post_event(prm->psta->padapter, prm->rmid, RM_EV_state_in);
|
||||
}
|
||||
|
||||
static void rm_state_run(struct rm_obj *prm, enum RM_EV_ID evid)
|
||||
{
|
||||
RTW_INFO("RM: rmid=%x %-18s %s\n",prm->rmid,
|
||||
rm_fsm[prm->state].name,rm_event_name(evid));
|
||||
|
||||
rm_fsm[prm->state].fsm_func(prm, evid);
|
||||
}
|
||||
|
||||
static void rm_state_goto(struct rm_obj *prm, enum RM_STATE rm_state)
|
||||
{
|
||||
if (prm->state == rm_state)
|
||||
return;
|
||||
|
||||
rm_state_run(prm, RM_EV_state_out);
|
||||
|
||||
RTW_INFO("\n");
|
||||
RTW_INFO("RM: rmid=%x %-18s -> %s\n",prm->rmid,
|
||||
rm_fsm[prm->state].name, rm_fsm[rm_state].name);
|
||||
|
||||
prm->state = rm_state;
|
||||
rm_state_run(prm, RM_EV_state_in);
|
||||
}
|
||||
#endif /* CONFIG_RTW_80211K */
|
||||
@@ -1,588 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#define _RTW_RSON_C_
|
||||
|
||||
#include <drv_types.h>
|
||||
|
||||
#ifdef CONFIG_RTW_REPEATER_SON
|
||||
|
||||
/******** Custommize Part ***********************/
|
||||
|
||||
unsigned char RTW_RSON_OUI[] = {0xFA, 0xFA, 0xFA};
|
||||
#define RSON_SCORE_DIFF_TH 8
|
||||
|
||||
/*
|
||||
Calculate the corresponding score.
|
||||
*/
|
||||
inline u8 rtw_cal_rson_score(struct rtw_rson_struct *cand_rson_data, NDIS_802_11_RSSI Rssi)
|
||||
{
|
||||
if ((cand_rson_data->hopcnt == RTW_RSON_HC_NOTREADY)
|
||||
|| (cand_rson_data->connectible == RTW_RSON_DENYCONNECT))
|
||||
return RTW_RSON_SCORE_NOTCNNT;
|
||||
|
||||
return RTW_RSON_SCORE_MAX - (cand_rson_data->hopcnt * 10) + (Rssi/10);
|
||||
}
|
||||
|
||||
/*************************************************/
|
||||
|
||||
|
||||
static u8 rtw_rson_block_bssid_idx = 0;
|
||||
u8 rtw_rson_block_bssid[10][6] = {
|
||||
/*{0x02, 0xE0, 0x4C, 0x07, 0xC3, 0xF6}*/
|
||||
};
|
||||
|
||||
/* fake root, regard a real AP as a SO root */
|
||||
static u8 rtw_rson_root_bssid_idx = 0;
|
||||
u8 rtw_rson_root_bssid[10][6] = {
|
||||
/*{0x1c, 0x5f, 0x2b, 0x5a, 0x60, 0x24}*/
|
||||
};
|
||||
|
||||
int is_match_bssid(u8 *mac, u8 bssid_array[][6], int num)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < num; i++)
|
||||
if (_rtw_memcmp(mac, bssid_array[i], 6) == _TRUE)
|
||||
return _TRUE;
|
||||
return _FALSE;
|
||||
}
|
||||
|
||||
void init_rtw_rson_data(struct dvobj_priv *dvobj)
|
||||
{
|
||||
/*Aries todo. if pdvobj->rson_data.ver == 1 */
|
||||
dvobj->rson_data.ver = RTW_RSON_VER;
|
||||
dvobj->rson_data.id = CONFIG_RTW_REPEATER_SON_ID;
|
||||
#ifdef CONFIG_RTW_REPEATER_SON_ROOT
|
||||
dvobj->rson_data.hopcnt = RTW_RSON_HC_ROOT;
|
||||
dvobj->rson_data.connectible = RTW_RSON_ALLOWCONNECT;
|
||||
#else
|
||||
dvobj->rson_data.hopcnt = RTW_RSON_HC_NOTREADY;
|
||||
dvobj->rson_data.connectible = RTW_RSON_DENYCONNECT;
|
||||
#endif
|
||||
dvobj->rson_data.loading = 0;
|
||||
_rtw_memset(dvobj->rson_data.res, 0xAA, sizeof(dvobj->rson_data.res));
|
||||
}
|
||||
|
||||
void rtw_rson_get_property_str(_adapter *padapter, char *rson_data_str)
|
||||
{
|
||||
struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter);
|
||||
|
||||
sprintf(rson_data_str, "version : \t%d\nid : \t\t%08x\nhop count : \t%d\nconnectible : \t%s\nloading : \t%d\nreserve : \t%16ph\n",
|
||||
pdvobj->rson_data.ver,
|
||||
pdvobj->rson_data.id,
|
||||
pdvobj->rson_data.hopcnt,
|
||||
pdvobj->rson_data.connectible ? "connectable":"unconnectable",
|
||||
pdvobj->rson_data.loading,
|
||||
pdvobj->rson_data.res);
|
||||
}
|
||||
|
||||
int str2hexbuf(char *str, u8 *hexbuf, int len)
|
||||
{
|
||||
u8 *p;
|
||||
int i, slen, idx = 0;
|
||||
|
||||
p = (unsigned char *)str;
|
||||
if ((*p != '0') || (*(p+1) != 'x'))
|
||||
return _FALSE;
|
||||
slen = strlen(str);
|
||||
if (slen > (len*2) + 2)
|
||||
return _FALSE;
|
||||
p += 2;
|
||||
for (i = 0 ; i < len; i++, idx = idx+2) {
|
||||
hexbuf[i] = key_2char2num(p[idx], p[idx + 1]);
|
||||
if (slen <= idx+2)
|
||||
break;
|
||||
}
|
||||
return _TRUE;
|
||||
}
|
||||
|
||||
int rtw_rson_set_property(_adapter *padapter, char *field, char *value)
|
||||
{
|
||||
struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter);
|
||||
int num = 0;
|
||||
|
||||
if (_rtw_memcmp(field, (u8 *)"ver", 3) == _TRUE)
|
||||
pdvobj->rson_data.ver = rtw_atoi(value);
|
||||
else if (_rtw_memcmp(field, (u8 *)"id", 2) == _TRUE)
|
||||
num = sscanf(value, "%08x", &(pdvobj->rson_data.id));
|
||||
else if (_rtw_memcmp(field, (u8 *)"hc", 2) == _TRUE)
|
||||
num = sscanf(value, "%hhu", &(pdvobj->rson_data.hopcnt));
|
||||
else if (_rtw_memcmp(field, (u8 *)"cnt", 3) == _TRUE)
|
||||
num = sscanf(value, "%hhu", &(pdvobj->rson_data.connectible));
|
||||
else if (_rtw_memcmp(field, (u8 *)"loading", 2) == _TRUE)
|
||||
num = sscanf(value, "%hhu", &(pdvobj->rson_data.loading));
|
||||
else if (_rtw_memcmp(field, (u8 *)"res", 2) == _TRUE) {
|
||||
str2hexbuf(value, pdvobj->rson_data.res, 16);
|
||||
return 1;
|
||||
} else
|
||||
return _FALSE;
|
||||
return num;
|
||||
}
|
||||
|
||||
/*
|
||||
return : TRUE -- competitor is taking advantage than condidate
|
||||
FALSE -- we should continue keeping candidate
|
||||
*/
|
||||
int rtw_rson_choose(struct wlan_network **candidate, struct wlan_network *competitor)
|
||||
{
|
||||
s16 comp_score = 0, cand_score = 0;
|
||||
struct rtw_rson_struct rson_cand, rson_comp;
|
||||
|
||||
if (is_match_bssid(competitor->network.MacAddress, rtw_rson_block_bssid, rtw_rson_block_bssid_idx) == _TRUE)
|
||||
return _FALSE;
|
||||
|
||||
if ((competitor == NULL)
|
||||
|| (rtw_get_rson_struct(&(competitor->network), &rson_comp) != _TRUE)
|
||||
|| (rson_comp.id != CONFIG_RTW_REPEATER_SON_ID))
|
||||
return _FALSE;
|
||||
|
||||
comp_score = rtw_cal_rson_score(&rson_comp, competitor->network.Rssi);
|
||||
if (comp_score == RTW_RSON_SCORE_NOTCNNT)
|
||||
return _FALSE;
|
||||
|
||||
if (*candidate == NULL)
|
||||
return _TRUE;
|
||||
if (rtw_get_rson_struct(&((*candidate)->network), &rson_cand) != _TRUE)
|
||||
return _FALSE;
|
||||
|
||||
cand_score = rtw_cal_rson_score(&rson_cand, (*candidate)->network.Rssi);
|
||||
RTW_INFO("%s: competitor_score=%d, candidate_score=%d\n", __func__, comp_score, cand_score);
|
||||
if (comp_score - cand_score > RSON_SCORE_DIFF_TH)
|
||||
return _TRUE;
|
||||
|
||||
return _FALSE;
|
||||
}
|
||||
|
||||
inline u8 rtw_rson_varify_ie(u8 *p)
|
||||
{
|
||||
u8 *ptr = NULL;
|
||||
u8 ver;
|
||||
u32 id;
|
||||
u8 hopcnt;
|
||||
u8 allcnnt;
|
||||
|
||||
ptr = p + 2 + sizeof(RTW_RSON_OUI);
|
||||
ver = *ptr;
|
||||
|
||||
/* for (ver == 1) */
|
||||
if (ver != 1)
|
||||
return _FALSE;
|
||||
|
||||
return _TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
Parsing RTK self-organization vendor IE
|
||||
*/
|
||||
int rtw_get_rson_struct(WLAN_BSSID_EX *bssid, struct rtw_rson_struct *rson_data)
|
||||
{
|
||||
sint limit = 0;
|
||||
u32 len;
|
||||
u8 *p;
|
||||
|
||||
if ((rson_data == NULL) || (bssid == NULL))
|
||||
return -EINVAL;
|
||||
|
||||
/* Default */
|
||||
rson_data->id = 0;
|
||||
rson_data->ver = 0;
|
||||
rson_data->hopcnt = 0;
|
||||
rson_data->connectible = 0;
|
||||
rson_data->loading = 0;
|
||||
/* fake root */
|
||||
if (is_match_bssid(bssid->MacAddress, rtw_rson_root_bssid, rtw_rson_root_bssid_idx) == _TRUE) {
|
||||
rson_data->id = CONFIG_RTW_REPEATER_SON_ID;
|
||||
rson_data->ver = RTW_RSON_VER;
|
||||
rson_data->hopcnt = RTW_RSON_HC_ROOT;
|
||||
rson_data->connectible = RTW_RSON_ALLOWCONNECT;
|
||||
rson_data->loading = 0;
|
||||
return _TRUE;
|
||||
}
|
||||
limit = bssid->IELength - _BEACON_IE_OFFSET_;
|
||||
|
||||
for (p = bssid->IEs + _BEACON_IE_OFFSET_; ; p += (len + 2)) {
|
||||
p = rtw_get_ie(p, _VENDOR_SPECIFIC_IE_, &len, limit);
|
||||
limit -= len;
|
||||
if ((p == NULL) || (len == 0))
|
||||
break;
|
||||
if (p && (_rtw_memcmp(p + 2, RTW_RSON_OUI, sizeof(RTW_RSON_OUI)) == _TRUE)
|
||||
&& rtw_rson_varify_ie(p)) {
|
||||
p = p + 2 + sizeof(RTW_RSON_OUI);
|
||||
rson_data->ver = *p;
|
||||
/* for (ver == 1) */
|
||||
p = p + 1;
|
||||
rson_data->id = le32_to_cpup((__le32 *)p);
|
||||
p = p + 4;
|
||||
rson_data->hopcnt = *p;
|
||||
p = p + 1;
|
||||
rson_data->connectible = *p;
|
||||
p = p + 1;
|
||||
rson_data->loading = *p;
|
||||
|
||||
return _TRUE;
|
||||
}
|
||||
}
|
||||
return -EBADMSG;
|
||||
}
|
||||
|
||||
u32 rtw_rson_append_ie(_adapter *padapter, unsigned char *pframe, u32 *len)
|
||||
{
|
||||
u8 *ptr, *ori, ie_len = 0;
|
||||
struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter);
|
||||
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
|
||||
/* static int iii = 0;*/
|
||||
|
||||
if ((!pdvobj) || (!pframe))
|
||||
return 0;
|
||||
ptr = ori = pframe;
|
||||
*ptr++ = _VENDOR_SPECIFIC_IE_;
|
||||
*ptr++ = ie_len = sizeof(RTW_RSON_OUI)+sizeof(pdvobj->rson_data);
|
||||
_rtw_memcpy(ptr, RTW_RSON_OUI, sizeof(RTW_RSON_OUI));
|
||||
ptr = ptr + sizeof(RTW_RSON_OUI);
|
||||
*ptr++ = pdvobj->rson_data.ver;
|
||||
*(s32 *)ptr = cpu_to_le32(pdvobj->rson_data.id);
|
||||
ptr = ptr + sizeof(pdvobj->rson_data.id);
|
||||
*ptr++ = pdvobj->rson_data.hopcnt;
|
||||
*ptr++ = pdvobj->rson_data.connectible;
|
||||
*ptr++ = pdvobj->rson_data.loading;
|
||||
_rtw_memcpy(ptr, pdvobj->rson_data.res, sizeof(pdvobj->rson_data.res));
|
||||
pframe = ptr;
|
||||
/*
|
||||
iii = iii % 20;
|
||||
if (iii++ == 0)
|
||||
RTW_INFO("%s : RTW RSON IE : %20ph\n", __func__, ori);
|
||||
*/
|
||||
*len += (ie_len+2);
|
||||
return ie_len;
|
||||
|
||||
}
|
||||
|
||||
void rtw_rson_do_disconnect(_adapter *padapter)
|
||||
{
|
||||
struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter);
|
||||
|
||||
RTW_INFO(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
|
||||
#ifndef CONFIG_RTW_REPEATER_SON_ROOT
|
||||
pdvobj->rson_data.ver = RTW_RSON_VER;
|
||||
pdvobj->rson_data.id = CONFIG_RTW_REPEATER_SON_ID;
|
||||
pdvobj->rson_data.hopcnt = RTW_RSON_HC_NOTREADY;
|
||||
pdvobj->rson_data.connectible = RTW_RSON_DENYCONNECT;
|
||||
pdvobj->rson_data.loading = 0;
|
||||
rtw_mi_tx_beacon_hdl(padapter);
|
||||
#endif
|
||||
}
|
||||
|
||||
void rtw_rson_join_done(_adapter *padapter)
|
||||
{
|
||||
struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter);
|
||||
WLAN_BSSID_EX *cur_network = NULL;
|
||||
struct rtw_rson_struct rson_data;
|
||||
|
||||
RTW_INFO(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
|
||||
if (!padapter->mlmepriv.cur_network_scanned)
|
||||
return;
|
||||
cur_network = &(padapter->mlmepriv.cur_network_scanned->network);
|
||||
if (rtw_get_rson_struct(cur_network, &rson_data) != _TRUE) {
|
||||
RTW_ERR("%s: try to join a improper network(%s)\n", __func__, cur_network->Ssid.Ssid);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_RTW_REPEATER_SON_ROOT
|
||||
/* update rson_data */
|
||||
pdvobj->rson_data.ver = RTW_RSON_VER;
|
||||
pdvobj->rson_data.id = rson_data.id;
|
||||
pdvobj->rson_data.hopcnt = rson_data.hopcnt + 1;
|
||||
pdvobj->rson_data.connectible = RTW_RSON_ALLOWCONNECT;
|
||||
pdvobj->rson_data.loading = 0;
|
||||
rtw_mi_tx_beacon_hdl(padapter);
|
||||
#endif
|
||||
}
|
||||
|
||||
int rtw_rson_isupdate_roamcan(struct mlme_priv *mlme
|
||||
, struct wlan_network **candidate, struct wlan_network *competitor)
|
||||
{
|
||||
struct rtw_rson_struct rson_cand, rson_comp, rson_curr;
|
||||
s16 comp_score, cand_score, curr_score;
|
||||
|
||||
if ((competitor == NULL)
|
||||
|| (rtw_get_rson_struct(&(competitor->network), &rson_comp) != _TRUE)
|
||||
|| (rson_comp.id != CONFIG_RTW_REPEATER_SON_ID))
|
||||
return _FALSE;
|
||||
|
||||
if (is_match_bssid(competitor->network.MacAddress, rtw_rson_block_bssid, rtw_rson_block_bssid_idx) == _TRUE)
|
||||
return _FALSE;
|
||||
|
||||
if ((!mlme->cur_network_scanned)
|
||||
|| (mlme->cur_network_scanned == competitor)
|
||||
|| (rtw_get_rson_struct(&(mlme->cur_network_scanned->network), &rson_curr)) != _TRUE)
|
||||
return _FALSE;
|
||||
|
||||
if (rtw_get_passing_time_ms((u32)competitor->last_scanned) >= mlme->roam_scanr_exp_ms)
|
||||
return _FALSE;
|
||||
|
||||
comp_score = rtw_cal_rson_score(&rson_comp, competitor->network.Rssi);
|
||||
curr_score = rtw_cal_rson_score(&rson_curr, mlme->cur_network_scanned->network.Rssi);
|
||||
if (comp_score - curr_score < RSON_SCORE_DIFF_TH)
|
||||
return _FALSE;
|
||||
|
||||
if (*candidate == NULL)
|
||||
return _TRUE;
|
||||
|
||||
if (rtw_get_rson_struct(&((*candidate)->network), &rson_cand) != _TRUE) {
|
||||
RTW_ERR("%s : Unable to get rson_struct from candidate(%s -- " MAC_FMT")\n",
|
||||
__func__, (*candidate)->network.Ssid.Ssid, MAC_ARG((*candidate)->network.MacAddress));
|
||||
return _FALSE;
|
||||
}
|
||||
cand_score = rtw_cal_rson_score(&rson_cand, (*candidate)->network.Rssi);
|
||||
RTW_DBG("comp_score=%d , cand_score=%d , curr_score=%d\n", comp_score, cand_score, curr_score);
|
||||
if (cand_score < comp_score)
|
||||
return _TRUE;
|
||||
|
||||
#if 0 /* Handle 11R protocol */
|
||||
#ifdef CONFIG_RTW_80211R
|
||||
if (rtw_chk_ft_flags(adapter, RTW_FT_SUPPORTED)) {
|
||||
ptmp = rtw_get_ie(&competitor->network.IEs[12], _MDIE_, &mdie_len, competitor->network.IELength-12);
|
||||
if (ptmp) {
|
||||
if (!_rtw_memcmp(&pftpriv->mdid, ptmp+2, 2))
|
||||
goto exit;
|
||||
|
||||
/*The candidate don't support over-the-DS*/
|
||||
if (rtw_chk_ft_flags(adapter, RTW_FT_STA_OVER_DS_SUPPORTED)) {
|
||||
if ((rtw_chk_ft_flags(adapter, RTW_FT_OVER_DS_SUPPORTED) && !(*(ptmp+4) & 0x01)) ||
|
||||
(!rtw_chk_ft_flags(adapter, RTW_FT_OVER_DS_SUPPORTED) && (*(ptmp+4) & 0x01))) {
|
||||
RTW_INFO("FT: ignore the candidate(" MAC_FMT ") for over-the-DS\n", MAC_ARG(competitor->network.MacAddress));
|
||||
rtw_clr_ft_flags(adapter, RTW_FT_OVER_DS_SUPPORTED);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
} else
|
||||
goto exit;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return _FALSE;
|
||||
}
|
||||
|
||||
void rtw_rson_show_survey_info(struct seq_file *m, _list *plist, _list *phead)
|
||||
{
|
||||
struct wlan_network *pnetwork = NULL;
|
||||
struct rtw_rson_struct rson_data;
|
||||
s16 rson_score;
|
||||
u16 index = 0;
|
||||
|
||||
RTW_PRINT_SEL(m, "%5s %-17s %3s %5s %14s %10s %-3s %5s %32s\n", "index", "bssid", "ch", "id", "hop_cnt", "loading", "RSSI", "score", "ssid");
|
||||
while (1) {
|
||||
if (rtw_end_of_queue_search(phead, plist) == _TRUE)
|
||||
break;
|
||||
|
||||
pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list);
|
||||
if (!pnetwork)
|
||||
break;
|
||||
|
||||
_rtw_memset(&rson_data, 0, sizeof(rson_data));
|
||||
rson_score = 0;
|
||||
if (rtw_get_rson_struct(&(pnetwork->network), &rson_data) == _TRUE)
|
||||
rson_score = rtw_cal_rson_score(&rson_data, pnetwork->network.Rssi);
|
||||
RTW_PRINT_SEL(m, "%5d "MAC_FMT" %3d 0x%08x %6d %10d %6d %6d %32s\n",
|
||||
++index,
|
||||
MAC_ARG(pnetwork->network.MacAddress),
|
||||
pnetwork->network.Configuration.DSConfig,
|
||||
rson_data.id,
|
||||
rson_data.hopcnt,
|
||||
rson_data.loading,
|
||||
(int)pnetwork->network.Rssi,
|
||||
rson_score,
|
||||
pnetwork->network.Ssid.Ssid);
|
||||
plist = get_next(plist);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
Description : As a AP role, We need to check the qualify of associating STA.
|
||||
We also need to check if we are ready to be associated.
|
||||
|
||||
return : TRUE -- AP REJECT this STA
|
||||
FALSE -- AP ACCEPT this STA
|
||||
*/
|
||||
u8 rtw_rson_ap_check_sta(_adapter *padapter, u8 *pframe, uint pkt_len, unsigned short ie_offset)
|
||||
{
|
||||
struct wlan_network *pnetwork = NULL;
|
||||
struct rtw_rson_struct rson_target;
|
||||
struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter);
|
||||
int len = 0;
|
||||
u8 ret = _FALSE;
|
||||
u8 *p;
|
||||
|
||||
#ifndef CONFIG_RTW_REPEATER_SON_ROOT
|
||||
_rtw_memset(&rson_target, 0, sizeof(rson_target));
|
||||
for (p = pframe + WLAN_HDR_A3_LEN + ie_offset; ; p += (len + 2)) {
|
||||
p = rtw_get_ie(p, _VENDOR_SPECIFIC_IE_, &len, pkt_len - WLAN_HDR_A3_LEN - ie_offset);
|
||||
|
||||
if ((p == NULL) || (len == 0))
|
||||
break;
|
||||
|
||||
if (p && (_rtw_memcmp(p + 2, RTW_RSON_OUI, sizeof(RTW_RSON_OUI)) == _TRUE)
|
||||
&& rtw_rson_varify_ie(p)) {
|
||||
p = p + 2 + sizeof(RTW_RSON_OUI);
|
||||
rson_target.ver = *p;
|
||||
/* for (ver == 1) */
|
||||
p = p + 1;
|
||||
rson_target.id = le32_to_cpup((__le32 *)p);
|
||||
p = p + 4;
|
||||
rson_target.hopcnt = *p;
|
||||
p = p + 1;
|
||||
rson_target.connectible = *p;
|
||||
p = p + 1;
|
||||
rson_target.loading = *p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (rson_target.id == 0) /* Normal STA, not a RSON STA */
|
||||
ret = _FALSE;
|
||||
else if (rson_target.id != pdvobj->rson_data.id) {
|
||||
ret = _TRUE;
|
||||
RTW_INFO("%s : Reject AssoReq because RSON ID not match, STA=%08x, our=%08x\n",
|
||||
__func__, rson_target.id, pdvobj->rson_data.id);
|
||||
} else if ((pdvobj->rson_data.hopcnt == RTW_RSON_HC_NOTREADY)
|
||||
|| (pdvobj->rson_data.connectible == RTW_RSON_DENYCONNECT)) {
|
||||
ret = _TRUE;
|
||||
RTW_INFO("%s : Reject AssoReq becuase our hopcnt=%d or connectbile=%d\n",
|
||||
__func__, pdvobj->rson_data.hopcnt, pdvobj->rson_data.connectible);
|
||||
}
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
u8 rtw_rson_scan_wk_cmd(_adapter *padapter, int op)
|
||||
{
|
||||
struct cmd_obj *ph2c;
|
||||
struct drvextra_cmd_parm *pdrvextra_cmd_parm;
|
||||
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
|
||||
u8 *extra_cmd_buf;
|
||||
u8 res = _SUCCESS;
|
||||
|
||||
ph2c = (struct cmd_obj *)rtw_zmalloc(sizeof(struct cmd_obj));
|
||||
if (ph2c == NULL) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
pdrvextra_cmd_parm = (struct drvextra_cmd_parm *)rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
|
||||
if (pdrvextra_cmd_parm == NULL) {
|
||||
rtw_mfree((u8 *)ph2c, sizeof(struct cmd_obj));
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
pdrvextra_cmd_parm->ec_id = RSON_SCAN_WK_CID;
|
||||
pdrvextra_cmd_parm->type = op;
|
||||
pdrvextra_cmd_parm->size = 0;
|
||||
pdrvextra_cmd_parm->pbuf = NULL;
|
||||
|
||||
init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));
|
||||
|
||||
res = rtw_enqueue_cmd(pcmdpriv, ph2c);
|
||||
|
||||
exit:
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
void rtw_rson_scan_cmd_hdl(_adapter *padapter, int op)
|
||||
{
|
||||
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
u8 val8;
|
||||
|
||||
if (mlmeext_chk_scan_state(pmlmeext, SCAN_DISABLE) != _TRUE)
|
||||
return;
|
||||
if (op == RSON_SCAN_PROCESS) {
|
||||
padapter->rtw_rson_scanstage = RSON_SCAN_PROCESS;
|
||||
val8 = 0x1e;
|
||||
rtw_hal_set_odm_var(padapter, HAL_ODM_INITIAL_GAIN, &val8, _FALSE);
|
||||
val8 = 1;
|
||||
rtw_hal_set_hwreg(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8));
|
||||
issue_probereq(padapter, NULL, NULL);
|
||||
/* stop rson_scan after 100ms */
|
||||
_set_timer(&(pmlmeext->rson_scan_timer), 100);
|
||||
} else if (op == RSON_SCAN_DISABLE) {
|
||||
padapter->rtw_rson_scanstage = RSON_SCAN_DISABLE;
|
||||
val8 = 0;
|
||||
rtw_hal_set_hwreg(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8));
|
||||
val8 = 0xff;
|
||||
rtw_hal_set_odm_var(padapter, HAL_ODM_INITIAL_GAIN, &val8, _FALSE);
|
||||
/* report_surveydone_event(padapter);*/
|
||||
if (pmlmepriv->to_join == _TRUE) {
|
||||
if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) != _TRUE) {
|
||||
int s_ret;
|
||||
|
||||
set_fwstate(pmlmepriv, _FW_UNDER_LINKING);
|
||||
pmlmepriv->to_join = _FALSE;
|
||||
s_ret = rtw_select_and_join_from_scanned_queue(pmlmepriv);
|
||||
if (s_ret == _SUCCESS)
|
||||
_set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT);
|
||||
else if (s_ret == 2) {
|
||||
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
|
||||
rtw_indicate_connect(padapter);
|
||||
} else {
|
||||
RTW_INFO("try_to_join, but select scanning queue fail, to_roam:%d\n", rtw_to_roam(padapter));
|
||||
if (rtw_to_roam(padapter) != 0) {
|
||||
if (rtw_dec_to_roam(padapter) == 0) {
|
||||
rtw_set_to_roam(padapter, 0);
|
||||
rtw_free_assoc_resources(padapter, _TRUE);
|
||||
rtw_indicate_disconnect(padapter, 0, _FALSE);
|
||||
} else
|
||||
pmlmepriv->to_join = _TRUE;
|
||||
} else
|
||||
rtw_indicate_disconnect(padapter, 0, _FALSE);
|
||||
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (rtw_chk_roam_flags(padapter, RTW_ROAM_ACTIVE)) {
|
||||
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)
|
||||
&& check_fwstate(pmlmepriv, _FW_LINKED)) {
|
||||
if (rtw_select_roaming_candidate(pmlmepriv) == _SUCCESS) {
|
||||
#ifdef CONFIG_RTW_80211R
|
||||
if (rtw_chk_ft_flags(padapter, RTW_FT_OVER_DS_SUPPORTED)) {
|
||||
start_clnt_ft_action(adapter, (u8 *)pmlmepriv->roam_network->network.MacAddress);
|
||||
} else {
|
||||
/*wait a little time to retrieve packets buffered in the current ap while scan*/
|
||||
_set_timer(&pmlmeext->ft_roam_timer, 30);
|
||||
}
|
||||
#else
|
||||
receive_disconnect(padapter, pmlmepriv->cur_network.network.MacAddress
|
||||
, WLAN_REASON_ACTIVE_ROAM, _FALSE);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
issue_action_BSSCoexistPacket(padapter);
|
||||
issue_action_BSSCoexistPacket(padapter);
|
||||
issue_action_BSSCoexistPacket(padapter);
|
||||
}
|
||||
} else {
|
||||
RTW_ERR("%s : improper parameter -- op = %d\n", __func__, op);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_RTW_REPEATER_SON */
|
||||
@@ -1,130 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2015 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define _RTW_SDIO_C_
|
||||
|
||||
#include <drv_types.h> /* struct dvobj_priv and etc. */
|
||||
#include <drv_types_sdio.h> /* RTW_SDIO_ADDR_CMD52_GEN */
|
||||
|
||||
/*
|
||||
* Description:
|
||||
* Use SDIO cmd52 or cmd53 to read/write data
|
||||
*
|
||||
* Parameters:
|
||||
* d pointer of device object(struct dvobj_priv)
|
||||
* addr SDIO address, 17 bits
|
||||
* buf buffer for I/O
|
||||
* len length
|
||||
* write 0:read, 1:write
|
||||
* cmd52 0:cmd52, 1:cmd53
|
||||
*
|
||||
* Return:
|
||||
* _SUCCESS I/O ok.
|
||||
* _FAIL I/O fail.
|
||||
*/
|
||||
static u8 sdio_io(struct dvobj_priv *d, u32 addr, void *buf, size_t len, u8 write, u8 cmd52)
|
||||
{
|
||||
u32 addr_drv; /* address with driver defined bit */
|
||||
int err;
|
||||
u8 retry = 0;
|
||||
u8 stop_retry = _FALSE; /* flag for stopping retry or not */
|
||||
|
||||
|
||||
if (rtw_is_surprise_removed(dvobj_get_primary_adapter(d))) {
|
||||
RTW_ERR("%s: bSurpriseRemoved, skip %s 0x%05x, %zu bytes\n",
|
||||
__FUNCTION__, write?"write":"read", addr, len);
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
addr_drv = addr;
|
||||
if (cmd52)
|
||||
addr_drv = RTW_SDIO_ADDR_CMD52_GEN(addr_drv);
|
||||
|
||||
do {
|
||||
if (write)
|
||||
err = d->intf_ops->write(d, addr_drv, buf, len, 0);
|
||||
else
|
||||
err = d->intf_ops->read(d, addr_drv, buf, len, 0);
|
||||
if (!err) {
|
||||
if (retry) {
|
||||
RTW_INFO("%s: Retry %s OK! addr=0x%05x %zu bytes, retry=%u,%u\n",
|
||||
__FUNCTION__, write?"write":"read",
|
||||
addr, len, retry, ATOMIC_READ(&d->continual_io_error));
|
||||
RTW_INFO_DUMP("Data: ", buf, len);
|
||||
}
|
||||
rtw_reset_continual_io_error(d);
|
||||
break;
|
||||
}
|
||||
RTW_ERR("%s: %s FAIL! error(%d) addr=0x%05x %zu bytes, retry=%u,%u\n",
|
||||
__FUNCTION__, write?"write":"read", err, addr, len,
|
||||
retry, ATOMIC_READ(&d->continual_io_error));
|
||||
|
||||
retry++;
|
||||
stop_retry = rtw_inc_and_chk_continual_io_error(d);
|
||||
if ((err == -1) || (stop_retry == _TRUE) || (retry > SD_IO_TRY_CNT)) {
|
||||
/* critical error, unrecoverable */
|
||||
RTW_ERR("%s: Fatal error! Set surprise remove flag ON! (retry=%u,%u)\n",
|
||||
__FUNCTION__, retry, ATOMIC_READ(&d->continual_io_error));
|
||||
rtw_set_surprise_removed(dvobj_get_primary_adapter(d));
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
/* WLAN IOREG or SDIO Local */
|
||||
if ((addr & 0x10000) || !(addr & 0xE000)) {
|
||||
RTW_WARN("%s: Retry %s addr=0x%05x %zu bytes, retry=%u,%u\n",
|
||||
__FUNCTION__, write?"write":"read", addr, len,
|
||||
retry, ATOMIC_READ(&d->continual_io_error));
|
||||
continue;
|
||||
}
|
||||
return _FAIL;
|
||||
} while (1);
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
u8 rtw_sdio_read_cmd52(struct dvobj_priv *d, u32 addr, void *buf, size_t len)
|
||||
{
|
||||
return sdio_io(d, addr, buf, len, 0, 1);
|
||||
}
|
||||
|
||||
u8 rtw_sdio_read_cmd53(struct dvobj_priv *d, u32 addr, void *buf, size_t len)
|
||||
{
|
||||
return sdio_io(d, addr, buf, len, 0, 0);
|
||||
}
|
||||
|
||||
u8 rtw_sdio_write_cmd52(struct dvobj_priv *d, u32 addr, void *buf, size_t len)
|
||||
{
|
||||
return sdio_io(d, addr, buf, len, 1, 1);
|
||||
}
|
||||
|
||||
u8 rtw_sdio_write_cmd53(struct dvobj_priv *d, u32 addr, void *buf, size_t len)
|
||||
{
|
||||
return sdio_io(d, addr, buf, len, 1, 0);
|
||||
}
|
||||
|
||||
u8 rtw_sdio_f0_read(struct dvobj_priv *d, u32 addr, void *buf, size_t len)
|
||||
{
|
||||
int err;
|
||||
u8 ret;
|
||||
|
||||
|
||||
ret = _SUCCESS;
|
||||
addr = RTW_SDIO_ADDR_F0_GEN(addr);
|
||||
|
||||
err = d->intf_ops->read(d, addr, buf, len, 0);
|
||||
if (err)
|
||||
ret = _FAIL;
|
||||
|
||||
return ret;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
* Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
@@ -11,301 +11,69 @@
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include <drv_types.h>
|
||||
#include <hal_data.h>
|
||||
#include <rtw_sreset.h>
|
||||
|
||||
void sreset_init_value(_adapter *padapter)
|
||||
void sreset_init_value(struct adapter *padapter)
|
||||
{
|
||||
#if defined(DBG_CONFIG_ERROR_DETECT)
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter);
|
||||
struct sreset_priv *psrtpriv = &pHalData->srestpriv;
|
||||
|
||||
_rtw_mutex_init(&psrtpriv->silentreset_mutex);
|
||||
psrtpriv->silent_reset_inprogress = _FALSE;
|
||||
psrtpriv->silent_reset_inprogress = false;
|
||||
psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
|
||||
psrtpriv->last_tx_time = 0;
|
||||
psrtpriv->last_tx_complete_time = 0;
|
||||
#endif
|
||||
}
|
||||
void sreset_reset_value(_adapter *padapter)
|
||||
void sreset_reset_value(struct adapter *padapter)
|
||||
{
|
||||
#if defined(DBG_CONFIG_ERROR_DETECT)
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter);
|
||||
struct sreset_priv *psrtpriv = &pHalData->srestpriv;
|
||||
|
||||
psrtpriv->silent_reset_inprogress = false;
|
||||
psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
|
||||
psrtpriv->last_tx_time = 0;
|
||||
psrtpriv->last_tx_complete_time = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
u8 sreset_get_wifi_status(_adapter *padapter)
|
||||
u8 sreset_get_wifi_status(struct adapter *padapter)
|
||||
{
|
||||
#if defined(DBG_CONFIG_ERROR_DETECT)
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter);
|
||||
struct sreset_priv *psrtpriv = &pHalData->srestpriv;
|
||||
|
||||
u8 status = WIFI_STATUS_SUCCESS;
|
||||
u32 val32 = 0;
|
||||
|
||||
if (psrtpriv->silent_reset_inprogress == _TRUE)
|
||||
if (psrtpriv->silent_reset_inprogress)
|
||||
return status;
|
||||
val32 = rtw_read32(padapter, REG_TXDMA_STATUS);
|
||||
if (val32 == 0xeaeaeaea)
|
||||
if (val32 == 0xeaeaeaea) {
|
||||
psrtpriv->Wifi_Error_Status = WIFI_IF_NOT_EXIST;
|
||||
else if (val32 != 0) {
|
||||
RTW_INFO("txdmastatu(%x)\n", val32);
|
||||
} else if (val32 != 0) {
|
||||
DBG_88E("txdmastatu(%x)\n", val32);
|
||||
psrtpriv->Wifi_Error_Status = WIFI_MAC_TXDMA_ERROR;
|
||||
}
|
||||
|
||||
if (WIFI_STATUS_SUCCESS != psrtpriv->Wifi_Error_Status) {
|
||||
RTW_INFO("==>%s error_status(0x%x)\n", __FUNCTION__, psrtpriv->Wifi_Error_Status);
|
||||
status = (psrtpriv->Wifi_Error_Status & (~(USB_READ_PORT_FAIL | USB_WRITE_PORT_FAIL)));
|
||||
DBG_88E("==>%s error_status(0x%x)\n", __func__, psrtpriv->Wifi_Error_Status);
|
||||
status = (psrtpriv->Wifi_Error_Status & (~(USB_READ_PORT_FAIL|USB_WRITE_PORT_FAIL)));
|
||||
}
|
||||
RTW_INFO("==> %s wifi_status(0x%x)\n", __FUNCTION__, status);
|
||||
DBG_88E("==> %s wifi_status(0x%x)\n", __func__, status);
|
||||
|
||||
/* status restore */
|
||||
psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
|
||||
|
||||
return status;
|
||||
#else
|
||||
return WIFI_STATUS_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
|
||||
void sreset_set_wifi_error_status(_adapter *padapter, u32 status)
|
||||
void sreset_set_wifi_error_status(struct adapter *padapter, u32 status)
|
||||
{
|
||||
#if defined(DBG_CONFIG_ERROR_DETECT)
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter);
|
||||
pHalData->srestpriv.Wifi_Error_Status = status;
|
||||
#endif
|
||||
}
|
||||
|
||||
void sreset_set_trigger_point(_adapter *padapter, s32 tgp)
|
||||
{
|
||||
#if defined(DBG_CONFIG_ERROR_DETECT)
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
pHalData->srestpriv.dbg_trigger_point = tgp;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool sreset_inprogress(_adapter *padapter)
|
||||
{
|
||||
#if defined(DBG_CONFIG_ERROR_RESET)
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
return pHalData->srestpriv.silent_reset_inprogress;
|
||||
#else
|
||||
return _FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
void sreset_restore_security_station(_adapter *padapter)
|
||||
{
|
||||
struct mlme_priv *mlmepriv = &padapter->mlmepriv;
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
struct sta_info *psta;
|
||||
struct mlme_ext_info *pmlmeinfo = &padapter->mlmeextpriv.mlmext_info;
|
||||
|
||||
{
|
||||
u8 val8;
|
||||
|
||||
if (pmlmeinfo->auth_algo == dot11AuthAlgrthm_8021X) {
|
||||
val8 = 0xcc;
|
||||
#ifdef CONFIG_WAPI_SUPPORT
|
||||
} else if (padapter->wapiInfo.bWapiEnable && pmlmeinfo->auth_algo == dot11AuthAlgrthm_WAPI) {
|
||||
/* Disable TxUseDefaultKey, RxUseDefaultKey, RxBroadcastUseDefaultKey. */
|
||||
val8 = 0x4c;
|
||||
#endif
|
||||
} else
|
||||
val8 = 0xcf;
|
||||
rtw_hal_set_hwreg(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8));
|
||||
}
|
||||
|
||||
if ((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) ||
|
||||
(padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) {
|
||||
psta = rtw_get_stainfo(pstapriv, get_bssid(mlmepriv));
|
||||
if (psta == NULL) {
|
||||
/* DEBUG_ERR( ("Set wpa_set_encryption: Obtain Sta_info fail\n")); */
|
||||
} else {
|
||||
/* pairwise key */
|
||||
rtw_setstakey_cmd(padapter, psta, UNICAST_KEY, _FALSE);
|
||||
/* group key */
|
||||
rtw_set_key(padapter, &padapter->securitypriv, padapter->securitypriv.dot118021XGrpKeyid, 0, _FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sreset_restore_network_station(_adapter *padapter)
|
||||
{
|
||||
struct mlme_priv *mlmepriv = &padapter->mlmepriv;
|
||||
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
|
||||
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
||||
u8 doiqk = _FALSE;
|
||||
|
||||
rtw_setopmode_cmd(padapter, Ndis802_11Infrastructure, RTW_CMDF_DIRECTLY);
|
||||
|
||||
{
|
||||
u8 threshold;
|
||||
#ifdef CONFIG_USB_HCI
|
||||
/* TH=1 => means that invalidate usb rx aggregation */
|
||||
/* TH=0 => means that validate usb rx aggregation, use init value. */
|
||||
#ifdef CONFIG_80211N_HT
|
||||
if (mlmepriv->htpriv.ht_option) {
|
||||
if (padapter->registrypriv.wifi_spec == 1)
|
||||
threshold = 1;
|
||||
else
|
||||
threshold = 0;
|
||||
rtw_hal_set_hwreg(padapter, HW_VAR_RXDMA_AGG_PG_TH, (u8 *)(&threshold));
|
||||
} else {
|
||||
threshold = 1;
|
||||
rtw_hal_set_hwreg(padapter, HW_VAR_RXDMA_AGG_PG_TH, (u8 *)(&threshold));
|
||||
}
|
||||
#endif /* CONFIG_80211N_HT */
|
||||
#endif
|
||||
}
|
||||
|
||||
doiqk = _TRUE;
|
||||
rtw_hal_set_hwreg(padapter, HW_VAR_DO_IQK , &doiqk);
|
||||
|
||||
set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode);
|
||||
|
||||
doiqk = _FALSE;
|
||||
rtw_hal_set_hwreg(padapter , HW_VAR_DO_IQK , &doiqk);
|
||||
/* disable dynamic functions, such as high power, DIG */
|
||||
/*rtw_phydm_func_disable_all(padapter);*/
|
||||
|
||||
rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, pmlmeinfo->network.MacAddress);
|
||||
|
||||
{
|
||||
u8 join_type = 0;
|
||||
|
||||
rtw_hal_rcr_set_chk_bssid(padapter, MLME_STA_CONNECTING);
|
||||
rtw_hal_set_hwreg(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type));
|
||||
}
|
||||
|
||||
Set_MSR(padapter, (pmlmeinfo->state & 0x3));
|
||||
|
||||
mlmeext_joinbss_event_callback(padapter, 1);
|
||||
/* restore Sequence No. */
|
||||
rtw_hal_set_hwreg(padapter, HW_VAR_RESTORE_HW_SEQ, 0);
|
||||
|
||||
sreset_restore_security_station(padapter);
|
||||
}
|
||||
|
||||
|
||||
void sreset_restore_network_status(_adapter *padapter)
|
||||
{
|
||||
struct mlme_priv *mlmepriv = &padapter->mlmepriv;
|
||||
|
||||
if (check_fwstate(mlmepriv, WIFI_STATION_STATE)) {
|
||||
RTW_INFO(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_STATION_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv));
|
||||
sreset_restore_network_station(padapter);
|
||||
} else if (MLME_IS_AP(padapter) || MLME_IS_MESH(padapter)) {
|
||||
RTW_INFO(FUNC_ADPT_FMT" %s\n", FUNC_ADPT_ARG(padapter), MLME_IS_AP(padapter) ? "AP" : "MESH");
|
||||
rtw_ap_restore_network(padapter);
|
||||
} else if (check_fwstate(mlmepriv, WIFI_ADHOC_STATE))
|
||||
RTW_INFO(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_ADHOC_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv));
|
||||
else
|
||||
RTW_INFO(FUNC_ADPT_FMT" fwstate:0x%08x - ???\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv));
|
||||
}
|
||||
|
||||
void sreset_stop_adapter(_adapter *padapter)
|
||||
{
|
||||
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
|
||||
if (padapter == NULL)
|
||||
return;
|
||||
|
||||
RTW_INFO(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
|
||||
|
||||
rtw_netif_stop_queue(padapter->pnetdev);
|
||||
|
||||
rtw_cancel_all_timer(padapter);
|
||||
|
||||
/* TODO: OS and HCI independent */
|
||||
#if defined(PLATFORM_LINUX) && defined(CONFIG_USB_HCI)
|
||||
tasklet_kill(&pxmitpriv->xmit_tasklet);
|
||||
#endif
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
|
||||
rtw_scan_abort(padapter);
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) {
|
||||
rtw_set_to_roam(padapter, 0);
|
||||
rtw_join_timeout_handler(padapter);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void sreset_start_adapter(_adapter *padapter)
|
||||
{
|
||||
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
|
||||
if (padapter == NULL)
|
||||
return;
|
||||
|
||||
RTW_INFO(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED))
|
||||
sreset_restore_network_status(padapter);
|
||||
|
||||
/* TODO: OS and HCI independent */
|
||||
#if defined(PLATFORM_LINUX) && defined(CONFIG_USB_HCI)
|
||||
tasklet_hi_schedule(&pxmitpriv->xmit_tasklet);
|
||||
#endif
|
||||
|
||||
if (is_primary_adapter(padapter))
|
||||
_set_timer(&adapter_to_dvobj(padapter)->dynamic_chk_timer, 2000);
|
||||
|
||||
rtw_netif_wake_queue(padapter->pnetdev);
|
||||
}
|
||||
|
||||
void sreset_reset(_adapter *padapter)
|
||||
{
|
||||
#ifdef DBG_CONFIG_ERROR_RESET
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
struct sreset_priv *psrtpriv = &pHalData->srestpriv;
|
||||
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
|
||||
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
_irqL irqL;
|
||||
systime start = rtw_get_current_time();
|
||||
struct dvobj_priv *psdpriv = padapter->dvobj;
|
||||
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
|
||||
|
||||
RTW_INFO("%s\n", __FUNCTION__);
|
||||
|
||||
psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
|
||||
|
||||
|
||||
#ifdef CONFIG_LPS
|
||||
rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "SRESET");
|
||||
#endif/* #ifdef CONFIG_LPS */
|
||||
|
||||
_enter_pwrlock(&pwrpriv->lock);
|
||||
|
||||
psrtpriv->silent_reset_inprogress = _TRUE;
|
||||
pwrpriv->change_rfpwrstate = rf_off;
|
||||
|
||||
rtw_mi_sreset_adapter_hdl(padapter, _FALSE);/*sreset_stop_adapter*/
|
||||
#ifdef CONFIG_IPS
|
||||
_ips_enter(padapter);
|
||||
_ips_leave(padapter);
|
||||
#endif
|
||||
rtw_mi_sreset_adapter_hdl(padapter, _TRUE);/*sreset_start_adapter*/
|
||||
|
||||
psrtpriv->silent_reset_inprogress = _FALSE;
|
||||
|
||||
_exit_pwrlock(&pwrpriv->lock);
|
||||
|
||||
RTW_INFO("%s done in %d ms\n", __FUNCTION__, rtw_get_passing_time_ms(start));
|
||||
pdbgpriv->dbg_sreset_cnt++;
|
||||
|
||||
psrtpriv->self_dect_fw = _FALSE;
|
||||
psrtpriv->rx_cnt = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,922 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2016 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifdef CONFIG_WAPI_SUPPORT
|
||||
|
||||
#include <linux/unistd.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <drv_types.h>
|
||||
#include <rtw_wapi.h>
|
||||
|
||||
|
||||
#ifdef CONFIG_WAPI_SW_SMS4
|
||||
|
||||
#define WAPI_LITTLE_ENDIAN
|
||||
/* #define BIG_ENDIAN */
|
||||
#define ENCRYPT 0
|
||||
#define DECRYPT 1
|
||||
|
||||
|
||||
/**********************************************************
|
||||
**********************************************************/
|
||||
const u8 Sbox[256] = {
|
||||
0xd6, 0x90, 0xe9, 0xfe, 0xcc, 0xe1, 0x3d, 0xb7, 0x16, 0xb6, 0x14, 0xc2, 0x28, 0xfb, 0x2c, 0x05,
|
||||
0x2b, 0x67, 0x9a, 0x76, 0x2a, 0xbe, 0x04, 0xc3, 0xaa, 0x44, 0x13, 0x26, 0x49, 0x86, 0x06, 0x99,
|
||||
0x9c, 0x42, 0x50, 0xf4, 0x91, 0xef, 0x98, 0x7a, 0x33, 0x54, 0x0b, 0x43, 0xed, 0xcf, 0xac, 0x62,
|
||||
0xe4, 0xb3, 0x1c, 0xa9, 0xc9, 0x08, 0xe8, 0x95, 0x80, 0xdf, 0x94, 0xfa, 0x75, 0x8f, 0x3f, 0xa6,
|
||||
0x47, 0x07, 0xa7, 0xfc, 0xf3, 0x73, 0x17, 0xba, 0x83, 0x59, 0x3c, 0x19, 0xe6, 0x85, 0x4f, 0xa8,
|
||||
0x68, 0x6b, 0x81, 0xb2, 0x71, 0x64, 0xda, 0x8b, 0xf8, 0xeb, 0x0f, 0x4b, 0x70, 0x56, 0x9d, 0x35,
|
||||
0x1e, 0x24, 0x0e, 0x5e, 0x63, 0x58, 0xd1, 0xa2, 0x25, 0x22, 0x7c, 0x3b, 0x01, 0x21, 0x78, 0x87,
|
||||
0xd4, 0x00, 0x46, 0x57, 0x9f, 0xd3, 0x27, 0x52, 0x4c, 0x36, 0x02, 0xe7, 0xa0, 0xc4, 0xc8, 0x9e,
|
||||
0xea, 0xbf, 0x8a, 0xd2, 0x40, 0xc7, 0x38, 0xb5, 0xa3, 0xf7, 0xf2, 0xce, 0xf9, 0x61, 0x15, 0xa1,
|
||||
0xe0, 0xae, 0x5d, 0xa4, 0x9b, 0x34, 0x1a, 0x55, 0xad, 0x93, 0x32, 0x30, 0xf5, 0x8c, 0xb1, 0xe3,
|
||||
0x1d, 0xf6, 0xe2, 0x2e, 0x82, 0x66, 0xca, 0x60, 0xc0, 0x29, 0x23, 0xab, 0x0d, 0x53, 0x4e, 0x6f,
|
||||
0xd5, 0xdb, 0x37, 0x45, 0xde, 0xfd, 0x8e, 0x2f, 0x03, 0xff, 0x6a, 0x72, 0x6d, 0x6c, 0x5b, 0x51,
|
||||
0x8d, 0x1b, 0xaf, 0x92, 0xbb, 0xdd, 0xbc, 0x7f, 0x11, 0xd9, 0x5c, 0x41, 0x1f, 0x10, 0x5a, 0xd8,
|
||||
0x0a, 0xc1, 0x31, 0x88, 0xa5, 0xcd, 0x7b, 0xbd, 0x2d, 0x74, 0xd0, 0x12, 0xb8, 0xe5, 0xb4, 0xb0,
|
||||
0x89, 0x69, 0x97, 0x4a, 0x0c, 0x96, 0x77, 0x7e, 0x65, 0xb9, 0xf1, 0x09, 0xc5, 0x6e, 0xc6, 0x84,
|
||||
0x18, 0xf0, 0x7d, 0xec, 0x3a, 0xdc, 0x4d, 0x20, 0x79, 0xee, 0x5f, 0x3e, 0xd7, 0xcb, 0x39, 0x48
|
||||
};
|
||||
|
||||
const u32 CK[32] = {
|
||||
0x00070e15, 0x1c232a31, 0x383f464d, 0x545b6269,
|
||||
0x70777e85, 0x8c939aa1, 0xa8afb6bd, 0xc4cbd2d9,
|
||||
0xe0e7eef5, 0xfc030a11, 0x181f262d, 0x343b4249,
|
||||
0x50575e65, 0x6c737a81, 0x888f969d, 0xa4abb2b9,
|
||||
0xc0c7ced5, 0xdce3eaf1, 0xf8ff060d, 0x141b2229,
|
||||
0x30373e45, 0x4c535a61, 0x686f767d, 0x848b9299,
|
||||
0xa0a7aeb5, 0xbcc3cad1, 0xd8dfe6ed, 0xf4fb0209,
|
||||
0x10171e25, 0x2c333a41, 0x484f565d, 0x646b7279
|
||||
};
|
||||
|
||||
#define Rotl(_x, _y) (((_x) << (_y)) | ((_x) >> (32 - (_y))))
|
||||
|
||||
#define ByteSub(_A) (Sbox[(_A) >> 24 & 0xFF] << 24 | \
|
||||
Sbox[(_A) >> 16 & 0xFF] << 16 | \
|
||||
Sbox[(_A) >> 8 & 0xFF] << 8 | \
|
||||
Sbox[(_A) & 0xFF])
|
||||
|
||||
#define L1(_B) ((_B) ^ Rotl(_B, 2) ^ Rotl(_B, 10) ^ Rotl(_B, 18) ^ Rotl(_B, 24))
|
||||
#define L2(_B) ((_B) ^ Rotl(_B, 13) ^ Rotl(_B, 23))
|
||||
|
||||
static void
|
||||
xor_block(void *dst, void *src1, void *src2)
|
||||
/* 128-bit xor: *dst = *src1 xor *src2. Pointers must be 32-bit aligned */
|
||||
{
|
||||
((u32 *)dst)[0] = ((u32 *)src1)[0] ^ ((u32 *)src2)[0];
|
||||
((u32 *)dst)[1] = ((u32 *)src1)[1] ^ ((u32 *)src2)[1];
|
||||
((u32 *)dst)[2] = ((u32 *)src1)[2] ^ ((u32 *)src2)[2];
|
||||
((u32 *)dst)[3] = ((u32 *)src1)[3] ^ ((u32 *)src2)[3];
|
||||
}
|
||||
|
||||
|
||||
void SMS4Crypt(u8 *Input, u8 *Output, u32 *rk)
|
||||
{
|
||||
u32 r, mid, x0, x1, x2, x3, *p;
|
||||
p = (u32 *)Input;
|
||||
x0 = p[0];
|
||||
x1 = p[1];
|
||||
x2 = p[2];
|
||||
x3 = p[3];
|
||||
#ifdef WAPI_LITTLE_ENDIAN
|
||||
x0 = Rotl(x0, 16);
|
||||
x0 = ((x0 & 0x00FF00FF) << 8) | ((x0 & 0xFF00FF00) >> 8);
|
||||
x1 = Rotl(x1, 16);
|
||||
x1 = ((x1 & 0x00FF00FF) << 8) | ((x1 & 0xFF00FF00) >> 8);
|
||||
x2 = Rotl(x2, 16);
|
||||
x2 = ((x2 & 0x00FF00FF) << 8) | ((x2 & 0xFF00FF00) >> 8);
|
||||
x3 = Rotl(x3, 16);
|
||||
x3 = ((x3 & 0x00FF00FF) << 8) | ((x3 & 0xFF00FF00) >> 8);
|
||||
#endif
|
||||
for (r = 0; r < 32; r += 4) {
|
||||
mid = x1 ^ x2 ^ x3 ^ rk[r + 0];
|
||||
mid = ByteSub(mid);
|
||||
x0 ^= L1(mid);
|
||||
mid = x2 ^ x3 ^ x0 ^ rk[r + 1];
|
||||
mid = ByteSub(mid);
|
||||
x1 ^= L1(mid);
|
||||
mid = x3 ^ x0 ^ x1 ^ rk[r + 2];
|
||||
mid = ByteSub(mid);
|
||||
x2 ^= L1(mid);
|
||||
mid = x0 ^ x1 ^ x2 ^ rk[r + 3];
|
||||
mid = ByteSub(mid);
|
||||
x3 ^= L1(mid);
|
||||
}
|
||||
#ifdef WAPI_LITTLE_ENDIAN
|
||||
x0 = Rotl(x0, 16);
|
||||
x0 = ((x0 & 0x00FF00FF) << 8) | ((x0 & 0xFF00FF00) >> 8);
|
||||
x1 = Rotl(x1, 16);
|
||||
x1 = ((x1 & 0x00FF00FF) << 8) | ((x1 & 0xFF00FF00) >> 8);
|
||||
x2 = Rotl(x2, 16);
|
||||
x2 = ((x2 & 0x00FF00FF) << 8) | ((x2 & 0xFF00FF00) >> 8);
|
||||
x3 = Rotl(x3, 16);
|
||||
x3 = ((x3 & 0x00FF00FF) << 8) | ((x3 & 0xFF00FF00) >> 8);
|
||||
#endif
|
||||
p = (u32 *)Output;
|
||||
p[0] = x3;
|
||||
p[1] = x2;
|
||||
p[2] = x1;
|
||||
p[3] = x0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SMS4KeyExt(u8 *Key, u32 *rk, u32 CryptFlag)
|
||||
{
|
||||
u32 r, mid, x0, x1, x2, x3, *p;
|
||||
|
||||
p = (u32 *)Key;
|
||||
x0 = p[0];
|
||||
x1 = p[1];
|
||||
x2 = p[2];
|
||||
x3 = p[3];
|
||||
#ifdef WAPI_LITTLE_ENDIAN
|
||||
x0 = Rotl(x0, 16);
|
||||
x0 = ((x0 & 0xFF00FF) << 8) | ((x0 & 0xFF00FF00) >> 8);
|
||||
x1 = Rotl(x1, 16);
|
||||
x1 = ((x1 & 0xFF00FF) << 8) | ((x1 & 0xFF00FF00) >> 8);
|
||||
x2 = Rotl(x2, 16);
|
||||
x2 = ((x2 & 0xFF00FF) << 8) | ((x2 & 0xFF00FF00) >> 8);
|
||||
x3 = Rotl(x3, 16);
|
||||
x3 = ((x3 & 0xFF00FF) << 8) | ((x3 & 0xFF00FF00) >> 8);
|
||||
#endif
|
||||
|
||||
x0 ^= 0xa3b1bac6;
|
||||
x1 ^= 0x56aa3350;
|
||||
x2 ^= 0x677d9197;
|
||||
x3 ^= 0xb27022dc;
|
||||
for (r = 0; r < 32; r += 4) {
|
||||
mid = x1 ^ x2 ^ x3 ^ CK[r + 0];
|
||||
mid = ByteSub(mid);
|
||||
rk[r + 0] = x0 ^= L2(mid);
|
||||
mid = x2 ^ x3 ^ x0 ^ CK[r + 1];
|
||||
mid = ByteSub(mid);
|
||||
rk[r + 1] = x1 ^= L2(mid);
|
||||
mid = x3 ^ x0 ^ x1 ^ CK[r + 2];
|
||||
mid = ByteSub(mid);
|
||||
rk[r + 2] = x2 ^= L2(mid);
|
||||
mid = x0 ^ x1 ^ x2 ^ CK[r + 3];
|
||||
mid = ByteSub(mid);
|
||||
rk[r + 3] = x3 ^= L2(mid);
|
||||
}
|
||||
if (CryptFlag == DECRYPT) {
|
||||
for (r = 0; r < 16; r++)
|
||||
mid = rk[r], rk[r] = rk[31 - r], rk[31 - r] = mid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WapiSMS4Cryption(u8 *Key, u8 *IV, u8 *Input, u16 InputLength,
|
||||
u8 *Output, u16 *OutputLength, u32 CryptFlag)
|
||||
{
|
||||
u32 blockNum, i, j, rk[32];
|
||||
u16 remainder;
|
||||
u8 blockIn[16], blockOut[16], tempIV[16], k;
|
||||
|
||||
*OutputLength = 0;
|
||||
remainder = InputLength & 0x0F;
|
||||
blockNum = InputLength >> 4;
|
||||
if (remainder != 0)
|
||||
blockNum++;
|
||||
else
|
||||
remainder = 16;
|
||||
|
||||
for (k = 0; k < 16; k++)
|
||||
tempIV[k] = IV[15 - k];
|
||||
|
||||
memcpy(blockIn, tempIV, 16);
|
||||
|
||||
SMS4KeyExt((u8 *)Key, rk, CryptFlag);
|
||||
|
||||
for (i = 0; i < blockNum - 1; i++) {
|
||||
SMS4Crypt((u8 *)blockIn, blockOut, rk);
|
||||
xor_block(&Output[i * 16], &Input[i * 16], blockOut);
|
||||
memcpy(blockIn, blockOut, 16);
|
||||
}
|
||||
|
||||
*OutputLength = i * 16;
|
||||
|
||||
SMS4Crypt((u8 *)blockIn, blockOut, rk);
|
||||
|
||||
for (j = 0; j < remainder; j++)
|
||||
Output[i * 16 + j] = Input[i * 16 + j] ^ blockOut[j];
|
||||
*OutputLength += remainder;
|
||||
|
||||
}
|
||||
|
||||
void WapiSMS4Encryption(u8 *Key, u8 *IV, u8 *Input, u16 InputLength,
|
||||
u8 *Output, u16 *OutputLength)
|
||||
{
|
||||
|
||||
WapiSMS4Cryption(Key, IV, Input, InputLength, Output, OutputLength, ENCRYPT);
|
||||
}
|
||||
|
||||
void WapiSMS4Decryption(u8 *Key, u8 *IV, u8 *Input, u16 InputLength,
|
||||
u8 *Output, u16 *OutputLength)
|
||||
{
|
||||
/* OFB mode: is also ENCRYPT flag */
|
||||
WapiSMS4Cryption(Key, IV, Input, InputLength, Output, OutputLength, ENCRYPT);
|
||||
}
|
||||
|
||||
void WapiSMS4CalculateMic(u8 *Key, u8 *IV, u8 *Input1, u8 Input1Length,
|
||||
u8 *Input2, u16 Input2Length, u8 *Output, u8 *OutputLength)
|
||||
{
|
||||
u32 blockNum, i, remainder, rk[32];
|
||||
u8 BlockIn[16], BlockOut[16], TempBlock[16], tempIV[16], k;
|
||||
|
||||
*OutputLength = 0;
|
||||
remainder = Input1Length & 0x0F;
|
||||
blockNum = Input1Length >> 4;
|
||||
|
||||
for (k = 0; k < 16; k++)
|
||||
tempIV[k] = IV[15 - k];
|
||||
|
||||
memcpy(BlockIn, tempIV, 16);
|
||||
|
||||
SMS4KeyExt((u8 *)Key, rk, ENCRYPT);
|
||||
|
||||
SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
|
||||
|
||||
for (i = 0; i < blockNum; i++) {
|
||||
xor_block(BlockIn, (Input1 + i * 16), BlockOut);
|
||||
SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
|
||||
}
|
||||
|
||||
if (remainder != 0) {
|
||||
memset(TempBlock, 0, 16);
|
||||
memcpy(TempBlock, (Input1 + blockNum * 16), remainder);
|
||||
|
||||
xor_block(BlockIn, TempBlock, BlockOut);
|
||||
SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
|
||||
}
|
||||
|
||||
remainder = Input2Length & 0x0F;
|
||||
blockNum = Input2Length >> 4;
|
||||
|
||||
for (i = 0; i < blockNum; i++) {
|
||||
xor_block(BlockIn, (Input2 + i * 16), BlockOut);
|
||||
SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
|
||||
}
|
||||
|
||||
if (remainder != 0) {
|
||||
memset(TempBlock, 0, 16);
|
||||
memcpy(TempBlock, (Input2 + blockNum * 16), remainder);
|
||||
|
||||
xor_block(BlockIn, TempBlock, BlockOut);
|
||||
SMS4Crypt((u8 *)BlockIn, BlockOut, rk);
|
||||
}
|
||||
|
||||
memcpy(Output, BlockOut, 16);
|
||||
*OutputLength = 16;
|
||||
}
|
||||
|
||||
void SecCalculateMicSMS4(
|
||||
u8 KeyIdx,
|
||||
u8 *MicKey,
|
||||
u8 *pHeader,
|
||||
u8 *pData,
|
||||
u16 DataLen,
|
||||
u8 *MicBuffer
|
||||
)
|
||||
{
|
||||
#if 0
|
||||
struct ieee80211_hdr_3addr_qos *header;
|
||||
u8 TempBuf[34], TempLen = 32, MicLen, QosOffset, *IV;
|
||||
u16 *pTemp, fc;
|
||||
|
||||
WAPI_TRACE(WAPI_TX | WAPI_RX, "=========>%s\n", __FUNCTION__);
|
||||
|
||||
header = (struct ieee80211_hdr_3addr_qos *)pHeader;
|
||||
memset(TempBuf, 0, 34);
|
||||
memcpy(TempBuf, pHeader, 2); /* FrameCtrl */
|
||||
pTemp = (u16 *)TempBuf;
|
||||
*pTemp &= 0xc78f; /* bit4,5,6,11,12,13 */
|
||||
|
||||
memcpy((TempBuf + 2), (pHeader + 4), 12); /* Addr1, Addr2 */
|
||||
memcpy((TempBuf + 14), (pHeader + 22), 2); /* SeqCtrl */
|
||||
pTemp = (u16 *)(TempBuf + 14);
|
||||
*pTemp &= 0x000f;
|
||||
|
||||
memcpy((TempBuf + 16), (pHeader + 16), 6); /* Addr3 */
|
||||
|
||||
fc = le16_to_cpu(header->frame_ctl);
|
||||
|
||||
|
||||
|
||||
if (GetFrDs((u16 *)&fc) && GetToDs((u16 *)&fc)) {
|
||||
memcpy((TempBuf + 22), (pHeader + 24), 6);
|
||||
QosOffset = 30;
|
||||
} else {
|
||||
memset((TempBuf + 22), 0, 6);
|
||||
QosOffset = 24;
|
||||
}
|
||||
|
||||
if ((fc & 0x0088) == 0x0088) {
|
||||
memcpy((TempBuf + 28), (pHeader + QosOffset), 2);
|
||||
TempLen += 2;
|
||||
/* IV = pHeader + QosOffset + 2 + SNAP_SIZE + sizeof(u16) + 2; */
|
||||
IV = pHeader + QosOffset + 2 + 2;
|
||||
} else {
|
||||
IV = pHeader + QosOffset + 2;
|
||||
/* IV = pHeader + QosOffset + SNAP_SIZE + sizeof(u16) + 2; */
|
||||
}
|
||||
|
||||
TempBuf[TempLen - 1] = (u8)(DataLen & 0xff);
|
||||
TempBuf[TempLen - 2] = (u8)((DataLen & 0xff00) >> 8);
|
||||
TempBuf[TempLen - 4] = KeyIdx;
|
||||
|
||||
WAPI_DATA(WAPI_TX, "CalculateMic - KEY", MicKey, 16);
|
||||
WAPI_DATA(WAPI_TX, "CalculateMic - IV", IV, 16);
|
||||
WAPI_DATA(WAPI_TX, "CalculateMic - TempBuf", TempBuf, TempLen);
|
||||
WAPI_DATA(WAPI_TX, "CalculateMic - pData", pData, DataLen);
|
||||
|
||||
WapiSMS4CalculateMic(MicKey, IV, TempBuf, TempLen,
|
||||
pData, DataLen, MicBuffer, &MicLen);
|
||||
|
||||
if (MicLen != 16)
|
||||
WAPI_TRACE(WAPI_ERR, "%s: MIC Length Error!!\n", __FUNCTION__);
|
||||
|
||||
WAPI_TRACE(WAPI_TX | WAPI_RX, "<=========%s\n", __FUNCTION__);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* AddCount: 1 or 2.
|
||||
* If overflow, return 1,
|
||||
* else return 0.
|
||||
*/
|
||||
u8 WapiIncreasePN(u8 *PN, u8 AddCount)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
if (NULL == PN)
|
||||
return 1;
|
||||
/* YJ,test,091102 */
|
||||
/*
|
||||
if(AddCount == 2){
|
||||
RTW_INFO("############################%s(): PN[0]=0x%x\n", __FUNCTION__, PN[0]);
|
||||
if(PN[0] == 0x48){
|
||||
PN[0] += AddCount;
|
||||
return 1;
|
||||
}else{
|
||||
PN[0] += AddCount;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
*/
|
||||
/* YJ,test,091102,end */
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
if (PN[i] + AddCount <= 0xff) {
|
||||
PN[i] += AddCount;
|
||||
return 0;
|
||||
} else {
|
||||
PN[i] += AddCount;
|
||||
AddCount = 1;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void WapiGetLastRxUnicastPNForQoSData(
|
||||
u8 UserPriority,
|
||||
PRT_WAPI_STA_INFO pWapiStaInfo,
|
||||
u8 *PNOut
|
||||
)
|
||||
{
|
||||
WAPI_TRACE(WAPI_RX, "===========> %s\n", __FUNCTION__);
|
||||
switch (UserPriority) {
|
||||
case 0:
|
||||
case 3:
|
||||
memcpy(PNOut, pWapiStaInfo->lastRxUnicastPNBEQueue, 16);
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
memcpy(PNOut, pWapiStaInfo->lastRxUnicastPNBKQueue, 16);
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
memcpy(PNOut, pWapiStaInfo->lastRxUnicastPNVIQueue, 16);
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
memcpy(PNOut, pWapiStaInfo->lastRxUnicastPNVOQueue, 16);
|
||||
break;
|
||||
default:
|
||||
WAPI_TRACE(WAPI_ERR, "%s: Unknown TID\n", __FUNCTION__);
|
||||
break;
|
||||
}
|
||||
WAPI_TRACE(WAPI_RX, "<=========== %s\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
void WapiSetLastRxUnicastPNForQoSData(
|
||||
u8 UserPriority,
|
||||
u8 *PNIn,
|
||||
PRT_WAPI_STA_INFO pWapiStaInfo
|
||||
)
|
||||
{
|
||||
WAPI_TRACE(WAPI_RX, "===========> %s\n", __FUNCTION__);
|
||||
switch (UserPriority) {
|
||||
case 0:
|
||||
case 3:
|
||||
memcpy(pWapiStaInfo->lastRxUnicastPNBEQueue, PNIn, 16);
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
memcpy(pWapiStaInfo->lastRxUnicastPNBKQueue, PNIn, 16);
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
memcpy(pWapiStaInfo->lastRxUnicastPNVIQueue, PNIn, 16);
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
memcpy(pWapiStaInfo->lastRxUnicastPNVOQueue, PNIn, 16);
|
||||
break;
|
||||
default:
|
||||
WAPI_TRACE(WAPI_ERR, "%s: Unknown TID\n", __FUNCTION__);
|
||||
break;
|
||||
}
|
||||
WAPI_TRACE(WAPI_RX, "<=========== %s\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
FALSE not RX-Reorder
|
||||
TRUE do RX Reorder
|
||||
add to support WAPI to N-mode
|
||||
*****************************************************************************/
|
||||
u8 WapiCheckPnInSwDecrypt(
|
||||
_adapter *padapter,
|
||||
struct sk_buff *pskb
|
||||
)
|
||||
{
|
||||
u8 ret = false;
|
||||
|
||||
#if 0
|
||||
struct ieee80211_hdr_3addr_qos *header;
|
||||
u16 fc;
|
||||
u8 *pDaddr, *pTaddr, *pRaddr;
|
||||
|
||||
header = (struct ieee80211_hdr_3addr_qos *)pskb->data;
|
||||
pTaddr = header->addr2;
|
||||
pRaddr = header->addr1;
|
||||
fc = le16_to_cpu(header->frame_ctl);
|
||||
|
||||
if (GetToDs(&fc))
|
||||
pDaddr = header->addr3;
|
||||
else
|
||||
pDaddr = header->addr1;
|
||||
|
||||
if ((_rtw_memcmp(pRaddr, padapter->pnetdev->dev_addr, ETH_ALEN) == 0)
|
||||
&& !(pDaddr)
|
||||
&& (GetFrameType(&fc) == WIFI_QOS_DATA_TYPE))
|
||||
/* && ieee->pHTInfo->bCurrentHTSupport && */
|
||||
/* ieee->pHTInfo->bCurRxReorderEnable) */
|
||||
ret = false;
|
||||
else
|
||||
ret = true;
|
||||
#endif
|
||||
WAPI_TRACE(WAPI_RX, "%s: return %d\n", __FUNCTION__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int SecSMS4HeaderFillIV(_adapter *padapter, u8 *pxmitframe)
|
||||
{
|
||||
struct pkt_attrib *pattrib = &((struct xmit_frame *)pxmitframe)->attrib;
|
||||
u8 *frame = ((struct xmit_frame *)pxmitframe)->buf_addr + TXDESC_OFFSET;
|
||||
u8 *pSecHeader = NULL, *pos = NULL, *pRA = NULL;
|
||||
u8 bPNOverflow = false, bFindMatchPeer = false, hdr_len = 0;
|
||||
PWLAN_HEADER_WAPI_EXTENSION pWapiExt = NULL;
|
||||
PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
|
||||
PRT_WAPI_STA_INFO pWapiSta = NULL;
|
||||
int ret = 0;
|
||||
|
||||
WAPI_TRACE(WAPI_TX, "=========>%s\n", __FUNCTION__);
|
||||
|
||||
return ret;
|
||||
#if 0
|
||||
hdr_len = sMacHdrLng;
|
||||
if (GetFrameType(pskb->data) == WIFI_QOS_DATA_TYPE)
|
||||
hdr_len += 2;
|
||||
/* hdr_len += SNAP_SIZE + sizeof(u16); */
|
||||
|
||||
pos = skb_push(pskb, padapter->wapiInfo.extra_prefix_len);
|
||||
memmove(pos, pos + padapter->wapiInfo.extra_prefix_len, hdr_len);
|
||||
|
||||
pSecHeader = pskb->data + hdr_len;
|
||||
pWapiExt = (PWLAN_HEADER_WAPI_EXTENSION)pSecHeader;
|
||||
pRA = pskb->data + 4;
|
||||
|
||||
WAPI_DATA(WAPI_TX, "FillIV - Before Fill IV", pskb->data, pskb->len);
|
||||
|
||||
/* Address 1 is always receiver's address */
|
||||
if (IS_MCAST(pRA)) {
|
||||
if (!pWapiInfo->wapiTxMsk.bTxEnable) {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: bTxEnable = 0!!\n", __FUNCTION__);
|
||||
return -2;
|
||||
}
|
||||
if (pWapiInfo->wapiTxMsk.keyId <= 1) {
|
||||
pWapiExt->KeyIdx = pWapiInfo->wapiTxMsk.keyId;
|
||||
pWapiExt->Reserved = 0;
|
||||
bPNOverflow = WapiIncreasePN(pWapiInfo->lastTxMulticastPN, 1);
|
||||
memcpy(pWapiExt->PN, pWapiInfo->lastTxMulticastPN, 16);
|
||||
if (bPNOverflow) {
|
||||
/* Update MSK Notification. */
|
||||
WAPI_TRACE(WAPI_ERR, "===============>%s():multicast PN overflow\n", __FUNCTION__);
|
||||
rtw_wapi_app_event_handler(padapter, NULL, 0, pRA, false, false, true, 0, false);
|
||||
}
|
||||
} else {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: Invalid Wapi Multicast KeyIdx!!\n", __FUNCTION__);
|
||||
ret = -3;
|
||||
}
|
||||
} else {
|
||||
list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
|
||||
if (!memcmp(pWapiSta->PeerMacAddr, pRA, 6)) {
|
||||
bFindMatchPeer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (bFindMatchPeer) {
|
||||
if ((!pWapiSta->wapiUskUpdate.bTxEnable) && (!pWapiSta->wapiUsk.bTxEnable)) {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: bTxEnable = 0!!\n", __FUNCTION__);
|
||||
return -4;
|
||||
}
|
||||
if (pWapiSta->wapiUsk.keyId <= 1) {
|
||||
if (pWapiSta->wapiUskUpdate.bTxEnable)
|
||||
pWapiExt->KeyIdx = pWapiSta->wapiUskUpdate.keyId;
|
||||
else
|
||||
pWapiExt->KeyIdx = pWapiSta->wapiUsk.keyId;
|
||||
|
||||
pWapiExt->Reserved = 0;
|
||||
bPNOverflow = WapiIncreasePN(pWapiSta->lastTxUnicastPN, 2);
|
||||
memcpy(pWapiExt->PN, pWapiSta->lastTxUnicastPN, 16);
|
||||
if (bPNOverflow) {
|
||||
/* Update USK Notification. */
|
||||
WAPI_TRACE(WAPI_ERR, "===============>%s():unicast PN overflow\n", __FUNCTION__);
|
||||
rtw_wapi_app_event_handler(padapter, NULL, 0, pWapiSta->PeerMacAddr, false, true, false, 0, false);
|
||||
}
|
||||
} else {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: Invalid Wapi Unicast KeyIdx!!\n", __FUNCTION__);
|
||||
ret = -5;
|
||||
}
|
||||
} else {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: Can not find Peer Sta "MAC_FMT"!!\n", __FUNCTION__, MAC_ARG(pRA));
|
||||
ret = -6;
|
||||
}
|
||||
}
|
||||
|
||||
WAPI_DATA(WAPI_TX, "FillIV - After Fill IV", pskb->data, pskb->len);
|
||||
WAPI_TRACE(WAPI_TX, "<=========%s\n", __FUNCTION__);
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* WAPI SW Enc: must have done Coalesce! */
|
||||
void SecSWSMS4Encryption(
|
||||
_adapter *padapter,
|
||||
u8 *pxmitframe
|
||||
)
|
||||
{
|
||||
PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
|
||||
PRT_WAPI_STA_INFO pWapiSta = NULL;
|
||||
u8 *pframe = ((struct xmit_frame *)pxmitframe)->buf_addr + TXDESC_SIZE;
|
||||
struct pkt_attrib *pattrib = &((struct xmit_frame *)pxmitframe)->attrib;
|
||||
|
||||
u8 *SecPtr = NULL, *pRA, *pMicKey = NULL, *pDataKey = NULL, *pIV = NULL;
|
||||
u8 IVOffset, DataOffset, bFindMatchPeer = false, KeyIdx = 0, MicBuffer[16];
|
||||
u16 OutputLength;
|
||||
|
||||
WAPI_TRACE(WAPI_TX, "=========>%s\n", __FUNCTION__);
|
||||
|
||||
WAPI_TRACE(WAPI_TX, "hdrlen: %d\n", pattrib->hdrlen);
|
||||
|
||||
return;
|
||||
|
||||
DataOffset = pattrib->hdrlen + pattrib->iv_len;
|
||||
|
||||
pRA = pframe + 4;
|
||||
|
||||
|
||||
if (IS_MCAST(pRA)) {
|
||||
KeyIdx = pWapiInfo->wapiTxMsk.keyId;
|
||||
pIV = pWapiInfo->lastTxMulticastPN;
|
||||
pMicKey = pWapiInfo->wapiTxMsk.micKey;
|
||||
pDataKey = pWapiInfo->wapiTxMsk.dataKey;
|
||||
} else {
|
||||
if (!list_empty(&(pWapiInfo->wapiSTAUsedList))) {
|
||||
list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
|
||||
if (0 == memcmp(pWapiSta->PeerMacAddr, pRA, 6)) {
|
||||
bFindMatchPeer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bFindMatchPeer) {
|
||||
if (pWapiSta->wapiUskUpdate.bTxEnable) {
|
||||
KeyIdx = pWapiSta->wapiUskUpdate.keyId;
|
||||
WAPI_TRACE(WAPI_TX, "%s(): Use update USK!! KeyIdx=%d\n", __FUNCTION__, KeyIdx);
|
||||
pIV = pWapiSta->lastTxUnicastPN;
|
||||
pMicKey = pWapiSta->wapiUskUpdate.micKey;
|
||||
pDataKey = pWapiSta->wapiUskUpdate.dataKey;
|
||||
} else {
|
||||
KeyIdx = pWapiSta->wapiUsk.keyId;
|
||||
WAPI_TRACE(WAPI_TX, "%s(): Use USK!! KeyIdx=%d\n", __FUNCTION__, KeyIdx);
|
||||
pIV = pWapiSta->lastTxUnicastPN;
|
||||
pMicKey = pWapiSta->wapiUsk.micKey;
|
||||
pDataKey = pWapiSta->wapiUsk.dataKey;
|
||||
}
|
||||
} else {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: Can not find Peer Sta!!\n", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: wapiSTAUsedList is empty!!\n", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SecPtr = pframe;
|
||||
SecCalculateMicSMS4(KeyIdx, pMicKey, SecPtr, (SecPtr + DataOffset), pattrib->pktlen, MicBuffer);
|
||||
|
||||
WAPI_DATA(WAPI_TX, "Encryption - MIC", MicBuffer, padapter->wapiInfo.extra_postfix_len);
|
||||
|
||||
memcpy(pframe + pattrib->hdrlen + pattrib->iv_len + pattrib->pktlen - pattrib->icv_len,
|
||||
(u8 *)MicBuffer,
|
||||
padapter->wapiInfo.extra_postfix_len
|
||||
);
|
||||
|
||||
|
||||
WapiSMS4Encryption(pDataKey, pIV, (SecPtr + DataOffset), pattrib->pktlen + pattrib->icv_len, (SecPtr + DataOffset), &OutputLength);
|
||||
|
||||
WAPI_DATA(WAPI_TX, "Encryption - After SMS4 encryption", pframe, pattrib->hdrlen + pattrib->iv_len + pattrib->pktlen);
|
||||
|
||||
WAPI_TRACE(WAPI_TX, "<=========%s\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
u8 SecSWSMS4Decryption(
|
||||
_adapter *padapter,
|
||||
u8 *precv_frame,
|
||||
struct recv_priv *precv_priv
|
||||
)
|
||||
{
|
||||
PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
|
||||
struct recv_frame_hdr *precv_hdr;
|
||||
PRT_WAPI_STA_INFO pWapiSta = NULL;
|
||||
u8 IVOffset, DataOffset, bFindMatchPeer = false, bUseUpdatedKey = false;
|
||||
u8 KeyIdx, MicBuffer[16], lastRxPNforQoS[16];
|
||||
u8 *pRA, *pTA, *pMicKey, *pDataKey, *pLastRxPN, *pRecvPN, *pSecData, *pRecvMic, *pos;
|
||||
u8 TID = 0;
|
||||
u16 OutputLength, DataLen;
|
||||
u8 bQosData;
|
||||
struct sk_buff *pskb;
|
||||
|
||||
WAPI_TRACE(WAPI_RX, "=========>%s\n", __FUNCTION__);
|
||||
|
||||
return 0;
|
||||
|
||||
precv_hdr = &((union recv_frame *)precv_frame)->u.hdr;
|
||||
pskb = (struct sk_buff *)(precv_hdr->rx_data);
|
||||
precv_hdr->bWapiCheckPNInDecrypt = WapiCheckPnInSwDecrypt(padapter, pskb);
|
||||
WAPI_TRACE(WAPI_RX, "=========>%s: check PN %d\n", __FUNCTION__, precv_hdr->bWapiCheckPNInDecrypt);
|
||||
WAPI_DATA(WAPI_RX, "Decryption - Before decryption", pskb->data, pskb->len);
|
||||
|
||||
IVOffset = sMacHdrLng;
|
||||
bQosData = GetFrameType(pskb->data) == WIFI_QOS_DATA_TYPE;
|
||||
if (bQosData)
|
||||
IVOffset += 2;
|
||||
|
||||
/* if(GetHTC()) */
|
||||
/* IVOffset += 4; */
|
||||
|
||||
/* IVOffset += SNAP_SIZE + sizeof(u16); */
|
||||
|
||||
DataOffset = IVOffset + padapter->wapiInfo.extra_prefix_len;
|
||||
|
||||
pRA = pskb->data + 4;
|
||||
pTA = pskb->data + 10;
|
||||
KeyIdx = *(pskb->data + IVOffset);
|
||||
pRecvPN = pskb->data + IVOffset + 2;
|
||||
pSecData = pskb->data + DataOffset;
|
||||
DataLen = pskb->len - DataOffset;
|
||||
pRecvMic = pskb->data + pskb->len - padapter->wapiInfo.extra_postfix_len;
|
||||
TID = GetTid(pskb->data);
|
||||
|
||||
if (!list_empty(&(pWapiInfo->wapiSTAUsedList))) {
|
||||
list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
|
||||
if (0 == memcmp(pWapiSta->PeerMacAddr, pTA, 6)) {
|
||||
bFindMatchPeer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!bFindMatchPeer) {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: Can not find Peer Sta "MAC_FMT" for Key Info!!!\n", __FUNCTION__, MAC_ARG(pTA));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IS_MCAST(pRA)) {
|
||||
WAPI_TRACE(WAPI_RX, "%s: Multicast decryption !!!\n", __FUNCTION__);
|
||||
if (pWapiSta->wapiMsk.keyId == KeyIdx && pWapiSta->wapiMsk.bSet) {
|
||||
pLastRxPN = pWapiSta->lastRxMulticastPN;
|
||||
if (!WapiComparePN(pRecvPN, pLastRxPN)) {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: MSK PN is not larger than last, Dropped!!!\n", __FUNCTION__);
|
||||
WAPI_DATA(WAPI_ERR, "pRecvPN:", pRecvPN, 16);
|
||||
WAPI_DATA(WAPI_ERR, "pLastRxPN:", pLastRxPN, 16);
|
||||
return false;
|
||||
}
|
||||
|
||||
memcpy(pLastRxPN, pRecvPN, 16);
|
||||
pMicKey = pWapiSta->wapiMsk.micKey;
|
||||
pDataKey = pWapiSta->wapiMsk.dataKey;
|
||||
} else if (pWapiSta->wapiMskUpdate.keyId == KeyIdx && pWapiSta->wapiMskUpdate.bSet) {
|
||||
WAPI_TRACE(WAPI_RX, "%s: Use Updated MSK for Decryption !!!\n", __FUNCTION__);
|
||||
bUseUpdatedKey = true;
|
||||
memcpy(pWapiSta->lastRxMulticastPN, pRecvPN, 16);
|
||||
pMicKey = pWapiSta->wapiMskUpdate.micKey;
|
||||
pDataKey = pWapiSta->wapiMskUpdate.dataKey;
|
||||
} else {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: Can not find MSK with matched KeyIdx(%d), Dropped !!!\n", __FUNCTION__, KeyIdx);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
WAPI_TRACE(WAPI_RX, "%s: Unicast decryption !!!\n", __FUNCTION__);
|
||||
if (pWapiSta->wapiUsk.keyId == KeyIdx && pWapiSta->wapiUsk.bSet) {
|
||||
WAPI_TRACE(WAPI_RX, "%s: Use USK for Decryption!!!\n", __FUNCTION__);
|
||||
if (precv_hdr->bWapiCheckPNInDecrypt) {
|
||||
if (GetFrameType(pskb->data) == WIFI_QOS_DATA_TYPE) {
|
||||
WapiGetLastRxUnicastPNForQoSData(TID, pWapiSta, lastRxPNforQoS);
|
||||
pLastRxPN = lastRxPNforQoS;
|
||||
} else
|
||||
pLastRxPN = pWapiSta->lastRxUnicastPN;
|
||||
if (!WapiComparePN(pRecvPN, pLastRxPN))
|
||||
return false;
|
||||
if (bQosData)
|
||||
WapiSetLastRxUnicastPNForQoSData(TID, pRecvPN, pWapiSta);
|
||||
else
|
||||
memcpy(pWapiSta->lastRxUnicastPN, pRecvPN, 16);
|
||||
} else
|
||||
memcpy(precv_hdr->WapiTempPN, pRecvPN, 16);
|
||||
|
||||
if (check_fwstate(&padapter->mlmepriv, WIFI_STATION_STATE)) {
|
||||
if ((pRecvPN[0] & 0x1) == 0) {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: Rx USK PN is not odd when Infra STA mode, Dropped !!!\n", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
pMicKey = pWapiSta->wapiUsk.micKey;
|
||||
pDataKey = pWapiSta->wapiUsk.dataKey;
|
||||
} else if (pWapiSta->wapiUskUpdate.keyId == KeyIdx && pWapiSta->wapiUskUpdate.bSet) {
|
||||
WAPI_TRACE(WAPI_RX, "%s: Use Updated USK for Decryption!!!\n", __FUNCTION__);
|
||||
if (pWapiSta->bAuthenticatorInUpdata)
|
||||
bUseUpdatedKey = true;
|
||||
else
|
||||
bUseUpdatedKey = false;
|
||||
|
||||
if (bQosData)
|
||||
WapiSetLastRxUnicastPNForQoSData(TID, pRecvPN, pWapiSta);
|
||||
else
|
||||
memcpy(pWapiSta->lastRxUnicastPN, pRecvPN, 16);
|
||||
pMicKey = pWapiSta->wapiUskUpdate.micKey;
|
||||
pDataKey = pWapiSta->wapiUskUpdate.dataKey;
|
||||
} else {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: No valid USK!!!KeyIdx=%d pWapiSta->wapiUsk.keyId=%d pWapiSta->wapiUskUpdate.keyId=%d\n", __FUNCTION__, KeyIdx, pWapiSta->wapiUsk.keyId,
|
||||
pWapiSta->wapiUskUpdate.keyId);
|
||||
/* dump_buf(pskb->data,pskb->len); */
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
WAPI_DATA(WAPI_RX, "Decryption - DataKey", pDataKey, 16);
|
||||
WAPI_DATA(WAPI_RX, "Decryption - IV", pRecvPN, 16);
|
||||
WapiSMS4Decryption(pDataKey, pRecvPN, pSecData, DataLen, pSecData, &OutputLength);
|
||||
|
||||
if (OutputLength != DataLen)
|
||||
WAPI_TRACE(WAPI_ERR, "%s: Output Length Error!!!!\n", __FUNCTION__);
|
||||
|
||||
WAPI_DATA(WAPI_RX, "Decryption - After decryption", pskb->data, pskb->len);
|
||||
|
||||
DataLen -= padapter->wapiInfo.extra_postfix_len;
|
||||
|
||||
SecCalculateMicSMS4(KeyIdx, pMicKey, pskb->data, pSecData, DataLen, MicBuffer);
|
||||
|
||||
WAPI_DATA(WAPI_RX, "Decryption - MIC received", pRecvMic, SMS4_MIC_LEN);
|
||||
WAPI_DATA(WAPI_RX, "Decryption - MIC calculated", MicBuffer, SMS4_MIC_LEN);
|
||||
|
||||
if (0 == memcmp(MicBuffer, pRecvMic, padapter->wapiInfo.extra_postfix_len)) {
|
||||
WAPI_TRACE(WAPI_RX, "%s: Check MIC OK!!\n", __FUNCTION__);
|
||||
if (bUseUpdatedKey) {
|
||||
/* delete the old key */
|
||||
if (IS_MCAST(pRA)) {
|
||||
WAPI_TRACE(WAPI_API, "%s(): AE use new update MSK!!\n", __FUNCTION__);
|
||||
pWapiSta->wapiMsk.keyId = pWapiSta->wapiMskUpdate.keyId;
|
||||
memcpy(pWapiSta->wapiMsk.dataKey, pWapiSta->wapiMskUpdate.dataKey, 16);
|
||||
memcpy(pWapiSta->wapiMsk.micKey, pWapiSta->wapiMskUpdate.micKey, 16);
|
||||
pWapiSta->wapiMskUpdate.bTxEnable = pWapiSta->wapiMskUpdate.bSet = false;
|
||||
} else {
|
||||
WAPI_TRACE(WAPI_API, "%s(): AE use new update USK!!\n", __FUNCTION__);
|
||||
pWapiSta->wapiUsk.keyId = pWapiSta->wapiUskUpdate.keyId;
|
||||
memcpy(pWapiSta->wapiUsk.dataKey, pWapiSta->wapiUskUpdate.dataKey, 16);
|
||||
memcpy(pWapiSta->wapiUsk.micKey, pWapiSta->wapiUskUpdate.micKey, 16);
|
||||
pWapiSta->wapiUskUpdate.bTxEnable = pWapiSta->wapiUskUpdate.bSet = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
WAPI_TRACE(WAPI_ERR, "%s: Check MIC Error, Dropped !!!!\n", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
pos = pskb->data;
|
||||
memmove(pos + padapter->wapiInfo.extra_prefix_len, pos, IVOffset);
|
||||
skb_pull(pskb, padapter->wapiInfo.extra_prefix_len);
|
||||
|
||||
WAPI_TRACE(WAPI_RX, "<=========%s\n", __FUNCTION__);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
u32 rtw_sms4_encrypt(_adapter *padapter, u8 *pxmitframe)
|
||||
{
|
||||
|
||||
u8 *pframe;
|
||||
u32 res = _SUCCESS;
|
||||
|
||||
WAPI_TRACE(WAPI_TX, "=========>%s\n", __FUNCTION__);
|
||||
|
||||
if ((!padapter->WapiSupport) || (!padapter->wapiInfo.bWapiEnable)) {
|
||||
WAPI_TRACE(WAPI_TX, "<========== %s, WAPI not supported or enabled!\n", __FUNCTION__);
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
if (((struct xmit_frame *)pxmitframe)->buf_addr == NULL)
|
||||
return _FAIL;
|
||||
|
||||
pframe = ((struct xmit_frame *)pxmitframe)->buf_addr + TXDESC_OFFSET;
|
||||
|
||||
SecSWSMS4Encryption(padapter, pxmitframe);
|
||||
|
||||
WAPI_TRACE(WAPI_TX, "<=========%s\n", __FUNCTION__);
|
||||
return res;
|
||||
}
|
||||
|
||||
u32 rtw_sms4_decrypt(_adapter *padapter, u8 *precvframe)
|
||||
{
|
||||
u8 *pframe;
|
||||
u32 res = _SUCCESS;
|
||||
|
||||
WAPI_TRACE(WAPI_RX, "=========>%s\n", __FUNCTION__);
|
||||
|
||||
if ((!padapter->WapiSupport) || (!padapter->wapiInfo.bWapiEnable)) {
|
||||
WAPI_TRACE(WAPI_RX, "<========== %s, WAPI not supported or enabled!\n", __FUNCTION__);
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
|
||||
/* drop packet when hw decrypt fail
|
||||
* return tempraily */
|
||||
return _FAIL;
|
||||
|
||||
/* pframe=(unsigned char *)((union recv_frame*)precvframe)->u.hdr.rx_data; */
|
||||
|
||||
if (false == SecSWSMS4Decryption(padapter, precvframe, &padapter->recvpriv)) {
|
||||
WAPI_TRACE(WAPI_ERR, "%s():SMS4 decrypt frame error\n", __FUNCTION__);
|
||||
return _FAIL;
|
||||
}
|
||||
|
||||
WAPI_TRACE(WAPI_RX, "<=========%s\n", __FUNCTION__);
|
||||
return res;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
u32 rtw_sms4_encrypt(_adapter *padapter, u8 *pxmitframe)
|
||||
{
|
||||
WAPI_TRACE(WAPI_TX, "=========>Dummy %s\n", __FUNCTION__);
|
||||
WAPI_TRACE(WAPI_TX, "<=========Dummy %s\n", __FUNCTION__);
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
u32 rtw_sms4_decrypt(_adapter *padapter, u8 *precvframe)
|
||||
{
|
||||
WAPI_TRACE(WAPI_RX, "=========>Dummy %s\n", __FUNCTION__);
|
||||
WAPI_TRACE(WAPI_RX, "<=========Dummy %s\n", __FUNCTION__);
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
@@ -11,7 +11,12 @@
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "Hal8188EPwrSeq.h"
|
||||
#include <rtl8188e_hal.h>
|
||||
@@ -20,62 +25,61 @@
|
||||
drivers should parse below arrays and do the corresponding actions
|
||||
*/
|
||||
/* 3 Power on Array */
|
||||
WLAN_PWR_CFG rtl8188E_power_on_flow[RTL8188E_TRANS_CARDEMU_TO_ACT_STEPS + RTL8188E_TRANS_END_STEPS] = {
|
||||
struct wl_pwr_cfg rtl8188E_power_on_flow[RTL8188E_TRANS_CARDEMU_TO_ACT_STEPS + RTL8188E_TRANS_END_STEPS] = {
|
||||
RTL8188E_TRANS_CARDEMU_TO_ACT
|
||||
RTL8188E_TRANS_END
|
||||
};
|
||||
|
||||
/* 3Radio off Array */
|
||||
WLAN_PWR_CFG rtl8188E_radio_off_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS + RTL8188E_TRANS_END_STEPS] = {
|
||||
struct wl_pwr_cfg rtl8188E_radio_off_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS + RTL8188E_TRANS_END_STEPS] = {
|
||||
RTL8188E_TRANS_ACT_TO_CARDEMU
|
||||
RTL8188E_TRANS_END
|
||||
};
|
||||
|
||||
/* 3Card Disable Array */
|
||||
WLAN_PWR_CFG rtl8188E_card_disable_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS + RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS + RTL8188E_TRANS_END_STEPS] = {
|
||||
struct wl_pwr_cfg rtl8188E_card_disable_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS + RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS + RTL8188E_TRANS_END_STEPS] = {
|
||||
RTL8188E_TRANS_ACT_TO_CARDEMU
|
||||
RTL8188E_TRANS_CARDEMU_TO_CARDDIS
|
||||
RTL8188E_TRANS_END
|
||||
};
|
||||
|
||||
/* 3 Card Enable Array */
|
||||
WLAN_PWR_CFG rtl8188E_card_enable_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS + RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS + RTL8188E_TRANS_END_STEPS] = {
|
||||
struct wl_pwr_cfg rtl8188E_card_enable_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS + RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS + RTL8188E_TRANS_END_STEPS] = {
|
||||
RTL8188E_TRANS_CARDDIS_TO_CARDEMU
|
||||
RTL8188E_TRANS_CARDEMU_TO_ACT
|
||||
RTL8188E_TRANS_END
|
||||
};
|
||||
|
||||
/* 3Suspend Array */
|
||||
WLAN_PWR_CFG rtl8188E_suspend_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS + RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS + RTL8188E_TRANS_END_STEPS] = {
|
||||
struct wl_pwr_cfg rtl8188E_suspend_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS + RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS + RTL8188E_TRANS_END_STEPS] = {
|
||||
RTL8188E_TRANS_ACT_TO_CARDEMU
|
||||
RTL8188E_TRANS_CARDEMU_TO_SUS
|
||||
RTL8188E_TRANS_END
|
||||
};
|
||||
|
||||
/* 3 Resume Array */
|
||||
WLAN_PWR_CFG rtl8188E_resume_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS + RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS + RTL8188E_TRANS_END_STEPS] = {
|
||||
struct wl_pwr_cfg rtl8188E_resume_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS + RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS + RTL8188E_TRANS_END_STEPS] = {
|
||||
RTL8188E_TRANS_SUS_TO_CARDEMU
|
||||
RTL8188E_TRANS_CARDEMU_TO_ACT
|
||||
RTL8188E_TRANS_END
|
||||
};
|
||||
|
||||
|
||||
/* 3HWPDN Array */
|
||||
WLAN_PWR_CFG rtl8188E_hwpdn_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS + RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS + RTL8188E_TRANS_END_STEPS] = {
|
||||
struct wl_pwr_cfg rtl8188E_hwpdn_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS + RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS + RTL8188E_TRANS_END_STEPS] = {
|
||||
RTL8188E_TRANS_ACT_TO_CARDEMU
|
||||
RTL8188E_TRANS_CARDEMU_TO_PDN
|
||||
RTL8188E_TRANS_END
|
||||
};
|
||||
|
||||
/* 3 Enter LPS */
|
||||
WLAN_PWR_CFG rtl8188E_enter_lps_flow[RTL8188E_TRANS_ACT_TO_LPS_STEPS + RTL8188E_TRANS_END_STEPS] = {
|
||||
struct wl_pwr_cfg rtl8188E_enter_lps_flow[RTL8188E_TRANS_ACT_TO_LPS_STEPS + RTL8188E_TRANS_END_STEPS] = {
|
||||
/* FW behavior */
|
||||
RTL8188E_TRANS_ACT_TO_LPS
|
||||
RTL8188E_TRANS_END
|
||||
};
|
||||
|
||||
/* 3 Leave LPS */
|
||||
WLAN_PWR_CFG rtl8188E_leave_lps_flow[RTL8188E_TRANS_LPS_TO_ACT_STEPS + RTL8188E_TRANS_END_STEPS] = {
|
||||
struct wl_pwr_cfg rtl8188E_leave_lps_flow[RTL8188E_TRANS_LPS_TO_ACT_STEPS + RTL8188E_TRANS_END_STEPS] = {
|
||||
/* FW behavior */
|
||||
RTL8188E_TRANS_LPS_TO_ACT
|
||||
RTL8188E_TRANS_END
|
||||
@@ -0,0 +1,760 @@
|
||||
/*++
|
||||
Copyright (c) Realtek Semiconductor Corp. All rights reserved.
|
||||
|
||||
Module Name:
|
||||
RateAdaptive.c
|
||||
|
||||
Abstract:
|
||||
Implement Rate Adaptive functions for common operations.
|
||||
|
||||
Major Change History:
|
||||
When Who What
|
||||
---------- --------------- -------------------------------
|
||||
2011-08-12 Page Create.
|
||||
|
||||
--*/
|
||||
#include "odm_precomp.h"
|
||||
|
||||
/* Rate adaptive parameters */
|
||||
|
||||
static u8 RETRY_PENALTY[PERENTRY][RETRYSIZE+1] = {
|
||||
{5, 4, 3, 2, 0, 3}, /* 92 , idx = 0 */
|
||||
{6, 5, 4, 3, 0, 4}, /* 86 , idx = 1 */
|
||||
{6, 5, 4, 2, 0, 4}, /* 81 , idx = 2 */
|
||||
{8, 7, 6, 4, 0, 6}, /* 75 , idx = 3 */
|
||||
{10, 9, 8, 6, 0, 8}, /* 71 , idx = 4 */
|
||||
{10, 9, 8, 4, 0, 8}, /* 66 , idx = 5 */
|
||||
{10, 9, 8, 2, 0, 8}, /* 62 , idx = 6 */
|
||||
{10, 9, 8, 0, 0, 8}, /* 59 , idx = 7 */
|
||||
{18, 17, 16, 8, 0, 16}, /* 53 , idx = 8 */
|
||||
{26, 25, 24, 16, 0, 24}, /* 50 , idx = 9 */
|
||||
{34, 33, 32, 24, 0, 32}, /* 47 , idx = 0x0a */
|
||||
{34, 31, 28, 20, 0, 32}, /* 43 , idx = 0x0b */
|
||||
{34, 31, 27, 18, 0, 32}, /* 40 , idx = 0x0c */
|
||||
{34, 31, 26, 16, 0, 32}, /* 37 , idx = 0x0d */
|
||||
{34, 30, 22, 16, 0, 32}, /* 32 , idx = 0x0e */
|
||||
{34, 30, 24, 16, 0, 32}, /* 26 , idx = 0x0f */
|
||||
{49, 46, 40, 16, 0, 48}, /* 20 , idx = 0x10 */
|
||||
{49, 45, 32, 0, 0, 48}, /* 17 , idx = 0x11 */
|
||||
{49, 45, 22, 18, 0, 48}, /* 15 , idx = 0x12 */
|
||||
{49, 40, 24, 16, 0, 48}, /* 12 , idx = 0x13 */
|
||||
{49, 32, 18, 12, 0, 48}, /* 9 , idx = 0x14 */
|
||||
{49, 22, 18, 14, 0, 48}, /* 6 , idx = 0x15 */
|
||||
{49, 16, 16, 0, 0, 48}
|
||||
}; /* 3, idx = 0x16 */
|
||||
|
||||
static u8 PT_PENALTY[RETRYSIZE+1] = {34, 31, 30, 24, 0, 32};
|
||||
|
||||
/* wilson modify */
|
||||
static u8 RETRY_PENALTY_IDX[2][RATESIZE] = {
|
||||
{4, 4, 4, 5, 4, 4, 5, 7, 7, 7, 8, 0x0a, /* SS>TH */
|
||||
4, 4, 4, 4, 6, 0x0a, 0x0b, 0x0d,
|
||||
5, 5, 7, 7, 8, 0x0b, 0x0d, 0x0f}, /* 0329 R01 */
|
||||
{0x0a, 0x0a, 0x0b, 0x0c, 0x0a,
|
||||
0x0a, 0x0b, 0x0c, 0x0d, 0x10, 0x13, 0x14, /* SS<TH */
|
||||
0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x11, 0x13, 0x15,
|
||||
9, 9, 9, 9, 0x0c, 0x0e, 0x11, 0x13}
|
||||
};
|
||||
|
||||
static u8 RETRY_PENALTY_UP_IDX[RATESIZE] = {
|
||||
0x0c, 0x0d, 0x0d, 0x0f, 0x0d, 0x0e,
|
||||
0x0f, 0x0f, 0x10, 0x12, 0x13, 0x14, /* SS>TH */
|
||||
0x0f, 0x10, 0x10, 0x12, 0x12, 0x13, 0x14, 0x15,
|
||||
0x11, 0x11, 0x12, 0x13, 0x13, 0x13, 0x14, 0x15};
|
||||
|
||||
static u8 RSSI_THRESHOLD[RATESIZE] = {
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0x24, 0x26, 0x2a,
|
||||
0x18, 0x1a, 0x1d, 0x1f, 0x21, 0x27, 0x29, 0x2a,
|
||||
0, 0, 0, 0x1f, 0x23, 0x28, 0x2a, 0x2c};
|
||||
|
||||
static u16 N_THRESHOLD_HIGH[RATESIZE] = {
|
||||
4, 4, 8, 16,
|
||||
24, 36, 48, 72, 96, 144, 192, 216,
|
||||
60, 80, 100, 160, 240, 400, 560, 640,
|
||||
300, 320, 480, 720, 1000, 1200, 1600, 2000};
|
||||
static u16 N_THRESHOLD_LOW[RATESIZE] = {
|
||||
2, 2, 4, 8,
|
||||
12, 18, 24, 36, 48, 72, 96, 108,
|
||||
30, 40, 50, 80, 120, 200, 280, 320,
|
||||
150, 160, 240, 360, 500, 600, 800, 1000};
|
||||
|
||||
static u8 DROPING_NECESSARY[RATESIZE] = {
|
||||
1, 1, 1, 1,
|
||||
1, 2, 3, 4, 5, 6, 7, 8,
|
||||
1, 2, 3, 4, 5, 6, 7, 8,
|
||||
5, 6, 7, 8, 9, 10, 11, 12};
|
||||
|
||||
static u8 PendingForRateUpFail[5] = {2, 10, 24, 40, 60};
|
||||
static u16 DynamicTxRPTTiming[6] = {
|
||||
0x186a, 0x30d4, 0x493e, 0x61a8, 0x7a12 , 0x927c}; /* 200ms-1200ms */
|
||||
|
||||
/* End Rate adaptive parameters */
|
||||
|
||||
static void odm_SetTxRPTTiming_8188E(
|
||||
struct odm_dm_struct *dm_odm,
|
||||
struct odm_ra_info *pRaInfo,
|
||||
u8 extend
|
||||
)
|
||||
{
|
||||
u8 idx = 0;
|
||||
|
||||
for (idx = 0; idx < 5; idx++)
|
||||
if (DynamicTxRPTTiming[idx] == pRaInfo->RptTime)
|
||||
break;
|
||||
|
||||
if (extend == 0) { /* back to default timing */
|
||||
idx = 0; /* 200ms */
|
||||
} else if (extend == 1) {/* increase the timing */
|
||||
idx += 1;
|
||||
if (idx > 5)
|
||||
idx = 5;
|
||||
} else if (extend == 2) {/* decrease the timing */
|
||||
if (idx != 0)
|
||||
idx -= 1;
|
||||
}
|
||||
pRaInfo->RptTime = DynamicTxRPTTiming[idx];
|
||||
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("pRaInfo->RptTime = 0x%x\n", pRaInfo->RptTime));
|
||||
}
|
||||
|
||||
static int odm_RateDown_8188E(struct odm_dm_struct *dm_odm, struct odm_ra_info *pRaInfo)
|
||||
{
|
||||
u8 RateID, LowestRate, HighestRate;
|
||||
u8 i;
|
||||
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("=====>odm_RateDown_8188E()\n"));
|
||||
if (NULL == pRaInfo) {
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("odm_RateDown_8188E(): pRaInfo is NULL\n"));
|
||||
return -1;
|
||||
}
|
||||
RateID = pRaInfo->PreRate;
|
||||
LowestRate = pRaInfo->LowestRate;
|
||||
HighestRate = pRaInfo->HighestRate;
|
||||
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,
|
||||
(" RateID =%d LowestRate =%d HighestRate =%d RateSGI =%d\n",
|
||||
RateID, LowestRate, HighestRate, pRaInfo->RateSGI));
|
||||
if (RateID > HighestRate) {
|
||||
RateID = HighestRate;
|
||||
} else if (pRaInfo->RateSGI) {
|
||||
pRaInfo->RateSGI = 0;
|
||||
} else if (RateID > LowestRate) {
|
||||
if (RateID > 0) {
|
||||
for (i = RateID-1; i > LowestRate; i--) {
|
||||
if (pRaInfo->RAUseRate & BIT(i)) {
|
||||
RateID = i;
|
||||
goto RateDownFinish;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (RateID <= LowestRate) {
|
||||
RateID = LowestRate;
|
||||
}
|
||||
RateDownFinish:
|
||||
if (pRaInfo->RAWaitingCounter == 1) {
|
||||
pRaInfo->RAWaitingCounter += 1;
|
||||
pRaInfo->RAPendingCounter += 1;
|
||||
} else if (pRaInfo->RAWaitingCounter == 0) {
|
||||
;
|
||||
} else {
|
||||
pRaInfo->RAWaitingCounter = 0;
|
||||
pRaInfo->RAPendingCounter = 0;
|
||||
}
|
||||
|
||||
if (pRaInfo->RAPendingCounter >= 4)
|
||||
pRaInfo->RAPendingCounter = 4;
|
||||
|
||||
pRaInfo->DecisionRate = RateID;
|
||||
odm_SetTxRPTTiming_8188E(dm_odm, pRaInfo, 2);
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("Rate down, RPT Timing default\n"));
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("RAWaitingCounter %d, RAPendingCounter %d", pRaInfo->RAWaitingCounter, pRaInfo->RAPendingCounter));
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("Rate down to RateID %d RateSGI %d\n", RateID, pRaInfo->RateSGI));
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("<===== odm_RateDown_8188E()\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int odm_RateUp_8188E(
|
||||
struct odm_dm_struct *dm_odm,
|
||||
struct odm_ra_info *pRaInfo
|
||||
)
|
||||
{
|
||||
u8 RateID, HighestRate;
|
||||
u8 i;
|
||||
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("=====>odm_RateUp_8188E()\n"));
|
||||
if (NULL == pRaInfo) {
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("odm_RateUp_8188E(): pRaInfo is NULL\n"));
|
||||
return -1;
|
||||
}
|
||||
RateID = pRaInfo->PreRate;
|
||||
HighestRate = pRaInfo->HighestRate;
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,
|
||||
(" RateID =%d HighestRate =%d\n",
|
||||
RateID, HighestRate));
|
||||
if (pRaInfo->RAWaitingCounter == 1) {
|
||||
pRaInfo->RAWaitingCounter = 0;
|
||||
pRaInfo->RAPendingCounter = 0;
|
||||
} else if (pRaInfo->RAWaitingCounter > 1) {
|
||||
pRaInfo->PreRssiStaRA = pRaInfo->RssiStaRA;
|
||||
goto RateUpfinish;
|
||||
}
|
||||
odm_SetTxRPTTiming_8188E(dm_odm, pRaInfo, 0);
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("odm_RateUp_8188E():Decrease RPT Timing\n"));
|
||||
|
||||
if (RateID < HighestRate) {
|
||||
for (i = RateID+1; i <= HighestRate; i++) {
|
||||
if (pRaInfo->RAUseRate & BIT(i)) {
|
||||
RateID = i;
|
||||
goto RateUpfinish;
|
||||
}
|
||||
}
|
||||
} else if (RateID == HighestRate) {
|
||||
if (pRaInfo->SGIEnable && (pRaInfo->RateSGI != 1))
|
||||
pRaInfo->RateSGI = 1;
|
||||
else if ((pRaInfo->SGIEnable) != 1)
|
||||
pRaInfo->RateSGI = 0;
|
||||
} else {
|
||||
RateID = HighestRate;
|
||||
}
|
||||
RateUpfinish:
|
||||
if (pRaInfo->RAWaitingCounter == (4+PendingForRateUpFail[pRaInfo->RAPendingCounter]))
|
||||
pRaInfo->RAWaitingCounter = 0;
|
||||
else
|
||||
pRaInfo->RAWaitingCounter++;
|
||||
|
||||
pRaInfo->DecisionRate = RateID;
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("Rate up to RateID %d\n", RateID));
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("RAWaitingCounter %d, RAPendingCounter %d", pRaInfo->RAWaitingCounter, pRaInfo->RAPendingCounter));
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("<===== odm_RateUp_8188E()\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void odm_ResetRaCounter_8188E(struct odm_ra_info *pRaInfo)
|
||||
{
|
||||
u8 RateID;
|
||||
|
||||
RateID = pRaInfo->DecisionRate;
|
||||
pRaInfo->NscUp = (N_THRESHOLD_HIGH[RateID]+N_THRESHOLD_LOW[RateID])>>1;
|
||||
pRaInfo->NscDown = (N_THRESHOLD_HIGH[RateID]+N_THRESHOLD_LOW[RateID])>>1;
|
||||
}
|
||||
|
||||
static void odm_RateDecision_8188E(struct odm_dm_struct *dm_odm,
|
||||
struct odm_ra_info *pRaInfo
|
||||
)
|
||||
{
|
||||
u8 RateID = 0, RtyPtID = 0, PenaltyID1 = 0, PenaltyID2 = 0;
|
||||
/* u32 pool_retry; */
|
||||
static u8 DynamicTxRPTTimingCounter;
|
||||
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("=====>odm_RateDecision_8188E()\n"));
|
||||
|
||||
if (pRaInfo->Active && (pRaInfo->TOTAL > 0)) { /* STA used and data packet exits */
|
||||
if ((pRaInfo->RssiStaRA < (pRaInfo->PreRssiStaRA - 3)) ||
|
||||
(pRaInfo->RssiStaRA > (pRaInfo->PreRssiStaRA + 3))) {
|
||||
pRaInfo->RAWaitingCounter = 0;
|
||||
pRaInfo->RAPendingCounter = 0;
|
||||
}
|
||||
/* Start RA decision */
|
||||
if (pRaInfo->PreRate > pRaInfo->HighestRate)
|
||||
RateID = pRaInfo->HighestRate;
|
||||
else
|
||||
RateID = pRaInfo->PreRate;
|
||||
if (pRaInfo->RssiStaRA > RSSI_THRESHOLD[RateID])
|
||||
RtyPtID = 0;
|
||||
else
|
||||
RtyPtID = 1;
|
||||
PenaltyID1 = RETRY_PENALTY_IDX[RtyPtID][RateID]; /* TODO by page */
|
||||
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,
|
||||
(" NscDown init is %d\n", pRaInfo->NscDown));
|
||||
pRaInfo->NscDown += pRaInfo->RTY[0] * RETRY_PENALTY[PenaltyID1][0];
|
||||
pRaInfo->NscDown += pRaInfo->RTY[1] * RETRY_PENALTY[PenaltyID1][1];
|
||||
pRaInfo->NscDown += pRaInfo->RTY[2] * RETRY_PENALTY[PenaltyID1][2];
|
||||
pRaInfo->NscDown += pRaInfo->RTY[3] * RETRY_PENALTY[PenaltyID1][3];
|
||||
pRaInfo->NscDown += pRaInfo->RTY[4] * RETRY_PENALTY[PenaltyID1][4];
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,
|
||||
(" NscDown is %d, total*penalty[5] is %d\n",
|
||||
pRaInfo->NscDown, (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID1][5])));
|
||||
if (pRaInfo->NscDown > (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID1][5]))
|
||||
pRaInfo->NscDown -= pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID1][5];
|
||||
else
|
||||
pRaInfo->NscDown = 0;
|
||||
|
||||
/* rate up */
|
||||
PenaltyID2 = RETRY_PENALTY_UP_IDX[RateID];
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,
|
||||
(" NscUp init is %d\n", pRaInfo->NscUp));
|
||||
pRaInfo->NscUp += pRaInfo->RTY[0] * RETRY_PENALTY[PenaltyID2][0];
|
||||
pRaInfo->NscUp += pRaInfo->RTY[1] * RETRY_PENALTY[PenaltyID2][1];
|
||||
pRaInfo->NscUp += pRaInfo->RTY[2] * RETRY_PENALTY[PenaltyID2][2];
|
||||
pRaInfo->NscUp += pRaInfo->RTY[3] * RETRY_PENALTY[PenaltyID2][3];
|
||||
pRaInfo->NscUp += pRaInfo->RTY[4] * RETRY_PENALTY[PenaltyID2][4];
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,
|
||||
("NscUp is %d, total*up[5] is %d\n",
|
||||
pRaInfo->NscUp, (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID2][5])));
|
||||
if (pRaInfo->NscUp > (pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID2][5]))
|
||||
pRaInfo->NscUp -= pRaInfo->TOTAL * RETRY_PENALTY[PenaltyID2][5];
|
||||
else
|
||||
pRaInfo->NscUp = 0;
|
||||
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE|ODM_COMP_INIT, ODM_DBG_LOUD,
|
||||
(" RssiStaRa = %d RtyPtID =%d PenaltyID1 = 0x%x PenaltyID2 = 0x%x RateID =%d NscDown =%d NscUp =%d SGI =%d\n",
|
||||
pRaInfo->RssiStaRA, RtyPtID, PenaltyID1, PenaltyID2, RateID, pRaInfo->NscDown, pRaInfo->NscUp, pRaInfo->RateSGI));
|
||||
if ((pRaInfo->NscDown < N_THRESHOLD_LOW[RateID]) ||
|
||||
(pRaInfo->DROP > DROPING_NECESSARY[RateID]))
|
||||
odm_RateDown_8188E(dm_odm, pRaInfo);
|
||||
else if (pRaInfo->NscUp > N_THRESHOLD_HIGH[RateID])
|
||||
odm_RateUp_8188E(dm_odm, pRaInfo);
|
||||
|
||||
if (pRaInfo->DecisionRate > pRaInfo->HighestRate)
|
||||
pRaInfo->DecisionRate = pRaInfo->HighestRate;
|
||||
|
||||
if ((pRaInfo->DecisionRate) == (pRaInfo->PreRate))
|
||||
DynamicTxRPTTimingCounter += 1;
|
||||
else
|
||||
DynamicTxRPTTimingCounter = 0;
|
||||
|
||||
if (DynamicTxRPTTimingCounter >= 4) {
|
||||
odm_SetTxRPTTiming_8188E(dm_odm, pRaInfo, 1);
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE,
|
||||
ODM_DBG_LOUD, ("<===== Rate don't change 4 times, Extend RPT Timing\n"));
|
||||
DynamicTxRPTTimingCounter = 0;
|
||||
}
|
||||
|
||||
pRaInfo->PreRate = pRaInfo->DecisionRate; /* YJ, add, 120120 */
|
||||
|
||||
odm_ResetRaCounter_8188E(pRaInfo);
|
||||
}
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("<===== odm_RateDecision_8188E()\n"));
|
||||
}
|
||||
|
||||
static int odm_ARFBRefresh_8188E(struct odm_dm_struct *dm_odm, struct odm_ra_info *pRaInfo)
|
||||
{ /* Wilson 2011/10/26 */
|
||||
u32 MaskFromReg;
|
||||
s8 i;
|
||||
|
||||
switch (pRaInfo->RateID) {
|
||||
case RATR_INX_WIRELESS_NGB:
|
||||
pRaInfo->RAUseRate = (pRaInfo->RateMask)&0x0f8ff015;
|
||||
break;
|
||||
case RATR_INX_WIRELESS_NG:
|
||||
pRaInfo->RAUseRate = (pRaInfo->RateMask)&0x0f8ff010;
|
||||
break;
|
||||
case RATR_INX_WIRELESS_NB:
|
||||
pRaInfo->RAUseRate = (pRaInfo->RateMask)&0x0f8ff005;
|
||||
break;
|
||||
case RATR_INX_WIRELESS_N:
|
||||
pRaInfo->RAUseRate = (pRaInfo->RateMask)&0x0f8ff000;
|
||||
break;
|
||||
case RATR_INX_WIRELESS_GB:
|
||||
pRaInfo->RAUseRate = (pRaInfo->RateMask)&0x00000ff5;
|
||||
break;
|
||||
case RATR_INX_WIRELESS_G:
|
||||
pRaInfo->RAUseRate = (pRaInfo->RateMask)&0x00000ff0;
|
||||
break;
|
||||
case RATR_INX_WIRELESS_B:
|
||||
pRaInfo->RAUseRate = (pRaInfo->RateMask)&0x0000000d;
|
||||
break;
|
||||
case 12:
|
||||
MaskFromReg = ODM_Read4Byte(dm_odm, REG_ARFR0);
|
||||
pRaInfo->RAUseRate = (pRaInfo->RateMask)&MaskFromReg;
|
||||
break;
|
||||
case 13:
|
||||
MaskFromReg = ODM_Read4Byte(dm_odm, REG_ARFR1);
|
||||
pRaInfo->RAUseRate = (pRaInfo->RateMask)&MaskFromReg;
|
||||
break;
|
||||
case 14:
|
||||
MaskFromReg = ODM_Read4Byte(dm_odm, REG_ARFR2);
|
||||
pRaInfo->RAUseRate = (pRaInfo->RateMask)&MaskFromReg;
|
||||
break;
|
||||
case 15:
|
||||
MaskFromReg = ODM_Read4Byte(dm_odm, REG_ARFR3);
|
||||
pRaInfo->RAUseRate = (pRaInfo->RateMask)&MaskFromReg;
|
||||
break;
|
||||
default:
|
||||
pRaInfo->RAUseRate = (pRaInfo->RateMask);
|
||||
break;
|
||||
}
|
||||
/* Highest rate */
|
||||
if (pRaInfo->RAUseRate) {
|
||||
for (i = RATESIZE; i >= 0; i--) {
|
||||
if ((pRaInfo->RAUseRate)&BIT(i)) {
|
||||
pRaInfo->HighestRate = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pRaInfo->HighestRate = 0;
|
||||
}
|
||||
/* Lowest rate */
|
||||
if (pRaInfo->RAUseRate) {
|
||||
for (i = 0; i < RATESIZE; i++) {
|
||||
if ((pRaInfo->RAUseRate) & BIT(i)) {
|
||||
pRaInfo->LowestRate = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pRaInfo->LowestRate = 0;
|
||||
}
|
||||
if (pRaInfo->HighestRate > 0x13)
|
||||
pRaInfo->PTModeSS = 3;
|
||||
else if (pRaInfo->HighestRate > 0x0b)
|
||||
pRaInfo->PTModeSS = 2;
|
||||
else if (pRaInfo->HighestRate > 0x03)
|
||||
pRaInfo->PTModeSS = 1;
|
||||
else
|
||||
pRaInfo->PTModeSS = 0;
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD,
|
||||
("ODM_ARFBRefresh_8188E(): PTModeSS =%d\n", pRaInfo->PTModeSS));
|
||||
|
||||
if (pRaInfo->DecisionRate > pRaInfo->HighestRate)
|
||||
pRaInfo->DecisionRate = pRaInfo->HighestRate;
|
||||
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD,
|
||||
("ODM_ARFBRefresh_8188E(): RateID =%d RateMask =%8.8x RAUseRate =%8.8x HighestRate =%d, DecisionRate =%d\n",
|
||||
pRaInfo->RateID, pRaInfo->RateMask, pRaInfo->RAUseRate, pRaInfo->HighestRate, pRaInfo->DecisionRate));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void odm_PTTryState_8188E(struct odm_ra_info *pRaInfo)
|
||||
{
|
||||
pRaInfo->PTTryState = 0;
|
||||
switch (pRaInfo->PTModeSS) {
|
||||
case 3:
|
||||
if (pRaInfo->DecisionRate >= 0x19)
|
||||
pRaInfo->PTTryState = 1;
|
||||
break;
|
||||
case 2:
|
||||
if (pRaInfo->DecisionRate >= 0x11)
|
||||
pRaInfo->PTTryState = 1;
|
||||
break;
|
||||
case 1:
|
||||
if (pRaInfo->DecisionRate >= 0x0a)
|
||||
pRaInfo->PTTryState = 1;
|
||||
break;
|
||||
case 0:
|
||||
if (pRaInfo->DecisionRate >= 0x03)
|
||||
pRaInfo->PTTryState = 1;
|
||||
break;
|
||||
default:
|
||||
pRaInfo->PTTryState = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (pRaInfo->RssiStaRA < 48) {
|
||||
pRaInfo->PTStage = 0;
|
||||
} else if (pRaInfo->PTTryState == 1) {
|
||||
if ((pRaInfo->PTStopCount >= 10) ||
|
||||
(pRaInfo->PTPreRssi > pRaInfo->RssiStaRA + 5) ||
|
||||
(pRaInfo->PTPreRssi < pRaInfo->RssiStaRA - 5) ||
|
||||
(pRaInfo->DecisionRate != pRaInfo->PTPreRate)) {
|
||||
if (pRaInfo->PTStage == 0)
|
||||
pRaInfo->PTStage = 1;
|
||||
else if (pRaInfo->PTStage == 1)
|
||||
pRaInfo->PTStage = 3;
|
||||
else
|
||||
pRaInfo->PTStage = 5;
|
||||
|
||||
pRaInfo->PTPreRssi = pRaInfo->RssiStaRA;
|
||||
pRaInfo->PTStopCount = 0;
|
||||
} else {
|
||||
pRaInfo->RAstage = 0;
|
||||
pRaInfo->PTStopCount++;
|
||||
}
|
||||
} else {
|
||||
pRaInfo->PTStage = 0;
|
||||
pRaInfo->RAstage = 0;
|
||||
}
|
||||
pRaInfo->PTPreRate = pRaInfo->DecisionRate;
|
||||
}
|
||||
|
||||
static void odm_PTDecision_8188E(struct odm_ra_info *pRaInfo)
|
||||
{
|
||||
u8 j;
|
||||
u8 temp_stage;
|
||||
u32 numsc;
|
||||
u32 num_total;
|
||||
u8 stage_id;
|
||||
|
||||
numsc = 0;
|
||||
num_total = pRaInfo->TOTAL * PT_PENALTY[5];
|
||||
for (j = 0; j <= 4; j++) {
|
||||
numsc += pRaInfo->RTY[j] * PT_PENALTY[j];
|
||||
if (numsc > num_total)
|
||||
break;
|
||||
}
|
||||
|
||||
j = j >> 1;
|
||||
temp_stage = (pRaInfo->PTStage + 1) >> 1;
|
||||
if (temp_stage > j)
|
||||
stage_id = temp_stage-j;
|
||||
else
|
||||
stage_id = 0;
|
||||
|
||||
pRaInfo->PTSmoothFactor = (pRaInfo->PTSmoothFactor>>1) + (pRaInfo->PTSmoothFactor>>2) + stage_id*16+2;
|
||||
if (pRaInfo->PTSmoothFactor > 192)
|
||||
pRaInfo->PTSmoothFactor = 192;
|
||||
stage_id = pRaInfo->PTSmoothFactor >> 6;
|
||||
temp_stage = stage_id*2;
|
||||
if (temp_stage != 0)
|
||||
temp_stage -= 1;
|
||||
if (pRaInfo->DROP > 3)
|
||||
temp_stage = 0;
|
||||
pRaInfo->PTStage = temp_stage;
|
||||
}
|
||||
|
||||
static void
|
||||
odm_RATxRPTTimerSetting(
|
||||
struct odm_dm_struct *dm_odm,
|
||||
u16 minRptTime
|
||||
)
|
||||
{
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, (" =====>odm_RATxRPTTimerSetting()\n"));
|
||||
|
||||
if (dm_odm->CurrminRptTime != minRptTime) {
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD,
|
||||
(" CurrminRptTime = 0x%04x minRptTime = 0x%04x\n", dm_odm->CurrminRptTime, minRptTime));
|
||||
rtw_rpt_timer_cfg_cmd(dm_odm->Adapter, minRptTime);
|
||||
dm_odm->CurrminRptTime = minRptTime;
|
||||
}
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, (" <===== odm_RATxRPTTimerSetting()\n"));
|
||||
}
|
||||
|
||||
void
|
||||
ODM_RASupport_Init(
|
||||
struct odm_dm_struct *dm_odm
|
||||
)
|
||||
{
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("=====>ODM_RASupport_Init()\n"));
|
||||
|
||||
/* 2012/02/14 MH Be noticed, the init must be after IC type is recognized!!!!! */
|
||||
if (dm_odm->SupportICType == ODM_RTL8188E)
|
||||
dm_odm->RaSupport88E = true;
|
||||
}
|
||||
|
||||
int ODM_RAInfo_Init(struct odm_dm_struct *dm_odm, u8 macid)
|
||||
{
|
||||
struct odm_ra_info *pRaInfo = &dm_odm->RAInfo[macid];
|
||||
u8 WirelessMode = 0xFF; /* invalid value */
|
||||
u8 max_rate_idx = 0x13; /* MCS7 */
|
||||
if (dm_odm->pWirelessMode != NULL)
|
||||
WirelessMode = *(dm_odm->pWirelessMode);
|
||||
|
||||
if (WirelessMode != 0xFF) {
|
||||
if (WirelessMode & ODM_WM_N24G)
|
||||
max_rate_idx = 0x13;
|
||||
else if (WirelessMode & ODM_WM_G)
|
||||
max_rate_idx = 0x0b;
|
||||
else if (WirelessMode & ODM_WM_B)
|
||||
max_rate_idx = 0x03;
|
||||
}
|
||||
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD,
|
||||
("ODM_RAInfo_Init(): WirelessMode:0x%08x , max_raid_idx:0x%02x\n",
|
||||
WirelessMode, max_rate_idx));
|
||||
|
||||
pRaInfo->DecisionRate = max_rate_idx;
|
||||
pRaInfo->PreRate = max_rate_idx;
|
||||
pRaInfo->HighestRate = max_rate_idx;
|
||||
pRaInfo->LowestRate = 0;
|
||||
pRaInfo->RateID = 0;
|
||||
pRaInfo->RateMask = 0xffffffff;
|
||||
pRaInfo->RssiStaRA = 0;
|
||||
pRaInfo->PreRssiStaRA = 0;
|
||||
pRaInfo->SGIEnable = 0;
|
||||
pRaInfo->RAUseRate = 0xffffffff;
|
||||
pRaInfo->NscDown = (N_THRESHOLD_HIGH[0x13]+N_THRESHOLD_LOW[0x13])/2;
|
||||
pRaInfo->NscUp = (N_THRESHOLD_HIGH[0x13]+N_THRESHOLD_LOW[0x13])/2;
|
||||
pRaInfo->RateSGI = 0;
|
||||
pRaInfo->Active = 1; /* Active is not used at present. by page, 110819 */
|
||||
pRaInfo->RptTime = 0x927c;
|
||||
pRaInfo->DROP = 0;
|
||||
pRaInfo->RTY[0] = 0;
|
||||
pRaInfo->RTY[1] = 0;
|
||||
pRaInfo->RTY[2] = 0;
|
||||
pRaInfo->RTY[3] = 0;
|
||||
pRaInfo->RTY[4] = 0;
|
||||
pRaInfo->TOTAL = 0;
|
||||
pRaInfo->RAWaitingCounter = 0;
|
||||
pRaInfo->RAPendingCounter = 0;
|
||||
pRaInfo->PTActive = 1; /* Active when this STA is use */
|
||||
pRaInfo->PTTryState = 0;
|
||||
pRaInfo->PTStage = 5; /* Need to fill into HW_PWR_STATUS */
|
||||
pRaInfo->PTSmoothFactor = 192;
|
||||
pRaInfo->PTStopCount = 0;
|
||||
pRaInfo->PTPreRate = 0;
|
||||
pRaInfo->PTPreRssi = 0;
|
||||
pRaInfo->PTModeSS = 0;
|
||||
pRaInfo->RAstage = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ODM_RAInfo_Init_all(struct odm_dm_struct *dm_odm)
|
||||
{
|
||||
u8 macid = 0;
|
||||
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("=====>\n"));
|
||||
dm_odm->CurrminRptTime = 0;
|
||||
|
||||
for (macid = 0; macid < ODM_ASSOCIATE_ENTRY_NUM; macid++)
|
||||
ODM_RAInfo_Init(dm_odm, macid);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8 ODM_RA_GetShortGI_8188E(struct odm_dm_struct *dm_odm, u8 macid)
|
||||
{
|
||||
if ((NULL == dm_odm) || (macid >= ASSOCIATE_ENTRY_NUM))
|
||||
return 0;
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,
|
||||
("macid =%d SGI =%d\n", macid, dm_odm->RAInfo[macid].RateSGI));
|
||||
return dm_odm->RAInfo[macid].RateSGI;
|
||||
}
|
||||
|
||||
u8 ODM_RA_GetDecisionRate_8188E(struct odm_dm_struct *dm_odm, u8 macid)
|
||||
{
|
||||
u8 DecisionRate = 0;
|
||||
|
||||
if ((NULL == dm_odm) || (macid >= ASSOCIATE_ENTRY_NUM))
|
||||
return 0;
|
||||
DecisionRate = (dm_odm->RAInfo[macid].DecisionRate);
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,
|
||||
(" macid =%d DecisionRate = 0x%x\n", macid, DecisionRate));
|
||||
return DecisionRate;
|
||||
}
|
||||
|
||||
u8 ODM_RA_GetHwPwrStatus_8188E(struct odm_dm_struct *dm_odm, u8 macid)
|
||||
{
|
||||
u8 PTStage = 5;
|
||||
|
||||
if ((NULL == dm_odm) || (macid >= ASSOCIATE_ENTRY_NUM))
|
||||
return 0;
|
||||
PTStage = (dm_odm->RAInfo[macid].PTStage);
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,
|
||||
("macid =%d PTStage = 0x%x\n", macid, PTStage));
|
||||
return PTStage;
|
||||
}
|
||||
|
||||
void ODM_RA_UpdateRateInfo_8188E(struct odm_dm_struct *dm_odm, u8 macid, u8 RateID, u32 RateMask, u8 SGIEnable)
|
||||
{
|
||||
struct odm_ra_info *pRaInfo = NULL;
|
||||
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD,
|
||||
("macid =%d RateID = 0x%x RateMask = 0x%x SGIEnable =%d\n",
|
||||
macid, RateID, RateMask, SGIEnable));
|
||||
if ((NULL == dm_odm) || (macid >= ASSOCIATE_ENTRY_NUM))
|
||||
return;
|
||||
|
||||
pRaInfo = &(dm_odm->RAInfo[macid]);
|
||||
pRaInfo->RateID = RateID;
|
||||
pRaInfo->RateMask = RateMask;
|
||||
pRaInfo->SGIEnable = SGIEnable;
|
||||
odm_ARFBRefresh_8188E(dm_odm, pRaInfo);
|
||||
}
|
||||
|
||||
void ODM_RA_SetRSSI_8188E(struct odm_dm_struct *dm_odm, u8 macid, u8 Rssi)
|
||||
{
|
||||
struct odm_ra_info *pRaInfo = NULL;
|
||||
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,
|
||||
(" macid =%d Rssi =%d\n", macid, Rssi));
|
||||
if ((NULL == dm_odm) || (macid >= ASSOCIATE_ENTRY_NUM))
|
||||
return;
|
||||
|
||||
pRaInfo = &(dm_odm->RAInfo[macid]);
|
||||
pRaInfo->RssiStaRA = Rssi;
|
||||
}
|
||||
|
||||
void ODM_RA_Set_TxRPT_Time(struct odm_dm_struct *dm_odm, u16 minRptTime)
|
||||
{
|
||||
ODM_Write2Byte(dm_odm, REG_TX_RPT_TIME, minRptTime);
|
||||
}
|
||||
|
||||
void ODM_RA_TxRPT2Handle_8188E(struct odm_dm_struct *dm_odm, u8 *TxRPT_Buf, u16 TxRPT_Len, u32 macid_entry0, u32 macid_entry1)
|
||||
{
|
||||
struct odm_ra_info *pRAInfo = NULL;
|
||||
u8 MacId = 0;
|
||||
u8 *pBuffer = NULL;
|
||||
u32 valid = 0, ItemNum = 0;
|
||||
u16 minRptTime = 0x927c;
|
||||
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD,
|
||||
("=====>ODM_RA_TxRPT2Handle_8188E(): valid0 =%d valid1 =%d BufferLength =%d\n",
|
||||
macid_entry0, macid_entry1, TxRPT_Len));
|
||||
|
||||
ItemNum = TxRPT_Len >> 3;
|
||||
pBuffer = TxRPT_Buf;
|
||||
|
||||
do {
|
||||
if (MacId >= ASSOCIATE_ENTRY_NUM)
|
||||
valid = 0;
|
||||
else if (MacId >= 32)
|
||||
valid = (1 << (MacId - 32)) & macid_entry1;
|
||||
else
|
||||
valid = (1 << MacId) & macid_entry0;
|
||||
|
||||
pRAInfo = &(dm_odm->RAInfo[MacId]);
|
||||
if (valid) {
|
||||
pRAInfo->RTY[0] = (u16)GET_TX_REPORT_TYPE1_RERTY_0(pBuffer);
|
||||
pRAInfo->RTY[1] = (u16)GET_TX_REPORT_TYPE1_RERTY_1(pBuffer);
|
||||
pRAInfo->RTY[2] = (u16)GET_TX_REPORT_TYPE1_RERTY_2(pBuffer);
|
||||
pRAInfo->RTY[3] = (u16)GET_TX_REPORT_TYPE1_RERTY_3(pBuffer);
|
||||
pRAInfo->RTY[4] = (u16)GET_TX_REPORT_TYPE1_RERTY_4(pBuffer);
|
||||
pRAInfo->DROP = (u16)GET_TX_REPORT_TYPE1_DROP_0(pBuffer);
|
||||
pRAInfo->TOTAL = pRAInfo->RTY[0] + pRAInfo->RTY[1] +
|
||||
pRAInfo->RTY[2] + pRAInfo->RTY[3] +
|
||||
pRAInfo->RTY[4] + pRAInfo->DROP;
|
||||
if (pRAInfo->TOTAL != 0) {
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD,
|
||||
("macid =%d Total =%d R0 =%d R1 =%d R2 =%d R3 =%d R4 =%d D0 =%d valid0 =%x valid1 =%x\n",
|
||||
MacId, pRAInfo->TOTAL,
|
||||
pRAInfo->RTY[0], pRAInfo->RTY[1],
|
||||
pRAInfo->RTY[2], pRAInfo->RTY[3],
|
||||
pRAInfo->RTY[4], pRAInfo->DROP,
|
||||
macid_entry0 , macid_entry1));
|
||||
if (pRAInfo->PTActive) {
|
||||
if (pRAInfo->RAstage < 5)
|
||||
odm_RateDecision_8188E(dm_odm, pRAInfo);
|
||||
else if (pRAInfo->RAstage == 5) /* Power training try state */
|
||||
odm_PTTryState_8188E(pRAInfo);
|
||||
else /* RAstage == 6 */
|
||||
odm_PTDecision_8188E(pRAInfo);
|
||||
|
||||
/* Stage_RA counter */
|
||||
if (pRAInfo->RAstage <= 5)
|
||||
pRAInfo->RAstage++;
|
||||
else
|
||||
pRAInfo->RAstage = 0;
|
||||
} else {
|
||||
odm_RateDecision_8188E(dm_odm, pRAInfo);
|
||||
}
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_INIT, ODM_DBG_LOUD,
|
||||
("macid =%d R0 =%d R1 =%d R2 =%d R3 =%d R4 =%d drop =%d valid0 =%x RateID =%d SGI =%d\n",
|
||||
MacId,
|
||||
pRAInfo->RTY[0],
|
||||
pRAInfo->RTY[1],
|
||||
pRAInfo->RTY[2],
|
||||
pRAInfo->RTY[3],
|
||||
pRAInfo->RTY[4],
|
||||
pRAInfo->DROP,
|
||||
macid_entry0,
|
||||
pRAInfo->DecisionRate,
|
||||
pRAInfo->RateSGI));
|
||||
} else {
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, (" TOTAL = 0!!!!\n"));
|
||||
}
|
||||
}
|
||||
|
||||
if (minRptTime > pRAInfo->RptTime)
|
||||
minRptTime = pRAInfo->RptTime;
|
||||
|
||||
pBuffer += TX_RPT2_ITEM_SIZE;
|
||||
MacId++;
|
||||
} while (MacId < ItemNum);
|
||||
|
||||
odm_RATxRPTTimerSetting(dm_odm, minRptTime);
|
||||
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("<===== ODM_RA_TxRPT2Handle_8188E()\n"));
|
||||
}
|
||||
720
drivers/net/wireless/realtek/rtl8188eu/hal/HalHWImg8188E_BB.c
Normal file
720
drivers/net/wireless/realtek/rtl8188eu/hal/HalHWImg8188E_BB.c
Normal file
@@ -0,0 +1,720 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "odm_precomp.h"
|
||||
|
||||
#include <rtw_iol.h>
|
||||
|
||||
#define read_next_pair(array, v1, v2, i) \
|
||||
do { \
|
||||
i += 2; \
|
||||
v1 = array[i]; \
|
||||
v2 = array[i+1]; \
|
||||
} while (0)
|
||||
|
||||
static bool CheckCondition(const u32 condition, const u32 hex)
|
||||
{
|
||||
u32 _board = (hex & 0x000000FF);
|
||||
u32 _interface = (hex & 0x0000FF00) >> 8;
|
||||
u32 _platform = (hex & 0x00FF0000) >> 16;
|
||||
u32 cond = condition;
|
||||
|
||||
if (condition == 0xCDCDCDCD)
|
||||
return true;
|
||||
|
||||
cond = condition & 0x000000FF;
|
||||
if ((_board == cond) && cond != 0x00)
|
||||
return false;
|
||||
|
||||
cond = condition & 0x0000FF00;
|
||||
cond = cond >> 8;
|
||||
if ((_interface & cond) == 0 && cond != 0x07)
|
||||
return false;
|
||||
|
||||
cond = condition & 0x00FF0000;
|
||||
cond = cond >> 16;
|
||||
if ((_platform & cond) == 0 && cond != 0x0F)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* AGC_TAB_1T.TXT
|
||||
******************************************************************************/
|
||||
|
||||
static u32 array_agc_tab_1t_8188e[] = {
|
||||
0xC78, 0xFB000001,
|
||||
0xC78, 0xFB010001,
|
||||
0xC78, 0xFB020001,
|
||||
0xC78, 0xFB030001,
|
||||
0xC78, 0xFB040001,
|
||||
0xC78, 0xFB050001,
|
||||
0xC78, 0xFA060001,
|
||||
0xC78, 0xF9070001,
|
||||
0xC78, 0xF8080001,
|
||||
0xC78, 0xF7090001,
|
||||
0xC78, 0xF60A0001,
|
||||
0xC78, 0xF50B0001,
|
||||
0xC78, 0xF40C0001,
|
||||
0xC78, 0xF30D0001,
|
||||
0xC78, 0xF20E0001,
|
||||
0xC78, 0xF10F0001,
|
||||
0xC78, 0xF0100001,
|
||||
0xC78, 0xEF110001,
|
||||
0xC78, 0xEE120001,
|
||||
0xC78, 0xED130001,
|
||||
0xC78, 0xEC140001,
|
||||
0xC78, 0xEB150001,
|
||||
0xC78, 0xEA160001,
|
||||
0xC78, 0xE9170001,
|
||||
0xC78, 0xE8180001,
|
||||
0xC78, 0xE7190001,
|
||||
0xC78, 0xE61A0001,
|
||||
0xC78, 0xE51B0001,
|
||||
0xC78, 0xE41C0001,
|
||||
0xC78, 0xE31D0001,
|
||||
0xC78, 0xE21E0001,
|
||||
0xC78, 0xE11F0001,
|
||||
0xC78, 0x8A200001,
|
||||
0xC78, 0x89210001,
|
||||
0xC78, 0x88220001,
|
||||
0xC78, 0x87230001,
|
||||
0xC78, 0x86240001,
|
||||
0xC78, 0x85250001,
|
||||
0xC78, 0x84260001,
|
||||
0xC78, 0x83270001,
|
||||
0xC78, 0x82280001,
|
||||
0xC78, 0x6B290001,
|
||||
0xC78, 0x6A2A0001,
|
||||
0xC78, 0x692B0001,
|
||||
0xC78, 0x682C0001,
|
||||
0xC78, 0x672D0001,
|
||||
0xC78, 0x662E0001,
|
||||
0xC78, 0x652F0001,
|
||||
0xC78, 0x64300001,
|
||||
0xC78, 0x63310001,
|
||||
0xC78, 0x62320001,
|
||||
0xC78, 0x61330001,
|
||||
0xC78, 0x46340001,
|
||||
0xC78, 0x45350001,
|
||||
0xC78, 0x44360001,
|
||||
0xC78, 0x43370001,
|
||||
0xC78, 0x42380001,
|
||||
0xC78, 0x41390001,
|
||||
0xC78, 0x403A0001,
|
||||
0xC78, 0x403B0001,
|
||||
0xC78, 0x403C0001,
|
||||
0xC78, 0x403D0001,
|
||||
0xC78, 0x403E0001,
|
||||
0xC78, 0x403F0001,
|
||||
0xC78, 0xFB400001,
|
||||
0xC78, 0xFB410001,
|
||||
0xC78, 0xFB420001,
|
||||
0xC78, 0xFB430001,
|
||||
0xC78, 0xFB440001,
|
||||
0xC78, 0xFB450001,
|
||||
0xC78, 0xFB460001,
|
||||
0xC78, 0xFB470001,
|
||||
0xC78, 0xFB480001,
|
||||
0xC78, 0xFA490001,
|
||||
0xC78, 0xF94A0001,
|
||||
0xC78, 0xF84B0001,
|
||||
0xC78, 0xF74C0001,
|
||||
0xC78, 0xF64D0001,
|
||||
0xC78, 0xF54E0001,
|
||||
0xC78, 0xF44F0001,
|
||||
0xC78, 0xF3500001,
|
||||
0xC78, 0xF2510001,
|
||||
0xC78, 0xF1520001,
|
||||
0xC78, 0xF0530001,
|
||||
0xC78, 0xEF540001,
|
||||
0xC78, 0xEE550001,
|
||||
0xC78, 0xED560001,
|
||||
0xC78, 0xEC570001,
|
||||
0xC78, 0xEB580001,
|
||||
0xC78, 0xEA590001,
|
||||
0xC78, 0xE95A0001,
|
||||
0xC78, 0xE85B0001,
|
||||
0xC78, 0xE75C0001,
|
||||
0xC78, 0xE65D0001,
|
||||
0xC78, 0xE55E0001,
|
||||
0xC78, 0xE45F0001,
|
||||
0xC78, 0xE3600001,
|
||||
0xC78, 0xE2610001,
|
||||
0xC78, 0xC3620001,
|
||||
0xC78, 0xC2630001,
|
||||
0xC78, 0xC1640001,
|
||||
0xC78, 0x8B650001,
|
||||
0xC78, 0x8A660001,
|
||||
0xC78, 0x89670001,
|
||||
0xC78, 0x88680001,
|
||||
0xC78, 0x87690001,
|
||||
0xC78, 0x866A0001,
|
||||
0xC78, 0x856B0001,
|
||||
0xC78, 0x846C0001,
|
||||
0xC78, 0x676D0001,
|
||||
0xC78, 0x666E0001,
|
||||
0xC78, 0x656F0001,
|
||||
0xC78, 0x64700001,
|
||||
0xC78, 0x63710001,
|
||||
0xC78, 0x62720001,
|
||||
0xC78, 0x61730001,
|
||||
0xC78, 0x60740001,
|
||||
0xC78, 0x46750001,
|
||||
0xC78, 0x45760001,
|
||||
0xC78, 0x44770001,
|
||||
0xC78, 0x43780001,
|
||||
0xC78, 0x42790001,
|
||||
0xC78, 0x417A0001,
|
||||
0xC78, 0x407B0001,
|
||||
0xC78, 0x407C0001,
|
||||
0xC78, 0x407D0001,
|
||||
0xC78, 0x407E0001,
|
||||
0xC78, 0x407F0001,
|
||||
};
|
||||
|
||||
enum HAL_STATUS ODM_ReadAndConfig_AGC_TAB_1T_8188E(struct odm_dm_struct *dm_odm)
|
||||
{
|
||||
u32 hex = 0;
|
||||
u32 i = 0;
|
||||
u8 platform = dm_odm->SupportPlatform;
|
||||
u8 interfaceValue = dm_odm->SupportInterface;
|
||||
u8 board = dm_odm->BoardType;
|
||||
u32 arraylen = sizeof(array_agc_tab_1t_8188e)/sizeof(u32);
|
||||
u32 *array = array_agc_tab_1t_8188e;
|
||||
bool biol = false;
|
||||
struct adapter *adapter = dm_odm->Adapter;
|
||||
struct xmit_frame *pxmit_frame = NULL;
|
||||
u8 bndy_cnt = 1;
|
||||
enum HAL_STATUS rst = HAL_STATUS_SUCCESS;
|
||||
|
||||
hex += board;
|
||||
hex += interfaceValue << 8;
|
||||
hex += platform << 16;
|
||||
hex += 0xFF000000;
|
||||
biol = rtw_IOL_applied(adapter);
|
||||
|
||||
if (biol) {
|
||||
pxmit_frame = rtw_IOL_accquire_xmit_frame(adapter);
|
||||
if (pxmit_frame == NULL) {
|
||||
pr_info("rtw_IOL_accquire_xmit_frame failed\n");
|
||||
return HAL_STATUS_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < arraylen; i += 2) {
|
||||
u32 v1 = array[i];
|
||||
u32 v2 = array[i+1];
|
||||
|
||||
/* This (offset, data) pair meets the condition. */
|
||||
if (v1 < 0xCDCDCDCD) {
|
||||
if (biol) {
|
||||
if (rtw_IOL_cmd_boundary_handle(pxmit_frame))
|
||||
bndy_cnt++;
|
||||
rtw_IOL_append_WD_cmd(pxmit_frame, (u16)v1, v2, bMaskDWord);
|
||||
} else {
|
||||
odm_ConfigBB_AGC_8188E(dm_odm, v1, bMaskDWord, v2);
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
/* This line is the start line of branch. */
|
||||
if (!CheckCondition(array[i], hex)) {
|
||||
/* Discard the following (offset, data) pairs. */
|
||||
read_next_pair(array, v1, v2, i);
|
||||
while (v2 != 0xDEAD &&
|
||||
v2 != 0xCDEF &&
|
||||
v2 != 0xCDCD && i < arraylen - 2)
|
||||
read_next_pair(array, v1, v2, i);
|
||||
i -= 2; /* prevent from for-loop += 2 */
|
||||
} else { /* Configure matched pairs and skip to end of if-else. */
|
||||
read_next_pair(array, v1, v2, i);
|
||||
while (v2 != 0xDEAD &&
|
||||
v2 != 0xCDEF &&
|
||||
v2 != 0xCDCD && i < arraylen - 2) {
|
||||
if (biol) {
|
||||
if (rtw_IOL_cmd_boundary_handle(pxmit_frame))
|
||||
bndy_cnt++;
|
||||
rtw_IOL_append_WD_cmd(pxmit_frame, (u16)v1, v2, bMaskDWord);
|
||||
} else {
|
||||
odm_ConfigBB_AGC_8188E(dm_odm, v1, bMaskDWord, v2);
|
||||
}
|
||||
read_next_pair(array, v1, v2, i);
|
||||
}
|
||||
|
||||
while (v2 != 0xDEAD && i < arraylen - 2)
|
||||
read_next_pair(array, v1, v2, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (biol) {
|
||||
if (!rtw_IOL_exec_cmds_sync(dm_odm->Adapter, pxmit_frame, 1000, bndy_cnt)) {
|
||||
printk("~~~ %s IOL_exec_cmds Failed !!!\n", __func__);
|
||||
rst = HAL_STATUS_FAILURE;
|
||||
}
|
||||
}
|
||||
return rst;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* PHY_REG_1T.TXT
|
||||
******************************************************************************/
|
||||
|
||||
static u32 array_phy_reg_1t_8188e[] = {
|
||||
0x800, 0x80040000,
|
||||
0x804, 0x00000003,
|
||||
0x808, 0x0000FC00,
|
||||
0x80C, 0x0000000A,
|
||||
0x810, 0x10001331,
|
||||
0x814, 0x020C3D10,
|
||||
0x818, 0x02200385,
|
||||
0x81C, 0x00000000,
|
||||
0x820, 0x01000100,
|
||||
0x824, 0x00390204,
|
||||
0x828, 0x00000000,
|
||||
0x82C, 0x00000000,
|
||||
0x830, 0x00000000,
|
||||
0x834, 0x00000000,
|
||||
0x838, 0x00000000,
|
||||
0x83C, 0x00000000,
|
||||
0x840, 0x00010000,
|
||||
0x844, 0x00000000,
|
||||
0x848, 0x00000000,
|
||||
0x84C, 0x00000000,
|
||||
0x850, 0x00000000,
|
||||
0x854, 0x00000000,
|
||||
0x858, 0x569A11A9,
|
||||
0x85C, 0x01000014,
|
||||
0x860, 0x66F60110,
|
||||
0x864, 0x061F0649,
|
||||
0x868, 0x00000000,
|
||||
0x86C, 0x27272700,
|
||||
0x870, 0x07000760,
|
||||
0x874, 0x25004000,
|
||||
0x878, 0x00000808,
|
||||
0x87C, 0x00000000,
|
||||
0x880, 0xB0000C1C,
|
||||
0x884, 0x00000001,
|
||||
0x888, 0x00000000,
|
||||
0x88C, 0xCCC000C0,
|
||||
0x890, 0x00000800,
|
||||
0x894, 0xFFFFFFFE,
|
||||
0x898, 0x40302010,
|
||||
0x89C, 0x00706050,
|
||||
0x900, 0x00000000,
|
||||
0x904, 0x00000023,
|
||||
0x908, 0x00000000,
|
||||
0x90C, 0x81121111,
|
||||
0x910, 0x00000002,
|
||||
0x914, 0x00000201,
|
||||
0xA00, 0x00D047C8,
|
||||
0xA04, 0x80FF000C,
|
||||
0xA08, 0x8C838300,
|
||||
0xA0C, 0x2E7F120F,
|
||||
0xA10, 0x9500BB78,
|
||||
0xA14, 0x1114D028,
|
||||
0xA18, 0x00881117,
|
||||
0xA1C, 0x89140F00,
|
||||
0xA20, 0x1A1B0000,
|
||||
0xA24, 0x090E1317,
|
||||
0xA28, 0x00000204,
|
||||
0xA2C, 0x00D30000,
|
||||
0xA70, 0x101FBF00,
|
||||
0xA74, 0x00000007,
|
||||
0xA78, 0x00000900,
|
||||
0xA7C, 0x225B0606,
|
||||
0xA80, 0x218075B1,
|
||||
0xB2C, 0x80000000,
|
||||
0xC00, 0x48071D40,
|
||||
0xC04, 0x03A05611,
|
||||
0xC08, 0x000000E4,
|
||||
0xC0C, 0x6C6C6C6C,
|
||||
0xC10, 0x08800000,
|
||||
0xC14, 0x40000100,
|
||||
0xC18, 0x08800000,
|
||||
0xC1C, 0x40000100,
|
||||
0xC20, 0x00000000,
|
||||
0xC24, 0x00000000,
|
||||
0xC28, 0x00000000,
|
||||
0xC2C, 0x00000000,
|
||||
0xC30, 0x69E9AC47,
|
||||
0xC34, 0x469652AF,
|
||||
0xC38, 0x49795994,
|
||||
0xC3C, 0x0A97971C,
|
||||
0xC40, 0x1F7C403F,
|
||||
0xC44, 0x000100B7,
|
||||
0xC48, 0xEC020107,
|
||||
0xC4C, 0x007F037F,
|
||||
0xC50, 0x69553420,
|
||||
0xC54, 0x43BC0094,
|
||||
0xC58, 0x00013169,
|
||||
0xC5C, 0x00250492,
|
||||
0xC60, 0x00000000,
|
||||
0xC64, 0x7112848B,
|
||||
0xC68, 0x47C00BFF,
|
||||
0xC6C, 0x00000036,
|
||||
0xC70, 0x2C7F000D,
|
||||
0xC74, 0x020610DB,
|
||||
0xC78, 0x0000001F,
|
||||
0xC7C, 0x00B91612,
|
||||
0xC80, 0x390000E4,
|
||||
0xC84, 0x20F60000,
|
||||
0xC88, 0x40000100,
|
||||
0xC8C, 0x20200000,
|
||||
0xC90, 0x00091521,
|
||||
0xC94, 0x00000000,
|
||||
0xC98, 0x00121820,
|
||||
0xC9C, 0x00007F7F,
|
||||
0xCA0, 0x00000000,
|
||||
0xCA4, 0x000300A0,
|
||||
0xCA8, 0x00000000,
|
||||
0xCAC, 0x00000000,
|
||||
0xCB0, 0x00000000,
|
||||
0xCB4, 0x00000000,
|
||||
0xCB8, 0x00000000,
|
||||
0xCBC, 0x28000000,
|
||||
0xCC0, 0x00000000,
|
||||
0xCC4, 0x00000000,
|
||||
0xCC8, 0x00000000,
|
||||
0xCCC, 0x00000000,
|
||||
0xCD0, 0x00000000,
|
||||
0xCD4, 0x00000000,
|
||||
0xCD8, 0x64B22427,
|
||||
0xCDC, 0x00766932,
|
||||
0xCE0, 0x00222222,
|
||||
0xCE4, 0x00000000,
|
||||
0xCE8, 0x37644302,
|
||||
0xCEC, 0x2F97D40C,
|
||||
0xD00, 0x00000740,
|
||||
0xD04, 0x00020401,
|
||||
0xD08, 0x0000907F,
|
||||
0xD0C, 0x20010201,
|
||||
0xD10, 0xA0633333,
|
||||
0xD14, 0x3333BC43,
|
||||
0xD18, 0x7A8F5B6F,
|
||||
0xD2C, 0xCC979975,
|
||||
0xD30, 0x00000000,
|
||||
0xD34, 0x80608000,
|
||||
0xD38, 0x00000000,
|
||||
0xD3C, 0x00127353,
|
||||
0xD40, 0x00000000,
|
||||
0xD44, 0x00000000,
|
||||
0xD48, 0x00000000,
|
||||
0xD4C, 0x00000000,
|
||||
0xD50, 0x6437140A,
|
||||
0xD54, 0x00000000,
|
||||
0xD58, 0x00000282,
|
||||
0xD5C, 0x30032064,
|
||||
0xD60, 0x4653DE68,
|
||||
0xD64, 0x04518A3C,
|
||||
0xD68, 0x00002101,
|
||||
0xD6C, 0x2A201C16,
|
||||
0xD70, 0x1812362E,
|
||||
0xD74, 0x322C2220,
|
||||
0xD78, 0x000E3C24,
|
||||
0xE00, 0x2D2D2D2D,
|
||||
0xE04, 0x2D2D2D2D,
|
||||
0xE08, 0x0390272D,
|
||||
0xE10, 0x2D2D2D2D,
|
||||
0xE14, 0x2D2D2D2D,
|
||||
0xE18, 0x2D2D2D2D,
|
||||
0xE1C, 0x2D2D2D2D,
|
||||
0xE28, 0x00000000,
|
||||
0xE30, 0x1000DC1F,
|
||||
0xE34, 0x10008C1F,
|
||||
0xE38, 0x02140102,
|
||||
0xE3C, 0x681604C2,
|
||||
0xE40, 0x01007C00,
|
||||
0xE44, 0x01004800,
|
||||
0xE48, 0xFB000000,
|
||||
0xE4C, 0x000028D1,
|
||||
0xE50, 0x1000DC1F,
|
||||
0xE54, 0x10008C1F,
|
||||
0xE58, 0x02140102,
|
||||
0xE5C, 0x28160D05,
|
||||
0xE60, 0x00000008,
|
||||
0xE68, 0x001B25A4,
|
||||
0xE6C, 0x00C00014,
|
||||
0xE70, 0x00C00014,
|
||||
0xE74, 0x01000014,
|
||||
0xE78, 0x01000014,
|
||||
0xE7C, 0x01000014,
|
||||
0xE80, 0x01000014,
|
||||
0xE84, 0x00C00014,
|
||||
0xE88, 0x01000014,
|
||||
0xE8C, 0x00C00014,
|
||||
0xED0, 0x00C00014,
|
||||
0xED4, 0x00C00014,
|
||||
0xED8, 0x00C00014,
|
||||
0xEDC, 0x00000014,
|
||||
0xEE0, 0x00000014,
|
||||
0xEEC, 0x01C00014,
|
||||
0xF14, 0x00000003,
|
||||
0xF4C, 0x00000000,
|
||||
0xF00, 0x00000300,
|
||||
};
|
||||
|
||||
enum HAL_STATUS ODM_ReadAndConfig_PHY_REG_1T_8188E(struct odm_dm_struct *dm_odm)
|
||||
{
|
||||
u32 hex = 0;
|
||||
u32 i = 0;
|
||||
u8 platform = dm_odm->SupportPlatform;
|
||||
u8 interfaceValue = dm_odm->SupportInterface;
|
||||
u8 board = dm_odm->BoardType;
|
||||
u32 arraylen = sizeof(array_phy_reg_1t_8188e)/sizeof(u32);
|
||||
u32 *array = array_phy_reg_1t_8188e;
|
||||
bool biol = false;
|
||||
struct adapter *adapter = dm_odm->Adapter;
|
||||
struct xmit_frame *pxmit_frame = NULL;
|
||||
u8 bndy_cnt = 1;
|
||||
enum HAL_STATUS rst = HAL_STATUS_SUCCESS;
|
||||
hex += board;
|
||||
hex += interfaceValue << 8;
|
||||
hex += platform << 16;
|
||||
hex += 0xFF000000;
|
||||
biol = rtw_IOL_applied(adapter);
|
||||
|
||||
if (biol) {
|
||||
pxmit_frame = rtw_IOL_accquire_xmit_frame(adapter);
|
||||
if (pxmit_frame == NULL) {
|
||||
pr_info("rtw_IOL_accquire_xmit_frame failed\n");
|
||||
return HAL_STATUS_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < arraylen; i += 2) {
|
||||
u32 v1 = array[i];
|
||||
u32 v2 = array[i+1];
|
||||
|
||||
/* This (offset, data) pair meets the condition. */
|
||||
if (v1 < 0xCDCDCDCD) {
|
||||
if (biol) {
|
||||
if (rtw_IOL_cmd_boundary_handle(pxmit_frame))
|
||||
bndy_cnt++;
|
||||
if (v1 == 0xfe) {
|
||||
rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 50);
|
||||
} else if (v1 == 0xfd) {
|
||||
rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 5);
|
||||
} else if (v1 == 0xfc) {
|
||||
rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 1);
|
||||
} else if (v1 == 0xfb) {
|
||||
rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 50);
|
||||
} else if (v1 == 0xfa) {
|
||||
rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 5);
|
||||
} else if (v1 == 0xf9) {
|
||||
rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 1);
|
||||
} else {
|
||||
if (v1 == 0xa24)
|
||||
dm_odm->RFCalibrateInfo.RegA24 = v2;
|
||||
rtw_IOL_append_WD_cmd(pxmit_frame, (u16)v1, v2, bMaskDWord);
|
||||
}
|
||||
} else {
|
||||
odm_ConfigBB_PHY_8188E(dm_odm, v1, bMaskDWord, v2);
|
||||
}
|
||||
continue;
|
||||
} else { /* This line is the start line of branch. */
|
||||
if (!CheckCondition(array[i], hex)) {
|
||||
/* Discard the following (offset, data) pairs. */
|
||||
read_next_pair(array, v1, v2, i);
|
||||
while (v2 != 0xDEAD &&
|
||||
v2 != 0xCDEF &&
|
||||
v2 != 0xCDCD && i < arraylen - 2)
|
||||
read_next_pair(array, v1, v2, i);
|
||||
i -= 2; /* prevent from for-loop += 2 */
|
||||
} else { /* Configure matched pairs and skip to end of if-else. */
|
||||
read_next_pair(array, v1, v2, i);
|
||||
while (v2 != 0xDEAD &&
|
||||
v2 != 0xCDEF &&
|
||||
v2 != 0xCDCD && i < arraylen - 2) {
|
||||
if (biol) {
|
||||
if (rtw_IOL_cmd_boundary_handle(pxmit_frame))
|
||||
bndy_cnt++;
|
||||
if (v1 == 0xfe) {
|
||||
rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 50);
|
||||
} else if (v1 == 0xfd) {
|
||||
rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 5);
|
||||
} else if (v1 == 0xfc) {
|
||||
rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 1);
|
||||
} else if (v1 == 0xfb) {
|
||||
rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 50);
|
||||
} else if (v1 == 0xfa) {
|
||||
rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 5);
|
||||
} else if (v1 == 0xf9) {
|
||||
rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 1);
|
||||
} else{
|
||||
if (v1 == 0xa24)
|
||||
dm_odm->RFCalibrateInfo.RegA24 = v2;
|
||||
|
||||
rtw_IOL_append_WD_cmd(pxmit_frame, (u16)v1, v2, bMaskDWord);
|
||||
}
|
||||
} else {
|
||||
odm_ConfigBB_PHY_8188E(dm_odm, v1, bMaskDWord, v2);
|
||||
}
|
||||
read_next_pair(array, v1, v2, i);
|
||||
}
|
||||
|
||||
while (v2 != 0xDEAD && i < arraylen - 2)
|
||||
read_next_pair(array, v1, v2, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (biol) {
|
||||
if (!rtw_IOL_exec_cmds_sync(dm_odm->Adapter, pxmit_frame, 1000, bndy_cnt)) {
|
||||
rst = HAL_STATUS_FAILURE;
|
||||
pr_info("~~~ IOL Config %s Failed !!!\n", __func__);
|
||||
}
|
||||
}
|
||||
return rst;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* PHY_REG_PG.TXT
|
||||
******************************************************************************/
|
||||
|
||||
static u32 array_phy_reg_pg_8188e[] = {
|
||||
0xE00, 0xFFFFFFFF, 0x06070809,
|
||||
0xE04, 0xFFFFFFFF, 0x02020405,
|
||||
0xE08, 0x0000FF00, 0x00000006,
|
||||
0x86C, 0xFFFFFF00, 0x00020400,
|
||||
0xE10, 0xFFFFFFFF, 0x08090A0B,
|
||||
0xE14, 0xFFFFFFFF, 0x01030607,
|
||||
0xE18, 0xFFFFFFFF, 0x08090A0B,
|
||||
0xE1C, 0xFFFFFFFF, 0x01030607,
|
||||
0xE00, 0xFFFFFFFF, 0x00000000,
|
||||
0xE04, 0xFFFFFFFF, 0x00000000,
|
||||
0xE08, 0x0000FF00, 0x00000000,
|
||||
0x86C, 0xFFFFFF00, 0x00000000,
|
||||
0xE10, 0xFFFFFFFF, 0x00000000,
|
||||
0xE14, 0xFFFFFFFF, 0x00000000,
|
||||
0xE18, 0xFFFFFFFF, 0x00000000,
|
||||
0xE1C, 0xFFFFFFFF, 0x00000000,
|
||||
0xE00, 0xFFFFFFFF, 0x02020202,
|
||||
0xE04, 0xFFFFFFFF, 0x00020202,
|
||||
0xE08, 0x0000FF00, 0x00000000,
|
||||
0x86C, 0xFFFFFF00, 0x00000000,
|
||||
0xE10, 0xFFFFFFFF, 0x04040404,
|
||||
0xE14, 0xFFFFFFFF, 0x00020404,
|
||||
0xE18, 0xFFFFFFFF, 0x00000000,
|
||||
0xE1C, 0xFFFFFFFF, 0x00000000,
|
||||
0xE00, 0xFFFFFFFF, 0x02020202,
|
||||
0xE04, 0xFFFFFFFF, 0x00020202,
|
||||
0xE08, 0x0000FF00, 0x00000000,
|
||||
0x86C, 0xFFFFFF00, 0x00000000,
|
||||
0xE10, 0xFFFFFFFF, 0x04040404,
|
||||
0xE14, 0xFFFFFFFF, 0x00020404,
|
||||
0xE18, 0xFFFFFFFF, 0x00000000,
|
||||
0xE1C, 0xFFFFFFFF, 0x00000000,
|
||||
0xE00, 0xFFFFFFFF, 0x00000000,
|
||||
0xE04, 0xFFFFFFFF, 0x00000000,
|
||||
0xE08, 0x0000FF00, 0x00000000,
|
||||
0x86C, 0xFFFFFF00, 0x00000000,
|
||||
0xE10, 0xFFFFFFFF, 0x00000000,
|
||||
0xE14, 0xFFFFFFFF, 0x00000000,
|
||||
0xE18, 0xFFFFFFFF, 0x00000000,
|
||||
0xE1C, 0xFFFFFFFF, 0x00000000,
|
||||
0xE00, 0xFFFFFFFF, 0x02020202,
|
||||
0xE04, 0xFFFFFFFF, 0x00020202,
|
||||
0xE08, 0x0000FF00, 0x00000000,
|
||||
0x86C, 0xFFFFFF00, 0x00000000,
|
||||
0xE10, 0xFFFFFFFF, 0x04040404,
|
||||
0xE14, 0xFFFFFFFF, 0x00020404,
|
||||
0xE18, 0xFFFFFFFF, 0x00000000,
|
||||
0xE1C, 0xFFFFFFFF, 0x00000000,
|
||||
0xE00, 0xFFFFFFFF, 0x00000000,
|
||||
0xE04, 0xFFFFFFFF, 0x00000000,
|
||||
0xE08, 0x0000FF00, 0x00000000,
|
||||
0x86C, 0xFFFFFF00, 0x00000000,
|
||||
0xE10, 0xFFFFFFFF, 0x00000000,
|
||||
0xE14, 0xFFFFFFFF, 0x00000000,
|
||||
0xE18, 0xFFFFFFFF, 0x00000000,
|
||||
0xE1C, 0xFFFFFFFF, 0x00000000,
|
||||
0xE00, 0xFFFFFFFF, 0x00000000,
|
||||
0xE04, 0xFFFFFFFF, 0x00000000,
|
||||
0xE08, 0x0000FF00, 0x00000000,
|
||||
0x86C, 0xFFFFFF00, 0x00000000,
|
||||
0xE10, 0xFFFFFFFF, 0x00000000,
|
||||
0xE14, 0xFFFFFFFF, 0x00000000,
|
||||
0xE18, 0xFFFFFFFF, 0x00000000,
|
||||
0xE1C, 0xFFFFFFFF, 0x00000000,
|
||||
0xE00, 0xFFFFFFFF, 0x00000000,
|
||||
0xE04, 0xFFFFFFFF, 0x00000000,
|
||||
0xE08, 0x0000FF00, 0x00000000,
|
||||
0x86C, 0xFFFFFF00, 0x00000000,
|
||||
0xE10, 0xFFFFFFFF, 0x00000000,
|
||||
0xE14, 0xFFFFFFFF, 0x00000000,
|
||||
0xE18, 0xFFFFFFFF, 0x00000000,
|
||||
0xE1C, 0xFFFFFFFF, 0x00000000,
|
||||
0xE00, 0xFFFFFFFF, 0x00000000,
|
||||
0xE04, 0xFFFFFFFF, 0x00000000,
|
||||
0xE08, 0x0000FF00, 0x00000000,
|
||||
0x86C, 0xFFFFFF00, 0x00000000,
|
||||
0xE10, 0xFFFFFFFF, 0x00000000,
|
||||
0xE14, 0xFFFFFFFF, 0x00000000,
|
||||
0xE18, 0xFFFFFFFF, 0x00000000,
|
||||
0xE1C, 0xFFFFFFFF, 0x00000000,
|
||||
0xE00, 0xFFFFFFFF, 0x00000000,
|
||||
0xE04, 0xFFFFFFFF, 0x00000000,
|
||||
0xE08, 0x0000FF00, 0x00000000,
|
||||
0x86C, 0xFFFFFF00, 0x00000000,
|
||||
0xE10, 0xFFFFFFFF, 0x00000000,
|
||||
0xE14, 0xFFFFFFFF, 0x00000000,
|
||||
0xE18, 0xFFFFFFFF, 0x00000000,
|
||||
0xE1C, 0xFFFFFFFF, 0x00000000,
|
||||
|
||||
};
|
||||
|
||||
void ODM_ReadAndConfig_PHY_REG_PG_8188E(struct odm_dm_struct *dm_odm)
|
||||
{
|
||||
u32 hex;
|
||||
u32 i = 0;
|
||||
u8 platform = dm_odm->SupportPlatform;
|
||||
u8 interfaceValue = dm_odm->SupportInterface;
|
||||
u8 board = dm_odm->BoardType;
|
||||
u32 arraylen = sizeof(array_phy_reg_pg_8188e) / sizeof(u32);
|
||||
u32 *array = array_phy_reg_pg_8188e;
|
||||
|
||||
hex = board + (interfaceValue << 8);
|
||||
hex += (platform << 16) + 0xFF000000;
|
||||
|
||||
for (i = 0; i < arraylen; i += 3) {
|
||||
u32 v1 = array[i];
|
||||
u32 v2 = array[i+1];
|
||||
u32 v3 = array[i+2];
|
||||
|
||||
/* this line is a line of pure_body */
|
||||
if (v1 < 0xCDCDCDCD) {
|
||||
odm_ConfigBB_PHY_REG_PG_8188E(dm_odm, v1, v2, v3);
|
||||
continue;
|
||||
} else { /* this line is the start of branch */
|
||||
if (!CheckCondition(array[i], hex)) {
|
||||
/* don't need the hw_body */
|
||||
i += 2; /* skip the pair of expression */
|
||||
v1 = array[i];
|
||||
v2 = array[i+1];
|
||||
v3 = array[i+2];
|
||||
while (v2 != 0xDEAD) {
|
||||
i += 3;
|
||||
v1 = array[i];
|
||||
v2 = array[i+1];
|
||||
v3 = array[i+1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
230
drivers/net/wireless/realtek/rtl8188eu/hal/HalHWImg8188E_MAC.c
Normal file
230
drivers/net/wireless/realtek/rtl8188eu/hal/HalHWImg8188E_MAC.c
Normal file
@@ -0,0 +1,230 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "odm_precomp.h"
|
||||
#include <rtw_iol.h>
|
||||
|
||||
static bool Checkcondition(const u32 condition, const u32 hex)
|
||||
{
|
||||
u32 _board = (hex & 0x000000FF);
|
||||
u32 _interface = (hex & 0x0000FF00) >> 8;
|
||||
u32 _platform = (hex & 0x00FF0000) >> 16;
|
||||
u32 cond = condition;
|
||||
|
||||
if (condition == 0xCDCDCDCD)
|
||||
return true;
|
||||
|
||||
cond = condition & 0x000000FF;
|
||||
if ((_board == cond) && cond != 0x00)
|
||||
return false;
|
||||
|
||||
cond = condition & 0x0000FF00;
|
||||
cond = cond >> 8;
|
||||
if ((_interface & cond) == 0 && cond != 0x07)
|
||||
return false;
|
||||
|
||||
cond = condition & 0x00FF0000;
|
||||
cond = cond >> 16;
|
||||
if ((_platform & cond) == 0 && cond != 0x0F)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* MAC_REG.TXT
|
||||
******************************************************************************/
|
||||
|
||||
static u32 array_MAC_REG_8188E[] = {
|
||||
0x026, 0x00000041,
|
||||
0x027, 0x00000035,
|
||||
0x428, 0x0000000A,
|
||||
0x429, 0x00000010,
|
||||
0x430, 0x00000000,
|
||||
0x431, 0x00000001,
|
||||
0x432, 0x00000002,
|
||||
0x433, 0x00000004,
|
||||
0x434, 0x00000005,
|
||||
0x435, 0x00000006,
|
||||
0x436, 0x00000007,
|
||||
0x437, 0x00000008,
|
||||
0x438, 0x00000000,
|
||||
0x439, 0x00000000,
|
||||
0x43A, 0x00000001,
|
||||
0x43B, 0x00000002,
|
||||
0x43C, 0x00000004,
|
||||
0x43D, 0x00000005,
|
||||
0x43E, 0x00000006,
|
||||
0x43F, 0x00000007,
|
||||
0x440, 0x0000005D,
|
||||
0x441, 0x00000001,
|
||||
0x442, 0x00000000,
|
||||
0x444, 0x00000015,
|
||||
0x445, 0x000000F0,
|
||||
0x446, 0x0000000F,
|
||||
0x447, 0x00000000,
|
||||
0x458, 0x00000041,
|
||||
0x459, 0x000000A8,
|
||||
0x45A, 0x00000072,
|
||||
0x45B, 0x000000B9,
|
||||
0x460, 0x00000066,
|
||||
0x461, 0x00000066,
|
||||
0x480, 0x00000008,
|
||||
0x4C8, 0x000000FF,
|
||||
0x4C9, 0x00000008,
|
||||
0x4CC, 0x000000FF,
|
||||
0x4CD, 0x000000FF,
|
||||
0x4CE, 0x00000001,
|
||||
0x4D3, 0x00000001,
|
||||
0x500, 0x00000026,
|
||||
0x501, 0x000000A2,
|
||||
0x502, 0x0000002F,
|
||||
0x503, 0x00000000,
|
||||
0x504, 0x00000028,
|
||||
0x505, 0x000000A3,
|
||||
0x506, 0x0000005E,
|
||||
0x507, 0x00000000,
|
||||
0x508, 0x0000002B,
|
||||
0x509, 0x000000A4,
|
||||
0x50A, 0x0000005E,
|
||||
0x50B, 0x00000000,
|
||||
0x50C, 0x0000004F,
|
||||
0x50D, 0x000000A4,
|
||||
0x50E, 0x00000000,
|
||||
0x50F, 0x00000000,
|
||||
0x512, 0x0000001C,
|
||||
0x514, 0x0000000A,
|
||||
0x516, 0x0000000A,
|
||||
0x525, 0x0000004F,
|
||||
0x550, 0x00000010,
|
||||
0x551, 0x00000010,
|
||||
0x559, 0x00000002,
|
||||
0x55D, 0x000000FF,
|
||||
0x605, 0x00000030,
|
||||
0x608, 0x0000000E,
|
||||
0x609, 0x0000002A,
|
||||
0x620, 0x000000FF,
|
||||
0x621, 0x000000FF,
|
||||
0x622, 0x000000FF,
|
||||
0x623, 0x000000FF,
|
||||
0x624, 0x000000FF,
|
||||
0x625, 0x000000FF,
|
||||
0x626, 0x000000FF,
|
||||
0x627, 0x000000FF,
|
||||
0x652, 0x00000020,
|
||||
0x63C, 0x0000000A,
|
||||
0x63D, 0x0000000A,
|
||||
0x63E, 0x0000000E,
|
||||
0x63F, 0x0000000E,
|
||||
0x640, 0x00000040,
|
||||
0x66E, 0x00000005,
|
||||
0x700, 0x00000021,
|
||||
0x701, 0x00000043,
|
||||
0x702, 0x00000065,
|
||||
0x703, 0x00000087,
|
||||
0x708, 0x00000021,
|
||||
0x709, 0x00000043,
|
||||
0x70A, 0x00000065,
|
||||
0x70B, 0x00000087,
|
||||
};
|
||||
|
||||
enum HAL_STATUS ODM_ReadAndConfig_MAC_REG_8188E(struct odm_dm_struct *dm_odm)
|
||||
{
|
||||
#define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = array[i]; v2 = array[i+1]; } while (0)
|
||||
|
||||
u32 hex = 0;
|
||||
u32 i;
|
||||
u8 platform = dm_odm->SupportPlatform;
|
||||
u8 interface_val = dm_odm->SupportInterface;
|
||||
u8 board = dm_odm->BoardType;
|
||||
u32 array_len = sizeof(array_MAC_REG_8188E)/sizeof(u32);
|
||||
u32 *array = array_MAC_REG_8188E;
|
||||
bool biol = false;
|
||||
|
||||
struct adapter *adapt = dm_odm->Adapter;
|
||||
struct xmit_frame *pxmit_frame = NULL;
|
||||
u8 bndy_cnt = 1;
|
||||
enum HAL_STATUS rst = HAL_STATUS_SUCCESS;
|
||||
hex += board;
|
||||
hex += interface_val << 8;
|
||||
hex += platform << 16;
|
||||
hex += 0xFF000000;
|
||||
|
||||
biol = rtw_IOL_applied(adapt);
|
||||
|
||||
if (biol) {
|
||||
pxmit_frame = rtw_IOL_accquire_xmit_frame(adapt);
|
||||
if (pxmit_frame == NULL) {
|
||||
pr_info("rtw_IOL_accquire_xmit_frame failed\n");
|
||||
return HAL_STATUS_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < array_len; i += 2) {
|
||||
u32 v1 = array[i];
|
||||
u32 v2 = array[i+1];
|
||||
|
||||
/* This (offset, data) pair meets the condition. */
|
||||
if (v1 < 0xCDCDCDCD) {
|
||||
if (biol) {
|
||||
if (rtw_IOL_cmd_boundary_handle(pxmit_frame))
|
||||
bndy_cnt++;
|
||||
rtw_IOL_append_WB_cmd(pxmit_frame, (u16)v1, (u8)v2, 0xFF);
|
||||
} else {
|
||||
odm_ConfigMAC_8188E(dm_odm, v1, (u8)v2);
|
||||
}
|
||||
continue;
|
||||
} else { /* This line is the start line of branch. */
|
||||
if (!Checkcondition(array[i], hex)) {
|
||||
/* Discard the following (offset, data) pairs. */
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
while (v2 != 0xDEAD &&
|
||||
v2 != 0xCDEF &&
|
||||
v2 != 0xCDCD && i < array_len - 2) {
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
i -= 2; /* prevent from for-loop += 2 */
|
||||
} else { /* Configure matched pairs and skip to end of if-else. */
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
while (v2 != 0xDEAD &&
|
||||
v2 != 0xCDEF &&
|
||||
v2 != 0xCDCD && i < array_len - 2) {
|
||||
if (biol) {
|
||||
if (rtw_IOL_cmd_boundary_handle(pxmit_frame))
|
||||
bndy_cnt++;
|
||||
rtw_IOL_append_WB_cmd(pxmit_frame, (u16)v1, (u8)v2, 0xFF);
|
||||
} else {
|
||||
odm_ConfigMAC_8188E(dm_odm, v1, (u8)v2);
|
||||
}
|
||||
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
while (v2 != 0xDEAD && i < array_len - 2)
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (biol) {
|
||||
if (!rtw_IOL_exec_cmds_sync(dm_odm->Adapter, pxmit_frame, 1000, bndy_cnt)) {
|
||||
pr_info("~~~ MAC IOL_exec_cmds Failed !!!\n");
|
||||
rst = HAL_STATUS_FAILURE;
|
||||
}
|
||||
}
|
||||
return rst;
|
||||
}
|
||||
268
drivers/net/wireless/realtek/rtl8188eu/hal/HalHWImg8188E_RF.c
Normal file
268
drivers/net/wireless/realtek/rtl8188eu/hal/HalHWImg8188E_RF.c
Normal file
@@ -0,0 +1,268 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "odm_precomp.h"
|
||||
|
||||
#include <rtw_iol.h>
|
||||
|
||||
static bool CheckCondition(const u32 Condition, const u32 Hex)
|
||||
{
|
||||
u32 _board = (Hex & 0x000000FF);
|
||||
u32 _interface = (Hex & 0x0000FF00) >> 8;
|
||||
u32 _platform = (Hex & 0x00FF0000) >> 16;
|
||||
u32 cond = Condition;
|
||||
|
||||
if (Condition == 0xCDCDCDCD)
|
||||
return true;
|
||||
|
||||
cond = Condition & 0x000000FF;
|
||||
if ((_board == cond) && cond != 0x00)
|
||||
return false;
|
||||
|
||||
cond = Condition & 0x0000FF00;
|
||||
cond = cond >> 8;
|
||||
if ((_interface & cond) == 0 && cond != 0x07)
|
||||
return false;
|
||||
|
||||
cond = Condition & 0x00FF0000;
|
||||
cond = cond >> 16;
|
||||
if ((_platform & cond) == 0 && cond != 0x0F)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* RadioA_1T.TXT
|
||||
******************************************************************************/
|
||||
|
||||
static u32 Array_RadioA_1T_8188E[] = {
|
||||
0x000, 0x00030000,
|
||||
0x008, 0x00084000,
|
||||
0x018, 0x00000407,
|
||||
0x019, 0x00000012,
|
||||
0x01E, 0x00080009,
|
||||
0x01F, 0x00000880,
|
||||
0x02F, 0x0001A060,
|
||||
0x03F, 0x00000000,
|
||||
0x042, 0x000060C0,
|
||||
0x057, 0x000D0000,
|
||||
0x058, 0x000BE180,
|
||||
0x067, 0x00001552,
|
||||
0x083, 0x00000000,
|
||||
0x0B0, 0x000FF8FC,
|
||||
0x0B1, 0x00054400,
|
||||
0x0B2, 0x000CCC19,
|
||||
0x0B4, 0x00043003,
|
||||
0x0B6, 0x0004953E,
|
||||
0x0B7, 0x0001C718,
|
||||
0x0B8, 0x000060FF,
|
||||
0x0B9, 0x00080001,
|
||||
0x0BA, 0x00040000,
|
||||
0x0BB, 0x00000400,
|
||||
0x0BF, 0x000C0000,
|
||||
0x0C2, 0x00002400,
|
||||
0x0C3, 0x00000009,
|
||||
0x0C4, 0x00040C91,
|
||||
0x0C5, 0x00099999,
|
||||
0x0C6, 0x000000A3,
|
||||
0x0C7, 0x00088820,
|
||||
0x0C8, 0x00076C06,
|
||||
0x0C9, 0x00000000,
|
||||
0x0CA, 0x00080000,
|
||||
0x0DF, 0x00000180,
|
||||
0x0EF, 0x000001A0,
|
||||
0x051, 0x0006B27D,
|
||||
0xFF0F041F, 0xABCD,
|
||||
0x052, 0x0007E4DD,
|
||||
0xCDCDCDCD, 0xCDCD,
|
||||
0x052, 0x0007E49D,
|
||||
0xFF0F041F, 0xDEAD,
|
||||
0x053, 0x00000073,
|
||||
0x056, 0x00051FF3,
|
||||
0x035, 0x00000086,
|
||||
0x035, 0x00000186,
|
||||
0x035, 0x00000286,
|
||||
0x036, 0x00001C25,
|
||||
0x036, 0x00009C25,
|
||||
0x036, 0x00011C25,
|
||||
0x036, 0x00019C25,
|
||||
0x0B6, 0x00048538,
|
||||
0x018, 0x00000C07,
|
||||
0x05A, 0x0004BD00,
|
||||
0x019, 0x000739D0,
|
||||
0x034, 0x0000ADF3,
|
||||
0x034, 0x00009DF0,
|
||||
0x034, 0x00008DED,
|
||||
0x034, 0x00007DEA,
|
||||
0x034, 0x00006DE7,
|
||||
0x034, 0x000054EE,
|
||||
0x034, 0x000044EB,
|
||||
0x034, 0x000034E8,
|
||||
0x034, 0x0000246B,
|
||||
0x034, 0x00001468,
|
||||
0x034, 0x0000006D,
|
||||
0x000, 0x00030159,
|
||||
0x084, 0x00068200,
|
||||
0x086, 0x000000CE,
|
||||
0x087, 0x00048A00,
|
||||
0x08E, 0x00065540,
|
||||
0x08F, 0x00088000,
|
||||
0x0EF, 0x000020A0,
|
||||
0x03B, 0x000F02B0,
|
||||
0x03B, 0x000EF7B0,
|
||||
0x03B, 0x000D4FB0,
|
||||
0x03B, 0x000CF060,
|
||||
0x03B, 0x000B0090,
|
||||
0x03B, 0x000A0080,
|
||||
0x03B, 0x00090080,
|
||||
0x03B, 0x0008F780,
|
||||
0x03B, 0x000722B0,
|
||||
0x03B, 0x0006F7B0,
|
||||
0x03B, 0x00054FB0,
|
||||
0x03B, 0x0004F060,
|
||||
0x03B, 0x00030090,
|
||||
0x03B, 0x00020080,
|
||||
0x03B, 0x00010080,
|
||||
0x03B, 0x0000F780,
|
||||
0x0EF, 0x000000A0,
|
||||
0x000, 0x00010159,
|
||||
0x018, 0x0000F407,
|
||||
0xFFE, 0x00000000,
|
||||
0xFFE, 0x00000000,
|
||||
0x01F, 0x00080003,
|
||||
0xFFE, 0x00000000,
|
||||
0xFFE, 0x00000000,
|
||||
0x01E, 0x00000001,
|
||||
0x01F, 0x00080000,
|
||||
0x000, 0x00033E60,
|
||||
};
|
||||
|
||||
enum HAL_STATUS ODM_ReadAndConfig_RadioA_1T_8188E(struct odm_dm_struct *pDM_Odm)
|
||||
{
|
||||
#define READ_NEXT_PAIR(v1, v2, i) do \
|
||||
{ i += 2; v1 = Array[i]; \
|
||||
v2 = Array[i+1]; } while (0)
|
||||
|
||||
u32 hex = 0;
|
||||
u32 i = 0;
|
||||
u8 platform = pDM_Odm->SupportPlatform;
|
||||
u8 interfaceValue = pDM_Odm->SupportInterface;
|
||||
u8 board = pDM_Odm->BoardType;
|
||||
u32 ArrayLen = sizeof(Array_RadioA_1T_8188E)/sizeof(u32);
|
||||
u32 *Array = Array_RadioA_1T_8188E;
|
||||
bool biol = false;
|
||||
struct adapter *Adapter = pDM_Odm->Adapter;
|
||||
struct xmit_frame *pxmit_frame = NULL;
|
||||
u8 bndy_cnt = 1;
|
||||
enum HAL_STATUS rst = HAL_STATUS_SUCCESS;
|
||||
|
||||
hex += board;
|
||||
hex += interfaceValue << 8;
|
||||
hex += platform << 16;
|
||||
hex += 0xFF000000;
|
||||
biol = rtw_IOL_applied(Adapter);
|
||||
|
||||
if (biol) {
|
||||
pxmit_frame = rtw_IOL_accquire_xmit_frame(Adapter);
|
||||
if (pxmit_frame == NULL) {
|
||||
pr_info("rtw_IOL_accquire_xmit_frame failed\n");
|
||||
return HAL_STATUS_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < ArrayLen; i += 2) {
|
||||
u32 v1 = Array[i];
|
||||
u32 v2 = Array[i+1];
|
||||
|
||||
/* This (offset, data) pair meets the condition. */
|
||||
if (v1 < 0xCDCDCDCD) {
|
||||
if (biol) {
|
||||
if (rtw_IOL_cmd_boundary_handle(pxmit_frame))
|
||||
bndy_cnt++;
|
||||
|
||||
if (v1 == 0xffe)
|
||||
rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 50);
|
||||
else if (v1 == 0xfd)
|
||||
rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 5);
|
||||
else if (v1 == 0xfc)
|
||||
rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 1);
|
||||
else if (v1 == 0xfb)
|
||||
rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 50);
|
||||
else if (v1 == 0xfa)
|
||||
rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 5);
|
||||
else if (v1 == 0xf9)
|
||||
rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 1);
|
||||
else
|
||||
rtw_IOL_append_WRF_cmd(pxmit_frame, RF_PATH_A, (u16)v1, v2, bRFRegOffsetMask);
|
||||
} else {
|
||||
odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2);
|
||||
}
|
||||
continue;
|
||||
} else { /* This line is the start line of branch. */
|
||||
if (!CheckCondition(Array[i], hex)) {
|
||||
/* Discard the following (offset, data) pairs. */
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
while (v2 != 0xDEAD &&
|
||||
v2 != 0xCDEF &&
|
||||
v2 != 0xCDCD && i < ArrayLen - 2)
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
i -= 2; /* prevent from for-loop += 2 */
|
||||
} else { /* Configure matched pairs and skip to end of if-else. */
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
while (v2 != 0xDEAD &&
|
||||
v2 != 0xCDEF &&
|
||||
v2 != 0xCDCD && i < ArrayLen - 2) {
|
||||
if (biol) {
|
||||
if (rtw_IOL_cmd_boundary_handle(pxmit_frame))
|
||||
bndy_cnt++;
|
||||
|
||||
if (v1 == 0xffe)
|
||||
rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 50);
|
||||
else if (v1 == 0xfd)
|
||||
rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 5);
|
||||
else if (v1 == 0xfc)
|
||||
rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 1);
|
||||
else if (v1 == 0xfb)
|
||||
rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 50);
|
||||
else if (v1 == 0xfa)
|
||||
rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 5);
|
||||
else if (v1 == 0xf9)
|
||||
rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 1);
|
||||
else
|
||||
rtw_IOL_append_WRF_cmd(pxmit_frame, RF_PATH_A, (u16)v1, v2, bRFRegOffsetMask);
|
||||
} else {
|
||||
odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2);
|
||||
}
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
|
||||
while (v2 != 0xDEAD && i < ArrayLen - 2)
|
||||
READ_NEXT_PAIR(v1, v2, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (biol) {
|
||||
if (!rtw_IOL_exec_cmds_sync(pDM_Odm->Adapter, pxmit_frame, 1000, bndy_cnt)) {
|
||||
rst = HAL_STATUS_FAILURE;
|
||||
pr_info("~~~ IOL Config %s Failed !!!\n", __func__);
|
||||
}
|
||||
}
|
||||
return rst;
|
||||
}
|
||||
49
drivers/net/wireless/realtek/rtl8188eu/hal/HalPhyRf.c
Normal file
49
drivers/net/wireless/realtek/rtl8188eu/hal/HalPhyRf.c
Normal file
@@ -0,0 +1,49 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "odm_precomp.h"
|
||||
|
||||
/* 3============================================================ */
|
||||
/* 3 IQ Calibration */
|
||||
/* 3============================================================ */
|
||||
|
||||
void ODM_ResetIQKResult(struct odm_dm_struct *pDM_Odm)
|
||||
{
|
||||
}
|
||||
|
||||
u8 ODM_GetRightChnlPlaceforIQK(u8 chnl)
|
||||
{
|
||||
u8 channel_all[ODM_TARGET_CHNL_NUM_2G_5G] = {
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
||||
36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64,
|
||||
100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122,
|
||||
124, 126, 128, 130, 132, 134, 136, 138, 140, 149, 151, 153,
|
||||
155, 157, 159, 161, 163, 165
|
||||
};
|
||||
u8 place = chnl;
|
||||
|
||||
if (chnl > 14) {
|
||||
for (place = 14; place < sizeof(channel_all); place++) {
|
||||
if (channel_all[place] == chnl)
|
||||
return place-13;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
1505
drivers/net/wireless/realtek/rtl8188eu/hal/HalPhyRf_8188e.c
Normal file
1505
drivers/net/wireless/realtek/rtl8188eu/hal/HalPhyRf_8188e.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
@@ -11,7 +11,12 @@
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
/*++
|
||||
Copyright (c) Realtek Semiconductor Corp. All rights reserved.
|
||||
|
||||
@@ -28,158 +33,100 @@ Major Change History:
|
||||
2011-07-07 Roger Create.
|
||||
|
||||
--*/
|
||||
|
||||
#include <HalPwrSeqCmd.h>
|
||||
|
||||
|
||||
/*
|
||||
* Description:
|
||||
* This routine deal with the Power Configuration CMDs parsing for RTL8723/RTL8188E Series IC.
|
||||
*
|
||||
/* Description: */
|
||||
/* This routine deals with the Power Configuration CMDs parsing
|
||||
* for RTL8723/RTL8188E Series IC.
|
||||
* Assumption:
|
||||
* We should follow specific format which was released from HW SD.
|
||||
*
|
||||
* 2011.07.07, added by Roger.
|
||||
* */
|
||||
u8 HalPwrSeqCmdParsing(
|
||||
PADAPTER padapter,
|
||||
u8 CutVersion,
|
||||
u8 FabVersion,
|
||||
u8 InterfaceType,
|
||||
WLAN_PWR_CFG PwrSeqCmd[])
|
||||
*/
|
||||
u8 HalPwrSeqCmdParsing(struct adapter *padapter, u8 cut_vers, u8 fab_vers,
|
||||
u8 ifacetype, struct wl_pwr_cfg pwrseqcmd[])
|
||||
{
|
||||
WLAN_PWR_CFG PwrCfgCmd = {0};
|
||||
u8 bPollingBit = _FALSE;
|
||||
u8 bHWICSupport = _FALSE;
|
||||
u32 AryIdx = 0;
|
||||
u8 value = 0;
|
||||
u32 offset = 0;
|
||||
u8 flag = 0;
|
||||
u32 pollingCount = 0; /* polling autoload done. */
|
||||
u32 maxPollingCnt = 5000;
|
||||
struct wl_pwr_cfg pwrcfgcmd = {0};
|
||||
u8 poll_bit = false;
|
||||
u32 aryidx = 0;
|
||||
u8 value = 0;
|
||||
u32 offset = 0;
|
||||
u32 poll_count = 0; /* polling autoload done. */
|
||||
u32 max_poll_count = 5000;
|
||||
|
||||
do {
|
||||
PwrCfgCmd = PwrSeqCmd[AryIdx];
|
||||
pwrcfgcmd = pwrseqcmd[aryidx];
|
||||
|
||||
RT_TRACE(_module_hal_init_c_ , _drv_info_,
|
||||
("HalPwrSeqCmdParsing: offset(%#x) cut_msk(%#x) fab_msk(%#x) interface_msk(%#x) base(%#x) cmd(%#x) msk(%#x) value(%#x)\n",
|
||||
GET_PWR_CFG_OFFSET(pwrcfgcmd),
|
||||
GET_PWR_CFG_CUT_MASK(pwrcfgcmd),
|
||||
GET_PWR_CFG_FAB_MASK(pwrcfgcmd),
|
||||
GET_PWR_CFG_INTF_MASK(pwrcfgcmd),
|
||||
GET_PWR_CFG_BASE(pwrcfgcmd),
|
||||
GET_PWR_CFG_CMD(pwrcfgcmd),
|
||||
GET_PWR_CFG_MASK(pwrcfgcmd),
|
||||
GET_PWR_CFG_VALUE(pwrcfgcmd)));
|
||||
|
||||
/* 2 Only Handle the command whose FAB, CUT, and Interface are matched */
|
||||
if ((GET_PWR_CFG_FAB_MASK(PwrCfgCmd) & FabVersion) &&
|
||||
(GET_PWR_CFG_CUT_MASK(PwrCfgCmd) & CutVersion) &&
|
||||
(GET_PWR_CFG_INTF_MASK(PwrCfgCmd) & InterfaceType)) {
|
||||
switch (GET_PWR_CFG_CMD(PwrCfgCmd)) {
|
||||
if ((GET_PWR_CFG_FAB_MASK(pwrcfgcmd) & fab_vers) &&
|
||||
(GET_PWR_CFG_CUT_MASK(pwrcfgcmd) & cut_vers) &&
|
||||
(GET_PWR_CFG_INTF_MASK(pwrcfgcmd) & ifacetype)) {
|
||||
switch (GET_PWR_CFG_CMD(pwrcfgcmd)) {
|
||||
case PWR_CMD_READ:
|
||||
RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_READ\n"));
|
||||
break;
|
||||
|
||||
case PWR_CMD_WRITE:
|
||||
offset = GET_PWR_CFG_OFFSET(PwrCfgCmd);
|
||||
RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_WRITE\n"));
|
||||
offset = GET_PWR_CFG_OFFSET(pwrcfgcmd);
|
||||
|
||||
#ifdef CONFIG_SDIO_HCI
|
||||
/* */
|
||||
/* <Roger_Notes> We should deal with interface specific address mapping for some interfaces, e.g., SDIO interface */
|
||||
/* 2011.07.07. */
|
||||
/* */
|
||||
if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO) {
|
||||
/* Read Back SDIO Local value */
|
||||
value = SdioLocalCmd52Read1Byte(padapter, offset);
|
||||
/* Read the value from system register */
|
||||
value = rtw_read8(padapter, offset);
|
||||
|
||||
value &= ~(GET_PWR_CFG_MASK(PwrCfgCmd));
|
||||
value |= (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd));
|
||||
value &= ~(GET_PWR_CFG_MASK(pwrcfgcmd));
|
||||
value |= (GET_PWR_CFG_VALUE(pwrcfgcmd) & GET_PWR_CFG_MASK(pwrcfgcmd));
|
||||
|
||||
/* Write Back SDIO Local value */
|
||||
SdioLocalCmd52Write1Byte(padapter, offset, value);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
#ifdef CONFIG_GSPI_HCI
|
||||
if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO)
|
||||
offset = SPI_LOCAL_OFFSET | offset;
|
||||
#endif
|
||||
/* Read the value from system register */
|
||||
value = rtw_read8(padapter, offset);
|
||||
|
||||
value = value & (~(GET_PWR_CFG_MASK(PwrCfgCmd)));
|
||||
value = value | (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd));
|
||||
|
||||
/* Write the value back to sytem register */
|
||||
rtw_write8(padapter, offset, value);
|
||||
}
|
||||
/* Write the value back to system register */
|
||||
rtw_write8(padapter, offset, value);
|
||||
break;
|
||||
|
||||
case PWR_CMD_POLLING:
|
||||
RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_POLLING\n"));
|
||||
|
||||
bPollingBit = _FALSE;
|
||||
offset = GET_PWR_CFG_OFFSET(PwrCfgCmd);
|
||||
|
||||
rtw_hal_get_hwreg(padapter, HW_VAR_PWR_CMD, &bHWICSupport);
|
||||
if (bHWICSupport && offset == 0x06) {
|
||||
flag = 0;
|
||||
maxPollingCnt = 100000;
|
||||
} else
|
||||
maxPollingCnt = 5000;
|
||||
|
||||
#ifdef CONFIG_GSPI_HCI
|
||||
if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO)
|
||||
offset = SPI_LOCAL_OFFSET | offset;
|
||||
#endif
|
||||
poll_bit = false;
|
||||
offset = GET_PWR_CFG_OFFSET(pwrcfgcmd);
|
||||
do {
|
||||
#ifdef CONFIG_SDIO_HCI
|
||||
if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO)
|
||||
value = SdioLocalCmd52Read1Byte(padapter, offset);
|
||||
else
|
||||
#endif
|
||||
value = rtw_read8(padapter, offset);
|
||||
|
||||
value = value & GET_PWR_CFG_MASK(PwrCfgCmd);
|
||||
if (value == (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd)))
|
||||
bPollingBit = _TRUE;
|
||||
value &= GET_PWR_CFG_MASK(pwrcfgcmd);
|
||||
if (value == (GET_PWR_CFG_VALUE(pwrcfgcmd) & GET_PWR_CFG_MASK(pwrcfgcmd)))
|
||||
poll_bit = true;
|
||||
else
|
||||
rtw_udelay_os(10);
|
||||
|
||||
if (pollingCount++ > maxPollingCnt) {
|
||||
RTW_ERR("HalPwrSeqCmdParsing: Fail to polling Offset[%#x]=%02x\n", offset, value);
|
||||
|
||||
/* For PCIE + USB package poll power bit timeout issue only modify 8821AE and 8723BE */
|
||||
if (bHWICSupport && offset == 0x06 && flag == 0) {
|
||||
|
||||
RTW_ERR("[WARNING] PCIE polling(0x%X) timeout(%d), Toggle 0x04[3] and try again.\n", offset, maxPollingCnt);
|
||||
if (IS_HARDWARE_TYPE_8723DE(padapter))
|
||||
PlatformEFIOWrite1Byte(padapter, 0x40, (PlatformEFIORead1Byte(padapter, 0x40)) & (~BIT3));
|
||||
|
||||
PlatformEFIOWrite1Byte(padapter, 0x04, PlatformEFIORead1Byte(padapter, 0x04) | BIT3);
|
||||
PlatformEFIOWrite1Byte(padapter, 0x04, PlatformEFIORead1Byte(padapter, 0x04) & ~BIT3);
|
||||
|
||||
if (IS_HARDWARE_TYPE_8723DE(padapter))
|
||||
PlatformEFIOWrite1Byte(padapter, 0x40, PlatformEFIORead1Byte(padapter, 0x40)|BIT3);
|
||||
|
||||
/* Retry Polling Process one more time */
|
||||
pollingCount = 0;
|
||||
flag = 1;
|
||||
} else {
|
||||
return _FALSE;
|
||||
}
|
||||
if (poll_count++ > max_poll_count) {
|
||||
DBG_88E("Fail to polling Offset[%#x]\n", offset);
|
||||
return false;
|
||||
}
|
||||
} while (!bPollingBit);
|
||||
|
||||
} while (!poll_bit);
|
||||
break;
|
||||
|
||||
case PWR_CMD_DELAY:
|
||||
if (GET_PWR_CFG_VALUE(PwrCfgCmd) == PWRSEQ_DELAY_US)
|
||||
rtw_udelay_os(GET_PWR_CFG_OFFSET(PwrCfgCmd));
|
||||
RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_DELAY\n"));
|
||||
if (GET_PWR_CFG_VALUE(pwrcfgcmd) == PWRSEQ_DELAY_US)
|
||||
rtw_udelay_os(GET_PWR_CFG_OFFSET(pwrcfgcmd));
|
||||
else
|
||||
rtw_udelay_os(GET_PWR_CFG_OFFSET(PwrCfgCmd) * 1000);
|
||||
rtw_udelay_os(GET_PWR_CFG_OFFSET(pwrcfgcmd)*1000);
|
||||
break;
|
||||
|
||||
case PWR_CMD_END:
|
||||
/* When this command is parsed, end the process */
|
||||
return _TRUE;
|
||||
/* When this command is parsed, end the process */
|
||||
RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_END\n"));
|
||||
return true;
|
||||
break;
|
||||
|
||||
default:
|
||||
RT_TRACE(_module_hal_init_c_ , _drv_err_, ("HalPwrSeqCmdParsing: Unknown CMD!!\n"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
AryIdx++;/* Add Array Index */
|
||||
aryidx++;/* Add Array Index */
|
||||
} while (1);
|
||||
|
||||
return _TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,175 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2016 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USB_HCI
|
||||
|
||||
#if defined(CONFIG_RTL8188E)
|
||||
#include "rtl8188e/HalEfuseMask8188E_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8812A)
|
||||
#include "rtl8812a/HalEfuseMask8812A_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8821A)
|
||||
#include "rtl8812a/HalEfuseMask8821A_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8192E)
|
||||
#include "rtl8192e/HalEfuseMask8192E_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8723B)
|
||||
#include "rtl8723b/HalEfuseMask8723B_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8814A)
|
||||
#include "rtl8814a/HalEfuseMask8814A_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8703B)
|
||||
#include "rtl8703b/HalEfuseMask8703B_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8723D)
|
||||
#include "rtl8723d/HalEfuseMask8723D_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8188F)
|
||||
#include "rtl8188f/HalEfuseMask8188F_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8188GTV)
|
||||
#include "rtl8188gtv/HalEfuseMask8188GTV_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8822B)
|
||||
#include "rtl8822b/HalEfuseMask8822B_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8821C)
|
||||
#include "rtl8821c/HalEfuseMask8821C_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8710B)
|
||||
#include "rtl8710b/HalEfuseMask8710B_USB.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8192F)
|
||||
#include "rtl8192f/HalEfuseMask8192F_USB.h"
|
||||
#endif
|
||||
#if defined(CONFIG_RTL8822C)
|
||||
#include "rtl8822c/HalEfuseMask8822C_USB.h"
|
||||
#endif
|
||||
#endif /*CONFIG_USB_HCI*/
|
||||
|
||||
#ifdef CONFIG_PCI_HCI
|
||||
|
||||
#if defined(CONFIG_RTL8188E)
|
||||
#include "rtl8188e/HalEfuseMask8188E_PCIE.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8812A)
|
||||
#include "rtl8812a/HalEfuseMask8812A_PCIE.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8821A)
|
||||
#include "rtl8812a/HalEfuseMask8821A_PCIE.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8192E)
|
||||
#include "rtl8192e/HalEfuseMask8192E_PCIE.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8723B)
|
||||
#include "rtl8723b/HalEfuseMask8723B_PCIE.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8814A)
|
||||
#include "rtl8814a/HalEfuseMask8814A_PCIE.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8703B)
|
||||
#include "rtl8703b/HalEfuseMask8703B_PCIE.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8822B)
|
||||
#include "rtl8822b/HalEfuseMask8822B_PCIE.h"
|
||||
#endif
|
||||
#if defined(CONFIG_RTL8723D)
|
||||
#include "rtl8723d/HalEfuseMask8723D_PCIE.h"
|
||||
#endif
|
||||
#if defined(CONFIG_RTL8821C)
|
||||
#include "rtl8821c/HalEfuseMask8821C_PCIE.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8192F)
|
||||
#include "rtl8192f/HalEfuseMask8192F_PCIE.h"
|
||||
#endif
|
||||
#if defined(CONFIG_RTL8822C)
|
||||
#include "rtl8822c/HalEfuseMask8822C_PCIE.h"
|
||||
#endif
|
||||
#endif /*CONFIG_PCI_HCI*/
|
||||
#ifdef CONFIG_SDIO_HCI
|
||||
#if defined(CONFIG_RTL8723B)
|
||||
#include "rtl8723b/HalEfuseMask8723B_SDIO.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8188E)
|
||||
#include "rtl8188e/HalEfuseMask8188E_SDIO.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8703B)
|
||||
#include "rtl8703b/HalEfuseMask8703B_SDIO.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8188F)
|
||||
#include "rtl8188f/HalEfuseMask8188F_SDIO.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8188GTV)
|
||||
#include "rtl8188gtv/HalEfuseMask8188GTV_SDIO.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8723D)
|
||||
#include "rtl8723d/HalEfuseMask8723D_SDIO.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8192E)
|
||||
#include "rtl8192e/HalEfuseMask8192E_SDIO.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8821A)
|
||||
#include "rtl8812a/HalEfuseMask8821A_SDIO.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8821C)
|
||||
#include "rtl8821c/HalEfuseMask8821C_SDIO.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8822B)
|
||||
#include "rtl8822b/HalEfuseMask8822B_SDIO.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RTL8192F)
|
||||
#include "rtl8192f/HalEfuseMask8192F_SDIO.h"
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(CONFIG_RTL8822C)
|
||||
#include "rtl8822c/HalEfuseMask8822C_SDIO.h"
|
||||
#endif
|
||||
|
||||
#endif /*CONFIG_SDIO_HCI*/
|
||||
@@ -1,96 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/* #include "Mp_Precomp.h" */
|
||||
/* #include "../odm_precomp.h" */
|
||||
|
||||
#include <drv_types.h>
|
||||
|
||||
#include "HalEfuseMask8188E_PCIE.h"
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* MPCIE.TXT
|
||||
******************************************************************************/
|
||||
|
||||
u8 Array_MP_8188E_MPCIE[] = {
|
||||
0xFF,
|
||||
0xF3,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x0F,
|
||||
0xF1,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0x70,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
|
||||
};
|
||||
|
||||
u16
|
||||
EFUSE_GetArrayLen_MP_8188E_MPCIE(void)
|
||||
{
|
||||
return sizeof(Array_MP_8188E_MPCIE) / sizeof(u8);
|
||||
}
|
||||
|
||||
void
|
||||
EFUSE_GetMaskArray_MP_8188E_MPCIE(
|
||||
u8 *Array
|
||||
)
|
||||
{
|
||||
u16 len = EFUSE_GetArrayLen_MP_8188E_MPCIE(), i = 0;
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
Array[i] = Array_MP_8188E_MPCIE[i];
|
||||
}
|
||||
BOOLEAN
|
||||
EFUSE_IsAddressMasked_MP_8188E_MPCIE(
|
||||
u16 Offset
|
||||
)
|
||||
{
|
||||
int r = Offset / 16;
|
||||
int c = (Offset % 16) / 2;
|
||||
int result = 0;
|
||||
|
||||
if (c < 4) /* Upper double word */
|
||||
result = (Array_MP_8188E_MPCIE[r] & (0x10 << c));
|
||||
else
|
||||
result = (Array_MP_8188E_MPCIE[r] & (0x01 << (c - 4)));
|
||||
|
||||
return (result > 0) ? 0 : 1;
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* MPCIE.TXT
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
u16
|
||||
EFUSE_GetArrayLen_MP_8188E_MPCIE(void);
|
||||
|
||||
void
|
||||
EFUSE_GetMaskArray_MP_8188E_MPCIE(
|
||||
u8 *Array
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
EFUSE_IsAddressMasked_MP_8188E_MPCIE(/* TC: Test Chip, MP: MP Chip */
|
||||
u16 Offset
|
||||
);
|
||||
@@ -1,96 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/* #include "Mp_Precomp.h" */
|
||||
/* #include "../odm_precomp.h" */
|
||||
|
||||
#include <drv_types.h>
|
||||
|
||||
#include "HalEfuseMask8188E_SDIO.h"
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* MSDIO.TXT
|
||||
******************************************************************************/
|
||||
|
||||
u8 Array_MP_8188E_MSDIO[] = {
|
||||
0xFF,
|
||||
0xF3,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x0F,
|
||||
0xF1,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
|
||||
};
|
||||
|
||||
u16
|
||||
EFUSE_GetArrayLen_MP_8188E_MSDIO(void)
|
||||
{
|
||||
return sizeof(Array_MP_8188E_MSDIO) / sizeof(u8);
|
||||
}
|
||||
|
||||
void
|
||||
EFUSE_GetMaskArray_MP_8188E_MSDIO(
|
||||
u8 *Array
|
||||
)
|
||||
{
|
||||
u16 len = EFUSE_GetArrayLen_MP_8188E_MSDIO(), i = 0;
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
Array[i] = Array_MP_8188E_MSDIO[i];
|
||||
}
|
||||
BOOLEAN
|
||||
EFUSE_IsAddressMasked_MP_8188E_MSDIO(
|
||||
u16 Offset
|
||||
)
|
||||
{
|
||||
int r = Offset / 16;
|
||||
int c = (Offset % 16) / 2;
|
||||
int result = 0;
|
||||
|
||||
if (c < 4) /* Upper double word */
|
||||
result = (Array_MP_8188E_MSDIO[r] & (0x10 << c));
|
||||
else
|
||||
result = (Array_MP_8188E_MSDIO[r] & (0x01 << (c - 4)));
|
||||
|
||||
return (result > 0) ? 0 : 1;
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* MSDIO.TXT
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
u16
|
||||
EFUSE_GetArrayLen_MP_8188E_MSDIO(void);
|
||||
|
||||
void
|
||||
EFUSE_GetMaskArray_MP_8188E_MSDIO(
|
||||
u8 *Array
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
EFUSE_IsAddressMasked_MP_8188E_MSDIO(/* TC: Test Chip, MP: MP Chip */
|
||||
u16 Offset
|
||||
);
|
||||
@@ -1,95 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/* #include "Mp_Precomp.h" */
|
||||
/* #include "../odm_precomp.h" */
|
||||
|
||||
#include <drv_types.h>
|
||||
|
||||
#include "HalEfuseMask8188E_USB.h"
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* MUSB.TXT
|
||||
******************************************************************************/
|
||||
|
||||
u8 Array_MP_8188E_MUSB[] = {
|
||||
0xFF,
|
||||
0xF3,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x0F,
|
||||
0xF1,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0xF7,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
|
||||
};
|
||||
|
||||
u16
|
||||
EFUSE_GetArrayLen_MP_8188E_MUSB(void)
|
||||
{
|
||||
return sizeof(Array_MP_8188E_MUSB) / sizeof(u8);
|
||||
}
|
||||
|
||||
void
|
||||
EFUSE_GetMaskArray_MP_8188E_MUSB(
|
||||
u8 *Array
|
||||
)
|
||||
{
|
||||
u16 len = EFUSE_GetArrayLen_MP_8188E_MUSB(), i = 0;
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
Array[i] = Array_MP_8188E_MUSB[i];
|
||||
}
|
||||
BOOLEAN
|
||||
EFUSE_IsAddressMasked_MP_8188E_MUSB(
|
||||
u16 Offset
|
||||
)
|
||||
{
|
||||
int r = Offset / 16;
|
||||
int c = (Offset % 16) / 2;
|
||||
int result = 0;
|
||||
|
||||
if (c < 4) /* Upper double word */
|
||||
result = (Array_MP_8188E_MUSB[r] & (0x10 << c));
|
||||
else
|
||||
result = (Array_MP_8188E_MUSB[r] & (0x01 << (c - 4)));
|
||||
|
||||
return (result > 0) ? 0 : 1;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,245 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2016 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <hal_btcoex_wifionly.h>
|
||||
|
||||
#if (CONFIG_BTCOEX_SUPPORT_WIFI_ONLY_CFG == 1)
|
||||
|
||||
#include "btc/mp_precomp.h"
|
||||
|
||||
struct wifi_only_cfg GLBtCoexistWifiOnly;
|
||||
|
||||
void halwifionly_write1byte(void *pwifionlyContext, u32 RegAddr, u8 Data)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
rtw_write8(Adapter, RegAddr, Data);
|
||||
}
|
||||
|
||||
void halwifionly_write2byte(void *pwifionlyContext, u32 RegAddr, u16 Data)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
rtw_write16(Adapter, RegAddr, Data);
|
||||
}
|
||||
|
||||
void halwifionly_write4byte(void *pwifionlyContext, u32 RegAddr, u32 Data)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
rtw_write32(Adapter, RegAddr, Data);
|
||||
}
|
||||
|
||||
u8 halwifionly_read1byte(void *pwifionlyContext, u32 RegAddr)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
return rtw_read8(Adapter, RegAddr);
|
||||
}
|
||||
|
||||
u16 halwifionly_read2byte(void * pwifionlyContext, u32 RegAddr)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
return rtw_read16(Adapter, RegAddr);
|
||||
}
|
||||
|
||||
u32 halwifionly_read4byte(void *pwifionlyContext, u32 RegAddr)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
return rtw_read32(Adapter, RegAddr);
|
||||
}
|
||||
|
||||
void halwifionly_bitmaskwrite1byte(void *pwifionlyContext, u32 regAddr, u8 bitMask, u8 data)
|
||||
{
|
||||
u8 originalValue, bitShift = 0;
|
||||
u8 i;
|
||||
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
if (bitMask != 0xff) {
|
||||
originalValue = rtw_read8(Adapter, regAddr);
|
||||
for (i = 0; i <= 7; i++) {
|
||||
if ((bitMask >> i) & 0x1)
|
||||
break;
|
||||
}
|
||||
bitShift = i;
|
||||
data = ((originalValue) & (~bitMask)) | (((data << bitShift)) & bitMask);
|
||||
}
|
||||
rtw_write8(Adapter, regAddr, data);
|
||||
}
|
||||
|
||||
void halwifionly_phy_set_rf_reg(void *pwifionlyContext, enum rf_path eRFPath, u32 RegAddr, u32 BitMask, u32 Data)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
phy_set_rf_reg(Adapter, eRFPath, RegAddr, BitMask, Data);
|
||||
}
|
||||
|
||||
void halwifionly_phy_set_bb_reg(void *pwifionlyContext, u32 RegAddr, u32 BitMask, u32 Data)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = (struct wifi_only_cfg *)pwifionlyContext;
|
||||
PADAPTER Adapter = pwifionlycfg->Adapter;
|
||||
|
||||
phy_set_bb_reg(Adapter, RegAddr, BitMask, Data);
|
||||
}
|
||||
|
||||
void hal_btcoex_wifionly_switchband_notify(PADAPTER padapter)
|
||||
{
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
u8 is_5g = _FALSE;
|
||||
|
||||
if (pHalData->current_band_type == BAND_ON_5G)
|
||||
is_5g = _TRUE;
|
||||
|
||||
if (IS_HARDWARE_TYPE_8822B(padapter)) {
|
||||
#ifdef CONFIG_RTL8822B
|
||||
ex_hal8822b_wifi_only_switchbandnotify(&GLBtCoexistWifiOnly, is_5g);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_RTL8821C
|
||||
else if (IS_HARDWARE_TYPE_8821C(padapter))
|
||||
ex_hal8821c_wifi_only_switchbandnotify(&GLBtCoexistWifiOnly, is_5g);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RTL8822C
|
||||
else if (IS_HARDWARE_TYPE_8822C(padapter))
|
||||
ex_hal8822c_wifi_only_switchbandnotify(&GLBtCoexistWifiOnly, is_5g);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void hal_btcoex_wifionly_scan_notify(PADAPTER padapter)
|
||||
{
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
u8 is_5g = _FALSE;
|
||||
|
||||
if (pHalData->current_band_type == BAND_ON_5G)
|
||||
is_5g = _TRUE;
|
||||
|
||||
if (IS_HARDWARE_TYPE_8822B(padapter)) {
|
||||
#ifdef CONFIG_RTL8822B
|
||||
ex_hal8822b_wifi_only_scannotify(&GLBtCoexistWifiOnly, is_5g);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_RTL8821C
|
||||
else if (IS_HARDWARE_TYPE_8821C(padapter))
|
||||
ex_hal8821c_wifi_only_scannotify(&GLBtCoexistWifiOnly, is_5g);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RTL8822C
|
||||
else if (IS_HARDWARE_TYPE_8822C(padapter))
|
||||
ex_hal8822c_wifi_only_scannotify(&GLBtCoexistWifiOnly, is_5g);
|
||||
#endif
|
||||
}
|
||||
|
||||
void hal_btcoex_wifionly_connect_notify(PADAPTER padapter)
|
||||
{
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
u8 is_5g = _FALSE;
|
||||
|
||||
if (pHalData->current_band_type == BAND_ON_5G)
|
||||
is_5g = _TRUE;
|
||||
|
||||
if (IS_HARDWARE_TYPE_8822B(padapter)) {
|
||||
#ifdef CONFIG_RTL8822B
|
||||
ex_hal8822b_wifi_only_connectnotify(&GLBtCoexistWifiOnly, is_5g);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_RTL8821C
|
||||
else if (IS_HARDWARE_TYPE_8821C(padapter))
|
||||
ex_hal8821c_wifi_only_connectnotify(&GLBtCoexistWifiOnly, is_5g);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RTL8822C
|
||||
else if (IS_HARDWARE_TYPE_8822C(padapter))
|
||||
ex_hal8822c_wifi_only_connectnotify(&GLBtCoexistWifiOnly, is_5g);
|
||||
#endif
|
||||
}
|
||||
|
||||
void hal_btcoex_wifionly_hw_config(PADAPTER padapter)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = &GLBtCoexistWifiOnly;
|
||||
|
||||
if (IS_HARDWARE_TYPE_8723B(padapter)) {
|
||||
#ifdef CONFIG_RTL8723B
|
||||
ex_hal8723b_wifi_only_hw_config(pwifionlycfg);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_RTL8822B
|
||||
else if (IS_HARDWARE_TYPE_8822B(padapter))
|
||||
ex_hal8822b_wifi_only_hw_config(pwifionlycfg);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RTL8821C
|
||||
else if (IS_HARDWARE_TYPE_8821C(padapter))
|
||||
ex_hal8821c_wifi_only_hw_config(pwifionlycfg);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RTL8822C
|
||||
else if (IS_HARDWARE_TYPE_8822C(padapter))
|
||||
ex_hal8822c_wifi_only_hw_config(pwifionlycfg);
|
||||
#endif
|
||||
}
|
||||
|
||||
void hal_btcoex_wifionly_initlizevariables(PADAPTER padapter)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = &GLBtCoexistWifiOnly;
|
||||
struct wifi_only_haldata *pwifionly_haldata = &pwifionlycfg->haldata_info;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
|
||||
_rtw_memset(&GLBtCoexistWifiOnly, 0, sizeof(GLBtCoexistWifiOnly));
|
||||
|
||||
pwifionlycfg->Adapter = padapter;
|
||||
|
||||
#ifdef CONFIG_PCI_HCI
|
||||
pwifionlycfg->chip_interface = WIFIONLY_INTF_PCI;
|
||||
#elif defined(CONFIG_USB_HCI)
|
||||
pwifionlycfg->chip_interface = WIFIONLY_INTF_USB;
|
||||
#elif defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
|
||||
pwifionlycfg->chip_interface = WIFIONLY_INTF_SDIO;
|
||||
#else
|
||||
pwifionlycfg->chip_interface = WIFIONLY_INTF_UNKNOWN;
|
||||
#endif
|
||||
|
||||
pwifionly_haldata->customer_id = CUSTOMER_NORMAL;
|
||||
}
|
||||
|
||||
void hal_btcoex_wifionly_AntInfoSetting(PADAPTER padapter)
|
||||
{
|
||||
struct wifi_only_cfg *pwifionlycfg = &GLBtCoexistWifiOnly;
|
||||
struct wifi_only_haldata *pwifionly_haldata = &pwifionlycfg->haldata_info;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
|
||||
pwifionly_haldata->efuse_pg_antnum = pHalData->EEPROMBluetoothAntNum;
|
||||
pwifionly_haldata->efuse_pg_antpath = pHalData->ant_path;
|
||||
pwifionly_haldata->rfe_type = pHalData->rfe_type;
|
||||
pwifionly_haldata->ant_div_cfg = pHalData->AntDivCfg;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,125 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __COMMON_C2H_H__
|
||||
#define __COMMON_C2H_H__
|
||||
|
||||
#define C2H_TYPE_REG 0
|
||||
#define C2H_TYPE_PKT 1
|
||||
|
||||
/*
|
||||
* C2H event format:
|
||||
* Fields TRIGGER PAYLOAD SEQ PLEN ID
|
||||
* BITS [127:120] [119:16] [15:8] [7:4] [3:0]
|
||||
*/
|
||||
#define C2H_ID(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)), 0, 4)
|
||||
#define C2H_PLEN(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)), 4, 4)
|
||||
#define C2H_SEQ(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)) + 1, 0, 8)
|
||||
#define C2H_PAYLOAD(_c2h) (((u8*)(_c2h)) + 2)
|
||||
|
||||
#define SET_C2H_ID(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)), 0, 4, _val)
|
||||
#define SET_C2H_PLEN(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)), 4, 4, _val)
|
||||
#define SET_C2H_SEQ(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)) + 1 , 0, 8, _val)
|
||||
|
||||
/*
|
||||
* C2H event format:
|
||||
* Fields TRIGGER PLEN PAYLOAD SEQ ID
|
||||
* BITS [127:120] [119:112] [111:16] [15:8] [7:0]
|
||||
*/
|
||||
#define C2H_ID_88XX(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)), 0, 8)
|
||||
#define C2H_SEQ_88XX(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)) + 1, 0, 8)
|
||||
#define C2H_PAYLOAD_88XX(_c2h) (((u8*)(_c2h)) + 2)
|
||||
#define C2H_PLEN_88XX(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)) + 14, 0, 8)
|
||||
#define C2H_TRIGGER_88XX(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)) + 15, 0, 8)
|
||||
|
||||
#define SET_C2H_ID_88XX(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)), 0, 8, _val)
|
||||
#define SET_C2H_SEQ_88XX(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)) + 1, 0, 8, _val)
|
||||
#define SET_C2H_PLEN_88XX(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)) + 14, 0, 8, _val)
|
||||
|
||||
typedef enum _C2H_EVT {
|
||||
C2H_DBG = 0x00,
|
||||
C2H_LB = 0x01,
|
||||
C2H_TXBF = 0x02,
|
||||
C2H_CCX_TX_RPT = 0x03,
|
||||
C2H_AP_REQ_TXRPT = 0x04,
|
||||
C2H_FW_SCAN_COMPLETE = 0x7,
|
||||
C2H_BT_INFO = 0x09,
|
||||
C2H_BT_MP_INFO = 0x0B,
|
||||
C2H_RA_RPT = 0x0C,
|
||||
C2H_SPC_STAT = 0x0D,
|
||||
C2H_RA_PARA_RPT = 0x0E,
|
||||
C2H_FW_CHNL_SWITCH_COMPLETE = 0x10,
|
||||
C2H_IQK_FINISH = 0x11,
|
||||
C2H_MAILBOX_STATUS = 0x15,
|
||||
C2H_P2P_RPORT = 0x16,
|
||||
C2H_MCC = 0x17,
|
||||
C2H_MAC_HIDDEN_RPT = 0x19,
|
||||
C2H_MAC_HIDDEN_RPT_2 = 0x1A,
|
||||
C2H_BCN_EARLY_RPT = 0x1E,
|
||||
C2H_DEFEATURE_DBG = 0x22,
|
||||
C2H_CUSTOMER_STR_RPT = 0x24,
|
||||
C2H_CUSTOMER_STR_RPT_2 = 0x25,
|
||||
C2H_WLAN_INFO = 0x27,
|
||||
#ifdef RTW_PER_CMD_SUPPORT_FW
|
||||
C2H_PER_RATE_RPT = 0x2c,
|
||||
#endif
|
||||
C2H_DEFEATURE_RSVD = 0xFD,
|
||||
C2H_EXTEND = 0xff,
|
||||
} C2H_EVT;
|
||||
|
||||
typedef enum _EXTEND_C2H_EVT {
|
||||
EXTEND_C2H_DBG_PRINT = 0
|
||||
} EXTEND_C2H_EVT;
|
||||
|
||||
#define C2H_REG_LEN 16
|
||||
|
||||
/* C2H_IQK_FINISH, 0x11 */
|
||||
#define IQK_OFFLOAD_LEN 1
|
||||
void c2h_iqk_offload(_adapter *adapter, u8 *data, u8 len);
|
||||
int c2h_iqk_offload_wait(_adapter *adapter, u32 timeout_ms);
|
||||
#define rtl8812_iqk_wait c2h_iqk_offload_wait /* TODO: remove this after phydm call c2h_iqk_offload_wait instead */
|
||||
|
||||
#ifdef CONFIG_RTW_MAC_HIDDEN_RPT
|
||||
/* C2H_MAC_HIDDEN_RPT, 0x19 */
|
||||
#define MAC_HIDDEN_RPT_LEN 8
|
||||
int c2h_mac_hidden_rpt_hdl(_adapter *adapter, u8 *data, u8 len);
|
||||
|
||||
/* C2H_MAC_HIDDEN_RPT_2, 0x1A */
|
||||
#define MAC_HIDDEN_RPT_2_LEN 5
|
||||
int c2h_mac_hidden_rpt_2_hdl(_adapter *adapter, u8 *data, u8 len);
|
||||
int hal_read_mac_hidden_rpt(_adapter *adapter);
|
||||
#else
|
||||
#define hal_read_mac_hidden_rpt(adapter) _SUCCESS
|
||||
#endif /* CONFIG_RTW_MAC_HIDDEN_RPT */
|
||||
|
||||
/* C2H_DEFEATURE_DBG, 0x22 */
|
||||
#define DEFEATURE_DBG_LEN 1
|
||||
int c2h_defeature_dbg_hdl(_adapter *adapter, u8 *data, u8 len);
|
||||
|
||||
#ifdef CONFIG_RTW_CUSTOMER_STR
|
||||
/* C2H_CUSTOMER_STR_RPT, 0x24 */
|
||||
#define CUSTOMER_STR_RPT_LEN 8
|
||||
int c2h_customer_str_rpt_hdl(_adapter *adapter, u8 *data, u8 len);
|
||||
|
||||
/* C2H_CUSTOMER_STR_RPT_2, 0x25 */
|
||||
#define CUSTOMER_STR_RPT_2_LEN 8
|
||||
int c2h_customer_str_rpt_2_hdl(_adapter *adapter, u8 *data, u8 len);
|
||||
#endif /* CONFIG_RTW_CUSTOMER_STR */
|
||||
|
||||
#ifdef RTW_PER_CMD_SUPPORT_FW
|
||||
/* C2H_PER_RATE_RPT, 0x2c */
|
||||
int c2h_per_rate_rpt_hdl(_adapter *adapter, u8 *data, u8 len);
|
||||
#endif
|
||||
|
||||
#endif /* __COMMON_C2H_H__ */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,120 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __HAL_DM_H__
|
||||
#define __HAL_DM_H__
|
||||
|
||||
#define adapter_to_phydm(adapter) (&(GET_HAL_DATA(adapter)->odmpriv))
|
||||
#define dvobj_to_phydm(dvobj) adapter_to_phydm(dvobj_get_primary_adapter(dvobj))
|
||||
#ifdef CONFIG_TDMADIG
|
||||
void rtw_phydm_tdmadig(_adapter *adapter, u8 state);
|
||||
#endif
|
||||
void rtw_phydm_priv_init(_adapter *adapter);
|
||||
void Init_ODM_ComInfo(_adapter *adapter);
|
||||
void rtw_phydm_init(_adapter *adapter);
|
||||
|
||||
void rtw_hal_turbo_edca(_adapter *adapter);
|
||||
u8 rtw_phydm_is_iqk_in_progress(_adapter *adapter);
|
||||
|
||||
void GetHalODMVar(
|
||||
PADAPTER Adapter,
|
||||
HAL_ODM_VARIABLE eVariable,
|
||||
void *pValue1,
|
||||
void *pValue2);
|
||||
void SetHalODMVar(
|
||||
PADAPTER Adapter,
|
||||
HAL_ODM_VARIABLE eVariable,
|
||||
void *pValue1,
|
||||
BOOLEAN bSet);
|
||||
|
||||
void rtw_phydm_ra_registed(_adapter *adapter, struct sta_info *psta);
|
||||
|
||||
#ifdef CONFIG_DYNAMIC_SOML
|
||||
void rtw_dyn_soml_byte_update(_adapter *adapter, u8 data_rate, u32 size);
|
||||
void rtw_dyn_soml_para_set(_adapter *adapter, u8 train_num, u8 intvl,
|
||||
u8 period, u8 delay);
|
||||
void rtw_dyn_soml_config(_adapter *adapter);
|
||||
#endif
|
||||
#ifdef RTW_DYNAMIC_RRSR
|
||||
void rtw_phydm_set_rrsr(_adapter *adapter, u32 rrsr_value, bool write_rrsr);
|
||||
#endif
|
||||
void rtw_phydm_watchdog(_adapter *adapter, bool in_lps);
|
||||
|
||||
void rtw_hal_update_iqk_fw_offload_cap(_adapter *adapter);
|
||||
void dump_sta_info(void *sel, struct sta_info *psta);
|
||||
void dump_sta_traffic(void *sel, _adapter *adapter, struct sta_info *psta);
|
||||
|
||||
#ifdef CONFIG_DBG_RF_CAL
|
||||
void rtw_hal_iqk_test(_adapter *adapter, bool recovery, bool clear, bool segment);
|
||||
void rtw_hal_lck_test(_adapter *adapter);
|
||||
#endif
|
||||
|
||||
s8 rtw_dm_get_min_rssi(_adapter *adapter);
|
||||
s8 rtw_phydm_get_min_rssi(_adapter *adapter);
|
||||
u8 rtw_phydm_get_cur_igi(_adapter *adapter);
|
||||
|
||||
|
||||
#ifdef CONFIG_LPS_LCLK_WD_TIMER
|
||||
extern void phydm_rssi_monitor_check(void *p_dm_void);
|
||||
|
||||
void rtw_phydm_wd_lps_lclk_hdl(_adapter *adapter);
|
||||
void rtw_phydm_watchdog_in_lps_lclk(_adapter *adapter);
|
||||
#endif
|
||||
#ifdef CONFIG_TDMADIG
|
||||
enum rtw_tdmadig_state{
|
||||
TDMADIG_INIT,
|
||||
TDMADIG_NON_INIT,
|
||||
};
|
||||
#endif
|
||||
enum phy_cnt {
|
||||
FA_OFDM,
|
||||
FA_CCK,
|
||||
FA_TOTAL,
|
||||
CCA_OFDM,
|
||||
CCA_CCK,
|
||||
CCA_ALL,
|
||||
CRC32_OK_VHT,
|
||||
CRC32_OK_HT,
|
||||
CRC32_OK_LEGACY,
|
||||
CRC32_OK_CCK,
|
||||
CRC32_ERROR_VHT,
|
||||
CRC32_ERROR_HT,
|
||||
CRC32_ERROR_LEGACY,
|
||||
CRC32_ERROR_CCK,
|
||||
};
|
||||
u32 rtw_phydm_get_phy_cnt(_adapter *adapter, enum phy_cnt cnt);
|
||||
#if ((RTL8822B_SUPPORT == 1) || (RTL8821C_SUPPORT == 1) || (RTL8814B_SUPPORT == 1) || (RTL8822C_SUPPORT == 1))
|
||||
void rtw_phydm_iqk_trigger(_adapter *adapter);
|
||||
#endif
|
||||
void rtw_phydm_read_efuse(_adapter *adapter);
|
||||
bool rtw_phydm_set_crystal_cap(_adapter *adapter, u8 crystal_cap);
|
||||
|
||||
#ifdef CONFIG_SUPPORT_DYNAMIC_TXPWR
|
||||
void rtw_phydm_set_dyntxpwr(_adapter *adapter, u8 *desc, u8 mac_id);
|
||||
#endif
|
||||
#ifdef CONFIG_RTW_TX_2PATH_EN
|
||||
void rtw_phydm_tx_2path_en(_adapter *adapter);
|
||||
#endif
|
||||
#ifdef CONFIG_LPS_PG
|
||||
void rtw_phydm_lps_pg_hdl(_adapter *adapter, struct sta_info *sta, bool in_lpspg);
|
||||
#endif
|
||||
#ifdef CONFIG_LPS_PWR_TRACKING
|
||||
void rtw_phydm_pwr_tracking_directly(_adapter *adapter);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CTRL_TXSS_BY_TP
|
||||
void rtw_phydm_trx_cfg(_adapter *adapter, bool tx_1ss);
|
||||
#endif
|
||||
|
||||
#endif /* __HAL_DM_H__ */
|
||||
@@ -1,554 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2014 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <drv_types.h>
|
||||
#include <hal_data.h>
|
||||
|
||||
|
||||
#if defined(CONFIG_RTW_ACS) || defined(CONFIG_BACKGROUND_NOISE_MONITOR)
|
||||
static void _rtw_bss_nums_count(_adapter *adapter, u8 *pbss_nums)
|
||||
{
|
||||
struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
|
||||
_queue *queue = &(pmlmepriv->scanned_queue);
|
||||
struct wlan_network *pnetwork = NULL;
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
|
||||
_list *plist, *phead;
|
||||
_irqL irqL;
|
||||
int chan_idx = -1;
|
||||
|
||||
if (pbss_nums == NULL) {
|
||||
RTW_ERR("%s pbss_nums is null pointer\n", __func__);
|
||||
return;
|
||||
}
|
||||
_rtw_memset(pbss_nums, 0, MAX_CHANNEL_NUM);
|
||||
|
||||
_enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
|
||||
phead = get_list_head(queue);
|
||||
plist = get_next(phead);
|
||||
while (1) {
|
||||
if (rtw_end_of_queue_search(phead, plist) == _TRUE)
|
||||
break;
|
||||
|
||||
pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list);
|
||||
if (!pnetwork)
|
||||
break;
|
||||
chan_idx = rtw_chset_search_ch(adapter_to_chset(adapter), pnetwork->network.Configuration.DSConfig);
|
||||
if ((chan_idx == -1) || (chan_idx >= MAX_CHANNEL_NUM)) {
|
||||
RTW_ERR("%s can't get chan_idx(CH:%d)\n",
|
||||
__func__, pnetwork->network.Configuration.DSConfig);
|
||||
chan_idx = 0;
|
||||
}
|
||||
/*if (pnetwork->network.Reserved[0] != BSS_TYPE_PROB_REQ)*/
|
||||
|
||||
pbss_nums[chan_idx]++;
|
||||
|
||||
plist = get_next(plist);
|
||||
}
|
||||
_exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
|
||||
}
|
||||
|
||||
u8 rtw_get_ch_num_by_idx(_adapter *adapter, u8 idx)
|
||||
{
|
||||
struct rf_ctl_t *rfctl = adapter_to_rfctl(adapter);
|
||||
RT_CHANNEL_INFO *pch_set = rfctl->channel_set;
|
||||
u8 max_chan_nums = rfctl->max_chan_nums;
|
||||
|
||||
if (idx >= max_chan_nums)
|
||||
return 0;
|
||||
return pch_set[idx].ChannelNum;
|
||||
}
|
||||
#endif /*defined(CONFIG_RTW_ACS) || defined(CONFIG_BACKGROUND_NOISE_MONITOR)*/
|
||||
|
||||
|
||||
#ifdef CONFIG_RTW_ACS
|
||||
void rtw_acs_version_dump(void *sel, _adapter *adapter)
|
||||
{
|
||||
_RTW_PRINT_SEL(sel, "RTK_ACS VER_%d\n", RTK_ACS_VERSION);
|
||||
}
|
||||
u8 rtw_phydm_clm_ratio(_adapter *adapter)
|
||||
{
|
||||
struct dm_struct *phydm = adapter_to_phydm(adapter);
|
||||
|
||||
return phydm_cmn_info_query(phydm, (enum phydm_info_query) PHYDM_INFO_CLM_RATIO);
|
||||
}
|
||||
u8 rtw_phydm_nhm_ratio(_adapter *adapter)
|
||||
{
|
||||
struct dm_struct *phydm = adapter_to_phydm(adapter);
|
||||
|
||||
return phydm_cmn_info_query(phydm, (enum phydm_info_query) PHYDM_INFO_NHM_RATIO);
|
||||
}
|
||||
void rtw_acs_reset(_adapter *adapter)
|
||||
{
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
struct auto_chan_sel *pacs = &hal_data->acs;
|
||||
|
||||
_rtw_memset(pacs, 0, sizeof(struct auto_chan_sel));
|
||||
#ifdef CONFIG_RTW_ACS_DBG
|
||||
rtw_acs_adv_reset(adapter);
|
||||
#endif /*CONFIG_RTW_ACS_DBG*/
|
||||
}
|
||||
|
||||
#ifdef CONFIG_RTW_ACS_DBG
|
||||
u8 rtw_is_acs_igi_valid(_adapter *adapter)
|
||||
{
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
struct auto_chan_sel *pacs = &hal_data->acs;
|
||||
|
||||
if ((pacs->igi) && ((pacs->igi >= 0x1E) || (pacs->igi < 0x60)))
|
||||
return _TRUE;
|
||||
|
||||
return _FALSE;
|
||||
}
|
||||
void rtw_acs_adv_setting(_adapter *adapter, RT_SCAN_TYPE scan_type, u16 scan_time, u8 igi, u8 bw)
|
||||
{
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
struct auto_chan_sel *pacs = &hal_data->acs;
|
||||
struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
|
||||
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
|
||||
|
||||
pacs->scan_type = scan_type;
|
||||
pacs->scan_time = scan_time;
|
||||
pacs->igi = igi;
|
||||
pacs->bw = bw;
|
||||
RTW_INFO("[ACS] ADV setting - scan_type:%c, ch_ms:%d(ms), igi:0x%02x, bw:%d\n",
|
||||
pacs->scan_type ? 'A' : 'P', pacs->scan_time, pacs->igi, pacs->bw);
|
||||
}
|
||||
void rtw_acs_adv_reset(_adapter *adapter)
|
||||
{
|
||||
rtw_acs_adv_setting(adapter, SCAN_ACTIVE, 0, 0, 0);
|
||||
}
|
||||
#endif /*CONFIG_RTW_ACS_DBG*/
|
||||
|
||||
void rtw_acs_trigger(_adapter *adapter, u16 scan_time_ms, u8 scan_chan, enum NHM_PID pid)
|
||||
{
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
struct dm_struct *phydm = adapter_to_phydm(adapter);
|
||||
#if (RTK_ACS_VERSION == 3)
|
||||
struct clm_para_info clm_para;
|
||||
struct nhm_para_info nhm_para;
|
||||
struct env_trig_rpt trig_rpt;
|
||||
|
||||
scan_time_ms -= 10;
|
||||
|
||||
init_acs_clm(clm_para, scan_time_ms);
|
||||
|
||||
if (pid == NHM_PID_IEEE_11K_HIGH)
|
||||
init_11K_high_nhm(nhm_para, scan_time_ms);
|
||||
else if (pid == NHM_PID_IEEE_11K_LOW)
|
||||
init_11K_low_nhm(nhm_para, scan_time_ms);
|
||||
else
|
||||
init_acs_nhm(nhm_para, scan_time_ms);
|
||||
|
||||
hal_data->acs.trig_rst = phydm_env_mntr_trigger(phydm, &nhm_para, &clm_para, &trig_rpt);
|
||||
if (hal_data->acs.trig_rst == (NHM_SUCCESS | CLM_SUCCESS)) {
|
||||
hal_data->acs.trig_rpt.clm_rpt_stamp = trig_rpt.clm_rpt_stamp;
|
||||
hal_data->acs.trig_rpt.nhm_rpt_stamp = trig_rpt.nhm_rpt_stamp;
|
||||
/*RTW_INFO("[ACS] trigger success (rst = 0x%02x, clm_stamp:%d, nhm_stamp:%d)\n",
|
||||
hal_data->acs.trig_rst, hal_data->acs.trig_rpt.clm_rpt_stamp, hal_data->acs.trig_rpt.nhm_rpt_stamp);*/
|
||||
} else
|
||||
RTW_ERR("[ACS] trigger failed (rst = 0x%02x)\n", hal_data->acs.trig_rst);
|
||||
#else
|
||||
phydm_ccx_monitor_trigger(phydm, scan_time_ms);
|
||||
#endif
|
||||
|
||||
hal_data->acs.trigger_ch = scan_chan;
|
||||
hal_data->acs.triggered = _TRUE;
|
||||
|
||||
#ifdef CONFIG_RTW_ACS_DBG
|
||||
RTW_INFO("[ACS] Trigger CH:%d, Times:%d\n", hal_data->acs.trigger_ch, scan_time_ms);
|
||||
#endif
|
||||
}
|
||||
void rtw_acs_get_rst(_adapter *adapter)
|
||||
{
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
struct dm_struct *phydm = adapter_to_phydm(adapter);
|
||||
int chan_idx = -1;
|
||||
u8 cur_chan = hal_data->acs.trigger_ch;
|
||||
|
||||
if (cur_chan == 0)
|
||||
return;
|
||||
|
||||
if (!hal_data->acs.triggered)
|
||||
return;
|
||||
|
||||
chan_idx = rtw_chset_search_ch(adapter_to_chset(adapter), cur_chan);
|
||||
if ((chan_idx == -1) || (chan_idx >= MAX_CHANNEL_NUM)) {
|
||||
RTW_ERR("[ACS] %s can't get chan_idx(CH:%d)\n", __func__, cur_chan);
|
||||
return;
|
||||
}
|
||||
#if (RTK_ACS_VERSION == 3)
|
||||
if (!(hal_data->acs.trig_rst == (NHM_SUCCESS | CLM_SUCCESS))) {
|
||||
RTW_ERR("[ACS] get_rst return, due to acs trigger failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
struct env_mntr_rpt rpt = {0};
|
||||
u8 rst;
|
||||
|
||||
rst = phydm_env_mntr_result(phydm, &rpt);
|
||||
if ((rst == (NHM_SUCCESS | CLM_SUCCESS)) &&
|
||||
(rpt.clm_rpt_stamp == hal_data->acs.trig_rpt.clm_rpt_stamp) &&
|
||||
(rpt.nhm_rpt_stamp == hal_data->acs.trig_rpt.nhm_rpt_stamp)){
|
||||
hal_data->acs.clm_ratio[chan_idx] = rpt.clm_ratio;
|
||||
hal_data->acs.nhm_ratio[chan_idx] = rpt.nhm_ratio;
|
||||
_rtw_memcpy(&hal_data->acs.nhm[chan_idx][0], rpt.nhm_result, NHM_RPT_NUM);
|
||||
|
||||
/*RTW_INFO("[ACS] get_rst success (rst = 0x%02x, clm_stamp:%d:%d, nhm_stamp:%d:%d)\n",
|
||||
rst,
|
||||
hal_data->acs.trig_rpt.clm_rpt_stamp, rpt.clm_rpt_stamp,
|
||||
hal_data->acs.trig_rpt.nhm_rpt_stamp, rpt.nhm_rpt_stamp);*/
|
||||
} else {
|
||||
RTW_ERR("[ACS] get_rst failed (rst = 0x%02x, clm_stamp:%d:%d, nhm_stamp:%d:%d)\n",
|
||||
rst,
|
||||
hal_data->acs.trig_rpt.clm_rpt_stamp, rpt.clm_rpt_stamp,
|
||||
hal_data->acs.trig_rpt.nhm_rpt_stamp, rpt.nhm_rpt_stamp);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
phydm_ccx_monitor_result(phydm);
|
||||
|
||||
hal_data->acs.clm_ratio[chan_idx] = rtw_phydm_clm_ratio(adapter);
|
||||
hal_data->acs.nhm_ratio[chan_idx] = rtw_phydm_nhm_ratio(adapter);
|
||||
#endif
|
||||
hal_data->acs.triggered = _FALSE;
|
||||
#ifdef CONFIG_RTW_ACS_DBG
|
||||
RTW_INFO("[ACS] Result CH:%d, CLM:%d NHM:%d\n",
|
||||
cur_chan, hal_data->acs.clm_ratio[chan_idx], hal_data->acs.nhm_ratio[chan_idx]);
|
||||
#endif
|
||||
}
|
||||
|
||||
void _rtw_phydm_acs_select_best_chan(_adapter *adapter)
|
||||
{
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
struct rf_ctl_t *rfctl = adapter_to_rfctl(adapter);
|
||||
u8 ch_idx;
|
||||
u8 ch_idx_24g = 0xFF, ch_idx_5g = 0xFF;
|
||||
u8 min_itf_24g = 0xFF, min_itf_5g = 0xFF;
|
||||
u8 *pbss_nums = hal_data->acs.bss_nums;
|
||||
u8 *pclm_ratio = hal_data->acs.clm_ratio;
|
||||
u8 *pnhm_ratio = hal_data->acs.nhm_ratio;
|
||||
u8 *pinterference_time = hal_data->acs.interference_time;
|
||||
u8 max_chan_nums = rfctl->max_chan_nums;
|
||||
|
||||
for (ch_idx = 0; ch_idx < max_chan_nums; ch_idx++) {
|
||||
if (pbss_nums[ch_idx])
|
||||
pinterference_time[ch_idx] = (pclm_ratio[ch_idx] / 2) + pnhm_ratio[ch_idx];
|
||||
else
|
||||
pinterference_time[ch_idx] = pclm_ratio[ch_idx] + pnhm_ratio[ch_idx];
|
||||
|
||||
if (rtw_get_ch_num_by_idx(adapter, ch_idx) < 14) {
|
||||
if (pinterference_time[ch_idx] < min_itf_24g) {
|
||||
min_itf_24g = pinterference_time[ch_idx];
|
||||
ch_idx_24g = ch_idx;
|
||||
}
|
||||
} else {
|
||||
if (pinterference_time[ch_idx] < min_itf_5g) {
|
||||
min_itf_5g = pinterference_time[ch_idx];
|
||||
ch_idx_5g = ch_idx;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ch_idx_24g != 0xFF)
|
||||
hal_data->acs.best_chan_24g = rtw_get_ch_num_by_idx(adapter, ch_idx_24g);
|
||||
|
||||
if (ch_idx_5g != 0xFF)
|
||||
hal_data->acs.best_chan_5g = rtw_get_ch_num_by_idx(adapter, ch_idx_5g);
|
||||
|
||||
hal_data->acs.trigger_ch = 0;
|
||||
}
|
||||
|
||||
void rtw_acs_info_dump(void *sel, _adapter *adapter)
|
||||
{
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
struct rf_ctl_t *rfctl = adapter_to_rfctl(adapter);
|
||||
u8 max_chan_nums = rfctl->max_chan_nums;
|
||||
u8 ch_idx, ch_num;
|
||||
|
||||
_RTW_PRINT_SEL(sel, "========== ACS (VER-%d) ==========\n", RTK_ACS_VERSION);
|
||||
_RTW_PRINT_SEL(sel, "Best 24G Channel:%d\n", hal_data->acs.best_chan_24g);
|
||||
_RTW_PRINT_SEL(sel, "Best 5G Channel:%d\n\n", hal_data->acs.best_chan_5g);
|
||||
|
||||
#ifdef CONFIG_RTW_ACS_DBG
|
||||
_RTW_PRINT_SEL(sel, "Advanced setting - scan_type:%c, ch_ms:%d(ms), igi:0x%02x, bw:%d\n",
|
||||
hal_data->acs.scan_type ? 'A' : 'P', hal_data->acs.scan_time, hal_data->acs.igi, hal_data->acs.bw);
|
||||
|
||||
_RTW_PRINT_SEL(sel, "BW 20MHz\n");
|
||||
_RTW_PRINT_SEL(sel, "%5s %3s %3s %3s(%%) %3s(%%) %3s\n",
|
||||
"Index", "CH", "BSS", "CLM", "NHM", "ITF");
|
||||
|
||||
for (ch_idx = 0; ch_idx < max_chan_nums; ch_idx++) {
|
||||
ch_num = rtw_get_ch_num_by_idx(adapter, ch_idx);
|
||||
_RTW_PRINT_SEL(sel, "%5d %3d %3d %6d %6d %3d\n",
|
||||
ch_idx, ch_num, hal_data->acs.bss_nums[ch_idx],
|
||||
hal_data->acs.clm_ratio[ch_idx],
|
||||
hal_data->acs.nhm_ratio[ch_idx],
|
||||
hal_data->acs.interference_time[ch_idx]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
void rtw_acs_select_best_chan(_adapter *adapter)
|
||||
{
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
|
||||
_rtw_bss_nums_count(adapter, hal_data->acs.bss_nums);
|
||||
_rtw_phydm_acs_select_best_chan(adapter);
|
||||
rtw_acs_info_dump(RTW_DBGDUMP, adapter);
|
||||
}
|
||||
|
||||
void rtw_acs_start(_adapter *adapter)
|
||||
{
|
||||
rtw_acs_reset(adapter);
|
||||
if (GET_ACS_STATE(adapter) != ACS_ENABLE)
|
||||
SET_ACS_STATE(adapter, ACS_ENABLE);
|
||||
}
|
||||
void rtw_acs_stop(_adapter *adapter)
|
||||
{
|
||||
SET_ACS_STATE(adapter, ACS_DISABLE);
|
||||
}
|
||||
|
||||
|
||||
u8 rtw_acs_get_clm_ratio_by_ch_num(_adapter *adapter, u8 chan)
|
||||
{
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
int chan_idx = -1;
|
||||
|
||||
chan_idx = rtw_chset_search_ch(adapter_to_chset(adapter), chan);
|
||||
if ((chan_idx == -1) || (chan_idx >= MAX_CHANNEL_NUM)) {
|
||||
RTW_ERR("[ACS] Get CLM fail, can't get chan_idx(CH:%d)\n", chan);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return hal_data->acs.clm_ratio[chan_idx];
|
||||
}
|
||||
u8 rtw_acs_get_clm_ratio_by_ch_idx(_adapter *adapter, u8 ch_idx)
|
||||
{
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
|
||||
if (ch_idx >= MAX_CHANNEL_NUM) {
|
||||
RTW_ERR("%s [ACS] ch_idx(%d) is invalid\n", __func__, ch_idx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return hal_data->acs.clm_ratio[ch_idx];
|
||||
}
|
||||
u8 rtw_acs_get_nhm_ratio_by_ch_num(_adapter *adapter, u8 chan)
|
||||
{
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
int chan_idx = -1;
|
||||
|
||||
chan_idx = rtw_chset_search_ch(adapter_to_chset(adapter), chan);
|
||||
if ((chan_idx == -1) || (chan_idx >= MAX_CHANNEL_NUM)) {
|
||||
RTW_ERR("[ACS] Get NHM fail, can't get chan_idx(CH:%d)\n", chan);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return hal_data->acs.nhm_ratio[chan_idx];
|
||||
}
|
||||
u8 rtw_acs_get_num_ratio_by_ch_idx(_adapter *adapter, u8 ch_idx)
|
||||
{
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
|
||||
if (ch_idx >= MAX_CHANNEL_NUM) {
|
||||
RTW_ERR("%s [ACS] ch_idx(%d) is invalid\n", __func__, ch_idx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return hal_data->acs.nhm_ratio[ch_idx];
|
||||
}
|
||||
void rtw_acs_chan_info_dump(void *sel, _adapter *adapter)
|
||||
{
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
struct rf_ctl_t *rfctl = adapter_to_rfctl(adapter);
|
||||
u8 max_chan_nums = rfctl->max_chan_nums;
|
||||
u8 ch_idx, ch_num;
|
||||
u8 utilization;
|
||||
|
||||
_RTW_PRINT_SEL(sel, "BW 20MHz\n");
|
||||
_RTW_PRINT_SEL(sel, "%5s %3s %7s(%%) %12s(%%) %11s(%%) %9s(%%) %8s(%%)\n",
|
||||
"Index", "CH", "Quality", "Availability", "Utilization",
|
||||
"WIFI Util", "Interference Util");
|
||||
|
||||
for (ch_idx = 0; ch_idx < max_chan_nums; ch_idx++) {
|
||||
ch_num = rtw_get_ch_num_by_idx(adapter, ch_idx);
|
||||
utilization = hal_data->acs.clm_ratio[ch_idx] + hal_data->acs.nhm_ratio[ch_idx];
|
||||
_RTW_PRINT_SEL(sel, "%5d %3d %7d %12d %12d %12d %12d\n",
|
||||
ch_idx, ch_num,
|
||||
(100-hal_data->acs.interference_time[ch_idx]),
|
||||
(100-utilization),
|
||||
utilization,
|
||||
hal_data->acs.clm_ratio[ch_idx],
|
||||
hal_data->acs.nhm_ratio[ch_idx]);
|
||||
}
|
||||
}
|
||||
void rtw_acs_current_info_dump(void *sel, _adapter *adapter)
|
||||
{
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
u8 ch, cen_ch, bw, offset;
|
||||
|
||||
_RTW_PRINT_SEL(sel, "========== ACS (VER-%d) ==========\n", RTK_ACS_VERSION);
|
||||
|
||||
ch = rtw_get_oper_ch(adapter);
|
||||
bw = rtw_get_oper_bw(adapter);
|
||||
offset = rtw_get_oper_choffset(adapter);
|
||||
|
||||
_RTW_PRINT_SEL(sel, "Current Channel:%d\n", ch);
|
||||
if ((bw == CHANNEL_WIDTH_80) ||(bw == CHANNEL_WIDTH_40)) {
|
||||
cen_ch = rtw_get_center_ch(ch, bw, offset);
|
||||
_RTW_PRINT_SEL(sel, "Center Channel:%d\n", cen_ch);
|
||||
}
|
||||
|
||||
_RTW_PRINT_SEL(sel, "Current BW %s\n", ch_width_str(bw));
|
||||
if (0)
|
||||
_RTW_PRINT_SEL(sel, "Current IGI 0x%02x\n", rtw_phydm_get_cur_igi(adapter));
|
||||
_RTW_PRINT_SEL(sel, "CLM:%d, NHM:%d\n\n",
|
||||
hal_data->acs.cur_ch_clm_ratio, hal_data->acs.cur_ch_nhm_ratio);
|
||||
}
|
||||
|
||||
void rtw_acs_update_current_info(_adapter *adapter)
|
||||
{
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
|
||||
hal_data->acs.cur_ch_clm_ratio = rtw_phydm_clm_ratio(adapter);
|
||||
hal_data->acs.cur_ch_nhm_ratio = rtw_phydm_nhm_ratio(adapter);
|
||||
|
||||
#ifdef CONFIG_RTW_ACS_DBG
|
||||
rtw_acs_current_info_dump(RTW_DBGDUMP, adapter);
|
||||
#endif
|
||||
}
|
||||
#endif /*CONFIG_RTW_ACS*/
|
||||
|
||||
#ifdef CONFIG_BACKGROUND_NOISE_MONITOR
|
||||
void rtw_noise_monitor_version_dump(void *sel, _adapter *adapter)
|
||||
{
|
||||
_RTW_PRINT_SEL(sel, "RTK_NOISE_MONITOR VER_%d\n", RTK_NOISE_MONITOR_VERSION);
|
||||
}
|
||||
void rtw_nm_enable(_adapter *adapter)
|
||||
{
|
||||
SET_NM_STATE(adapter, NM_ENABLE);
|
||||
}
|
||||
void rtw_nm_disable(_adapter *adapter)
|
||||
{
|
||||
SET_NM_STATE(adapter, NM_DISABLE);
|
||||
}
|
||||
void rtw_noise_info_dump(void *sel, _adapter *adapter)
|
||||
{
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
struct rf_ctl_t *rfctl = adapter_to_rfctl(adapter);
|
||||
u8 max_chan_nums = rfctl->max_chan_nums;
|
||||
u8 ch_idx, ch_num;
|
||||
|
||||
_RTW_PRINT_SEL(sel, "========== NM (VER-%d) ==========\n", RTK_NOISE_MONITOR_VERSION);
|
||||
|
||||
_RTW_PRINT_SEL(sel, "%5s %3s %3s %10s", "Index", "CH", "BSS", "Noise(dBm)\n");
|
||||
|
||||
_rtw_bss_nums_count(adapter, hal_data->nm.bss_nums);
|
||||
|
||||
for (ch_idx = 0; ch_idx < max_chan_nums; ch_idx++) {
|
||||
ch_num = rtw_get_ch_num_by_idx(adapter, ch_idx);
|
||||
_RTW_PRINT_SEL(sel, "%5d %3d %3d %10d\n",
|
||||
ch_idx, ch_num, hal_data->nm.bss_nums[ch_idx],
|
||||
hal_data->nm.noise[ch_idx]);
|
||||
}
|
||||
}
|
||||
|
||||
void rtw_noise_measure(_adapter *adapter, u8 chan, u8 is_pause_dig, u8 igi_value, u32 max_time)
|
||||
{
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
struct dm_struct *phydm = &hal_data->odmpriv;
|
||||
int chan_idx = -1;
|
||||
s16 noise = 0;
|
||||
|
||||
#ifdef DBG_NOISE_MONITOR
|
||||
RTW_INFO("[NM] chan(%d)-PauseDIG:%s, IGIValue:0x%02x, max_time:%d (ms)\n",
|
||||
chan, (is_pause_dig) ? "Y" : "N", igi_value, max_time);
|
||||
#endif
|
||||
|
||||
chan_idx = rtw_chset_search_ch(adapter_to_chset(adapter), chan);
|
||||
if ((chan_idx == -1) || (chan_idx >= MAX_CHANNEL_NUM)) {
|
||||
RTW_ERR("[NM] Get noise fail, can't get chan_idx(CH:%d)\n", chan);
|
||||
return;
|
||||
}
|
||||
noise = odm_inband_noise_monitor(phydm, is_pause_dig, igi_value, max_time); /*dBm*/
|
||||
|
||||
hal_data->nm.noise[chan_idx] = noise;
|
||||
|
||||
#ifdef DBG_NOISE_MONITOR
|
||||
RTW_INFO("[NM] %s chan_%d, noise = %d (dBm)\n", __func__, chan, hal_data->nm.noise[chan_idx]);
|
||||
|
||||
RTW_INFO("[NM] noise_a = %d, noise_b = %d noise_all:%d\n",
|
||||
phydm->noise_level.noise[RF_PATH_A],
|
||||
phydm->noise_level.noise[RF_PATH_B],
|
||||
phydm->noise_level.noise_all);
|
||||
#endif /*DBG_NOISE_MONITOR*/
|
||||
}
|
||||
|
||||
s16 rtw_noise_query_by_chan_num(_adapter *adapter, u8 chan)
|
||||
{
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
s16 noise = 0;
|
||||
int chan_idx = -1;
|
||||
|
||||
chan_idx = rtw_chset_search_ch(adapter_to_chset(adapter), chan);
|
||||
if ((chan_idx == -1) || (chan_idx >= MAX_CHANNEL_NUM)) {
|
||||
RTW_ERR("[NM] Get noise fail, can't get chan_idx(CH:%d)\n", chan);
|
||||
return noise;
|
||||
}
|
||||
noise = hal_data->nm.noise[chan_idx];
|
||||
|
||||
#ifdef DBG_NOISE_MONITOR
|
||||
RTW_INFO("[NM] %s chan_%d, noise = %d (dBm)\n", __func__, chan, noise);
|
||||
#endif/*DBG_NOISE_MONITOR*/
|
||||
return noise;
|
||||
}
|
||||
s16 rtw_noise_query_by_chan_idx(_adapter *adapter, u8 ch_idx)
|
||||
{
|
||||
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter);
|
||||
s16 noise = 0;
|
||||
|
||||
if (ch_idx >= MAX_CHANNEL_NUM) {
|
||||
RTW_ERR("[NM] %s ch_idx(%d) is invalid\n", __func__, ch_idx);
|
||||
return noise;
|
||||
}
|
||||
noise = hal_data->nm.noise[ch_idx];
|
||||
|
||||
#ifdef DBG_NOISE_MONITOR
|
||||
RTW_INFO("[NM] %s ch_idx %d, noise = %d (dBm)\n", __func__, ch_idx, noise);
|
||||
#endif/*DBG_NOISE_MONITOR*/
|
||||
return noise;
|
||||
}
|
||||
|
||||
s16 rtw_noise_measure_curchan(_adapter *padapter)
|
||||
{
|
||||
s16 noise = 0;
|
||||
u8 igi_value = 0x1E;
|
||||
u32 max_time = 100;/* ms */
|
||||
u8 is_pause_dig = _TRUE;
|
||||
u8 cur_chan = rtw_get_oper_ch(padapter);
|
||||
|
||||
if (rtw_linked_check(padapter) == _FALSE)
|
||||
return noise;
|
||||
|
||||
rtw_ps_deny(padapter, PS_DENY_IOCTL);
|
||||
LeaveAllPowerSaveModeDirect(padapter);
|
||||
rtw_noise_measure(padapter, cur_chan, is_pause_dig, igi_value, max_time);
|
||||
noise = rtw_noise_query_by_chan_num(padapter, cur_chan);
|
||||
rtw_ps_deny_cancel(padapter, PS_DENY_IOCTL);
|
||||
|
||||
return noise;
|
||||
}
|
||||
#endif /*CONFIG_BACKGROUND_NOISE_MONITOR*/
|
||||
|
||||
@@ -1,167 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __HAL_DM_ACS_H__
|
||||
#define __HAL_DM_ACS_H__
|
||||
#ifdef CONFIG_RTW_ACS
|
||||
#define RTK_ACS_VERSION 3
|
||||
|
||||
#if (RTK_ACS_VERSION == 3)
|
||||
enum NHM_PID {
|
||||
NHM_PID_ACS,
|
||||
NHM_PID_IEEE_11K_HIGH,
|
||||
NHM_PID_IEEE_11K_LOW,
|
||||
};
|
||||
|
||||
#define init_clm_param(clm, app, lv, time) \
|
||||
do {\
|
||||
clm.clm_app = app;\
|
||||
clm.clm_lv = lv;\
|
||||
clm.mntr_time = time;\
|
||||
} while (0)
|
||||
|
||||
#define init_nhm_param(nhm, txon, cca, cnt_opt, app, lv, time) \
|
||||
do {\
|
||||
nhm.incld_txon = txon;\
|
||||
nhm.incld_cca = cca;\
|
||||
nhm.div_opt = cnt_opt;\
|
||||
nhm.nhm_app = app;\
|
||||
nhm.nhm_lv = lv;\
|
||||
nhm.mntr_time = time;\
|
||||
} while (0)
|
||||
|
||||
|
||||
#define init_acs_clm(clm, time) \
|
||||
init_clm_param(clm, CLM_ACS, CLM_LV_2, time)
|
||||
|
||||
#define init_acs_nhm(nhm, time) \
|
||||
init_nhm_param(nhm, NHM_EXCLUDE_TXON, NHM_EXCLUDE_CCA, NHM_CNT_ALL, NHM_ACS, NHM_LV_2, time)
|
||||
|
||||
#define init_11K_high_nhm(nhm, time) \
|
||||
init_nhm_param(nhm, NHM_EXCLUDE_TXON, NHM_EXCLUDE_CCA, NHM_CNT_ALL, IEEE_11K_HIGH, NHM_LV_2, time)
|
||||
|
||||
#define init_11K_low_nhm(nhm, time) \
|
||||
init_nhm_param(nhm, NHM_EXCLUDE_TXON, NHM_EXCLUDE_CCA, NHM_CNT_ALL, IEEE_11K_LOW, NHM_LV_2, time)
|
||||
|
||||
|
||||
#endif /*(RTK_ACS_VERSION == 3)*/
|
||||
void rtw_acs_version_dump(void *sel, _adapter *adapter);
|
||||
extern void phydm_ccx_monitor_trigger(void *p_dm_void, u16 monitor_time);
|
||||
extern void phydm_ccx_monitor_result(void *p_dm_void);
|
||||
|
||||
#define GET_ACS_STATE(padapter) (ATOMIC_READ(&GET_HAL_DATA(padapter)->acs.state))
|
||||
#define SET_ACS_STATE(padapter, set_state) (ATOMIC_SET(&GET_HAL_DATA(padapter)->acs.state, set_state))
|
||||
#define IS_ACS_ENABLE(padapter) ((GET_ACS_STATE(padapter) == ACS_ENABLE) ? _TRUE : _FALSE)
|
||||
|
||||
enum ACS_STATE {
|
||||
ACS_DISABLE,
|
||||
ACS_ENABLE,
|
||||
};
|
||||
|
||||
#define ACS_BW_20M BIT(0)
|
||||
#define ACS_BW_40M BIT(1)
|
||||
#define ACS_BW_80M BIT(2)
|
||||
#define ACS_BW_160M BIT(3)
|
||||
|
||||
struct auto_chan_sel {
|
||||
ATOMIC_T state;
|
||||
u8 trigger_ch;
|
||||
bool triggered;
|
||||
u8 clm_ratio[MAX_CHANNEL_NUM];
|
||||
u8 nhm_ratio[MAX_CHANNEL_NUM];
|
||||
#if (RTK_ACS_VERSION == 3)
|
||||
u8 nhm[MAX_CHANNEL_NUM][NHM_RPT_NUM];
|
||||
#endif
|
||||
u8 bss_nums[MAX_CHANNEL_NUM];
|
||||
u8 interference_time[MAX_CHANNEL_NUM];
|
||||
u8 cur_ch_clm_ratio;
|
||||
u8 cur_ch_nhm_ratio;
|
||||
u8 best_chan_5g;
|
||||
u8 best_chan_24g;
|
||||
|
||||
#if (RTK_ACS_VERSION == 3)
|
||||
u8 trig_rst;
|
||||
struct env_trig_rpt trig_rpt;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RTW_ACS_DBG
|
||||
RT_SCAN_TYPE scan_type;
|
||||
u16 scan_time;
|
||||
u8 igi;
|
||||
u8 bw;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define rtw_acs_get_best_chan_24g(adapter) (GET_HAL_DATA(adapter)->acs.best_chan_24g)
|
||||
#define rtw_acs_get_best_chan_5g(adapter) (GET_HAL_DATA(adapter)->acs.best_chan_5g)
|
||||
|
||||
#ifdef CONFIG_RTW_ACS_DBG
|
||||
#define rtw_is_acs_passiv_scan(adapter) (((GET_HAL_DATA(adapter)->acs.scan_type) == SCAN_PASSIVE) ? _TRUE : _FALSE)
|
||||
|
||||
#define rtw_acs_get_adv_st(adapter) (GET_HAL_DATA(adapter)->acs.scan_time)
|
||||
#define rtw_is_acs_st_valid(adapter) ((GET_HAL_DATA(adapter)->acs.scan_time) ? _TRUE : _FALSE)
|
||||
|
||||
#define rtw_acs_get_adv_igi(adapter) (GET_HAL_DATA(adapter)->acs.igi)
|
||||
u8 rtw_is_acs_igi_valid(_adapter *adapter);
|
||||
|
||||
#define rtw_acs_get_adv_bw(adapter) (GET_HAL_DATA(adapter)->acs.bw)
|
||||
|
||||
void rtw_acs_adv_setting(_adapter *adapter, RT_SCAN_TYPE scan_type, u16 scan_time, u8 igi, u8 bw);
|
||||
void rtw_acs_adv_reset(_adapter *adapter);
|
||||
#endif
|
||||
|
||||
u8 rtw_acs_get_clm_ratio_by_ch_num(_adapter *adapter, u8 chan);
|
||||
u8 rtw_acs_get_clm_ratio_by_ch_idx(_adapter *adapter, u8 ch_idx);
|
||||
u8 rtw_acs_get_nhm_ratio_by_ch_num(_adapter *adapter, u8 chan);
|
||||
u8 rtw_acs_get_num_ratio_by_ch_idx(_adapter *adapter, u8 ch_idx);
|
||||
|
||||
void rtw_acs_reset(_adapter *adapter);
|
||||
void rtw_acs_trigger(_adapter *adapter, u16 scan_time_ms, u8 scan_chan, enum NHM_PID pid);
|
||||
void rtw_acs_get_rst(_adapter *adapter);
|
||||
void rtw_acs_select_best_chan(_adapter *adapter);
|
||||
void rtw_acs_info_dump(void *sel, _adapter *adapter);
|
||||
void rtw_acs_update_current_info(_adapter *adapter);
|
||||
void rtw_acs_chan_info_dump(void *sel, _adapter *adapter);
|
||||
void rtw_acs_current_info_dump(void *sel, _adapter *adapter);
|
||||
|
||||
void rtw_acs_start(_adapter *adapter);
|
||||
void rtw_acs_stop(_adapter *adapter);
|
||||
|
||||
#endif /*CONFIG_RTW_ACS*/
|
||||
|
||||
#ifdef CONFIG_BACKGROUND_NOISE_MONITOR
|
||||
#define RTK_NOISE_MONITOR_VERSION 3
|
||||
#define GET_NM_STATE(padapter) (ATOMIC_READ(&GET_HAL_DATA(padapter)->nm.state))
|
||||
#define SET_NM_STATE(padapter, set_state) (ATOMIC_SET(&GET_HAL_DATA(padapter)->nm.state, set_state))
|
||||
#define IS_NM_ENABLE(padapter) ((GET_NM_STATE(padapter) == NM_ENABLE) ? _TRUE : _FALSE)
|
||||
|
||||
enum NM_STATE {
|
||||
NM_DISABLE,
|
||||
NM_ENABLE,
|
||||
};
|
||||
|
||||
struct noise_monitor {
|
||||
ATOMIC_T state;
|
||||
s16 noise[MAX_CHANNEL_NUM];
|
||||
u8 bss_nums[MAX_CHANNEL_NUM];
|
||||
};
|
||||
void rtw_nm_enable(_adapter *adapter);
|
||||
void rtw_nm_disable(_adapter *adapter);
|
||||
void rtw_noise_measure(_adapter *adapter, u8 chan, u8 is_pause_dig, u8 igi_value, u32 max_time);
|
||||
s16 rtw_noise_query_by_chan_num(_adapter *adapter, u8 chan);
|
||||
s16 rtw_noise_query_by_chan_idx(_adapter *adapter, u8 ch_idx);
|
||||
s16 rtw_noise_measure_curchan(_adapter *padapter);
|
||||
void rtw_noise_info_dump(void *sel, _adapter *adapter);
|
||||
#endif
|
||||
#endif /* __HAL_DM_ACS_H__ */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,246 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2015 - 2019 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef _HAL_HALMAC_H_
|
||||
#define _HAL_HALMAC_H_
|
||||
|
||||
#include <drv_types.h> /* adapter_to_dvobj(), struct intf_hdl and etc. */
|
||||
#include <hal_data.h> /* struct hal_spec_t */
|
||||
#include "halmac/halmac_api.h" /* struct halmac_adapter* and etc. */
|
||||
|
||||
/* HALMAC Definition for Driver */
|
||||
#define RTW_HALMAC_H2C_MAX_SIZE 8
|
||||
#define RTW_HALMAC_BA_SSN_RPT_SIZE 4
|
||||
|
||||
#define dvobj_set_halmac(d, mac) ((d)->halmac = (mac))
|
||||
#define dvobj_to_halmac(d) ((struct halmac_adapter *)((d)->halmac))
|
||||
#define adapter_to_halmac(p) dvobj_to_halmac(adapter_to_dvobj(p))
|
||||
|
||||
/* for H2C cmd */
|
||||
#define MAX_H2C_BOX_NUMS 4
|
||||
#define MESSAGE_BOX_SIZE 4
|
||||
#define EX_MESSAGE_BOX_SIZE 4
|
||||
|
||||
typedef enum _RTW_HALMAC_MODE {
|
||||
RTW_HALMAC_MODE_NORMAL,
|
||||
RTW_HALMAC_MODE_WIFI_TEST,
|
||||
} RTW_HALMAC_MODE;
|
||||
|
||||
union rtw_phy_para_data {
|
||||
struct _mac {
|
||||
u32 value; /* value to be set in bit mask(msk) */
|
||||
u32 msk; /* bit mask */
|
||||
u16 offset; /* address */
|
||||
u8 msk_en; /* 0/1 for msk invalid/valid */
|
||||
u8 size; /* Unit is bytes, and value should be 1/2/4 */
|
||||
} mac;
|
||||
struct _bb {
|
||||
u32 value;
|
||||
u32 msk;
|
||||
u16 offset;
|
||||
u8 msk_en;
|
||||
u8 size;
|
||||
} bb;
|
||||
struct _rf {
|
||||
u32 value;
|
||||
u32 msk;
|
||||
u8 offset;
|
||||
u8 msk_en;
|
||||
/*
|
||||
* 0: path A
|
||||
* 1: path B
|
||||
* 2: path C
|
||||
* 3: path D
|
||||
*/
|
||||
u8 path;
|
||||
} rf;
|
||||
struct _delay {
|
||||
/*
|
||||
* 0: microsecond (us)
|
||||
* 1: millisecond (ms)
|
||||
*/
|
||||
u8 unit;
|
||||
u16 value;
|
||||
} delay;
|
||||
};
|
||||
|
||||
struct rtw_phy_parameter {
|
||||
/*
|
||||
* 0: MAC register
|
||||
* 1: BB register
|
||||
* 2: RF register
|
||||
* 3: Delay
|
||||
* 0xFF: Latest(End) command
|
||||
*/
|
||||
u8 cmd;
|
||||
union rtw_phy_para_data data;
|
||||
};
|
||||
|
||||
struct rtw_halmac_bcn_ctrl {
|
||||
u8 rx_bssid_fit:1; /* 0:HW handle beacon, 1:ignore */
|
||||
u8 txbcn_rpt:1; /* Enable TXBCN report in ad hoc and AP mode */
|
||||
u8 tsf_update:1; /* Update TSF when beacon or probe response */
|
||||
u8 enable_bcn:1; /* Enable beacon related functions */
|
||||
u8 rxbcn_rpt:1; /* Enable RXBCNOK report */
|
||||
u8 p2p_ctwin:1; /* Enable P2P CTN WINDOWS function */
|
||||
u8 p2p_bcn_area:1; /* Enable P2P BCN area on function */
|
||||
};
|
||||
|
||||
extern struct halmac_platform_api rtw_halmac_platform_api;
|
||||
|
||||
/* HALMAC API for Driver(HAL) */
|
||||
u8 rtw_halmac_read8(struct intf_hdl *, u32 addr);
|
||||
u16 rtw_halmac_read16(struct intf_hdl *, u32 addr);
|
||||
u32 rtw_halmac_read32(struct intf_hdl *, u32 addr);
|
||||
void rtw_halmac_read_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
|
||||
#ifdef CONFIG_SDIO_INDIRECT_ACCESS
|
||||
u8 rtw_halmac_iread8(struct intf_hdl *pintfhdl, u32 addr);
|
||||
u16 rtw_halmac_iread16(struct intf_hdl *pintfhdl, u32 addr);
|
||||
u32 rtw_halmac_iread32(struct intf_hdl *pintfhdl, u32 addr);
|
||||
#endif /* CONFIG_SDIO_INDIRECT_ACCESS */
|
||||
int rtw_halmac_write8(struct intf_hdl *, u32 addr, u8 value);
|
||||
int rtw_halmac_write16(struct intf_hdl *, u32 addr, u16 value);
|
||||
int rtw_halmac_write32(struct intf_hdl *, u32 addr, u32 value);
|
||||
|
||||
/* Software Information */
|
||||
void rtw_halmac_get_version(char *str, u32 len);
|
||||
|
||||
/* Software Initialization */
|
||||
int rtw_halmac_init_adapter(struct dvobj_priv *d, struct halmac_platform_api *pf_api);
|
||||
int rtw_halmac_deinit_adapter(struct dvobj_priv *);
|
||||
|
||||
/* Get operations */
|
||||
int rtw_halmac_get_hw_value(struct dvobj_priv *d, enum halmac_hw_id hw_id, void *pvalue);
|
||||
int rtw_halmac_get_tx_fifo_size(struct dvobj_priv *d, u32 *size);
|
||||
int rtw_halmac_get_rx_fifo_size(struct dvobj_priv *d, u32 *size);
|
||||
int rtw_halmac_get_rsvd_drv_pg_bndy(struct dvobj_priv *d, u16 *bndy);
|
||||
int rtw_halmac_get_page_size(struct dvobj_priv *d, u32 *size);
|
||||
int rtw_halmac_get_tx_agg_align_size(struct dvobj_priv *d, u16 *size);
|
||||
int rtw_halmac_get_rx_agg_align_size(struct dvobj_priv *d, u8 *size);
|
||||
int rtw_halmac_get_rx_drv_info_sz(struct dvobj_priv *, u8 *sz);
|
||||
int rtw_halmac_get_tx_desc_size(struct dvobj_priv *d, u32 *size);
|
||||
int rtw_halmac_get_rx_desc_size(struct dvobj_priv *d, u32 *size);
|
||||
int rtw_halmac_get_ori_h2c_size(struct dvobj_priv *d, u32 *size);
|
||||
int rtw_halmac_get_oqt_size(struct dvobj_priv *d, u8 *size);
|
||||
int rtw_halmac_get_ac_queue_number(struct dvobj_priv *d, u8 *num);
|
||||
int rtw_halmac_get_mac_address(struct dvobj_priv *d, enum _hw_port hwport, u8 *addr);
|
||||
int rtw_halmac_get_network_type(struct dvobj_priv *d, enum _hw_port hwport, u8 *type);
|
||||
int rtw_halmac_get_bcn_ctrl(struct dvobj_priv *d, enum _hw_port hwport, struct rtw_halmac_bcn_ctrl *bcn_ctrl);
|
||||
/*int rtw_halmac_get_wow_reason(struct dvobj_priv *, u8 *reason);*/
|
||||
|
||||
/* Set operations */
|
||||
int rtw_halmac_config_rx_info(struct dvobj_priv *d, enum halmac_drv_info info);
|
||||
int rtw_halmac_set_max_dl_fw_size(struct dvobj_priv *d, u32 size);
|
||||
int rtw_halmac_set_mac_address(struct dvobj_priv *d, enum _hw_port hwport, u8 *addr);
|
||||
int rtw_halmac_set_bssid(struct dvobj_priv *d, enum _hw_port hwport, u8 *addr);
|
||||
int rtw_halmac_set_tx_address(struct dvobj_priv *d, enum _hw_port hwport, u8 *addr);
|
||||
int rtw_halmac_set_network_type(struct dvobj_priv *d, enum _hw_port hwport, u8 type);
|
||||
int rtw_halmac_reset_tsf(struct dvobj_priv *d, enum _hw_port hwport);
|
||||
int rtw_halmac_set_bcn_interval(struct dvobj_priv *d, enum _hw_port hwport, u32 space);
|
||||
int rtw_halmac_set_bcn_ctrl(struct dvobj_priv *d, enum _hw_port hwport, struct rtw_halmac_bcn_ctrl *bcn_ctrl);
|
||||
int rtw_halmac_set_aid(struct dvobj_priv *d, enum _hw_port hwport, u16 aid);
|
||||
int rtw_halmac_set_bandwidth(struct dvobj_priv *d, u8 channel, u8 pri_ch_idx, u8 bw);
|
||||
int rtw_halmac_set_edca(struct dvobj_priv *d, u8 queue, u8 aifs, u8 cw, u16 txop);
|
||||
int rtw_halmac_set_rts_full_bw(struct dvobj_priv *d, u8 enable);
|
||||
|
||||
/* Functions */
|
||||
int rtw_halmac_poweron(struct dvobj_priv *);
|
||||
int rtw_halmac_poweroff(struct dvobj_priv *);
|
||||
int rtw_halmac_init_hal(struct dvobj_priv *);
|
||||
int rtw_halmac_init_hal_fw(struct dvobj_priv *, u8 *fw, u32 fwsize);
|
||||
int rtw_halmac_init_hal_fw_file(struct dvobj_priv *, u8 *fwpath);
|
||||
int rtw_halmac_deinit_hal(struct dvobj_priv *);
|
||||
int rtw_halmac_self_verify(struct dvobj_priv *);
|
||||
int rtw_halmac_txfifo_wait_empty(struct dvobj_priv *d, u32 timeout);
|
||||
int rtw_halmac_dlfw(struct dvobj_priv *, u8 *fw, u32 fwsize);
|
||||
int rtw_halmac_dlfw_from_file(struct dvobj_priv *, u8 *fwpath);
|
||||
int rtw_halmac_dlfw_mem(struct dvobj_priv *d, u8 *fw, u32 fwsize, enum fw_mem mem);
|
||||
int rtw_halmac_dlfw_mem_from_file(struct dvobj_priv *d, u8 *fwpath, enum fw_mem mem);
|
||||
int rtw_halmac_phy_power_switch(struct dvobj_priv *, u8 enable);
|
||||
int rtw_halmac_send_h2c(struct dvobj_priv *, u8 *h2c);
|
||||
int rtw_halmac_c2h_handle(struct dvobj_priv *, u8 *c2h, u32 size);
|
||||
|
||||
/* eFuse */
|
||||
int rtw_halmac_get_available_efuse_size(struct dvobj_priv *d, u32 *size);
|
||||
int rtw_halmac_get_physical_efuse_size(struct dvobj_priv *, u32 *size);
|
||||
int rtw_halmac_read_physical_efuse_map(struct dvobj_priv *, u8 *map, u32 size);
|
||||
int rtw_halmac_read_physical_efuse(struct dvobj_priv *, u32 offset, u32 cnt, u8 *data);
|
||||
int rtw_halmac_write_physical_efuse(struct dvobj_priv *, u32 offset, u32 cnt, u8 *data);
|
||||
int rtw_halmac_get_logical_efuse_size(struct dvobj_priv *, u32 *size);
|
||||
int rtw_halmac_read_logical_efuse_map(struct dvobj_priv *, u8 *map, u32 size, u8 *maskmap, u32 masksize);
|
||||
int rtw_halmac_write_logical_efuse_map(struct dvobj_priv *, u8 *map, u32 size, u8 *maskmap, u32 masksize);
|
||||
int rtw_halmac_read_logical_efuse(struct dvobj_priv *, u32 offset, u32 cnt, u8 *data);
|
||||
int rtw_halmac_write_logical_efuse(struct dvobj_priv *, u32 offset, u32 cnt, u8 *data);
|
||||
|
||||
int rtw_halmac_write_bt_physical_efuse(struct dvobj_priv *, u32 offset, u32 cnt, u8 *data);
|
||||
int rtw_halmac_read_bt_physical_efuse_map(struct dvobj_priv *, u8 *map, u32 size);
|
||||
|
||||
int rtw_halmac_dump_fifo(struct dvobj_priv *d, u8 fifo_sel, u32 addr, u32 size, u8 *buffer);
|
||||
int rtw_halmac_rx_agg_switch(struct dvobj_priv *, u8 enable);
|
||||
|
||||
/* Specific function APIs*/
|
||||
int rtw_halmac_download_rsvd_page(struct dvobj_priv *dvobj, u8 pg_offset, u8 *pbuf, u32 size);
|
||||
int rtw_halmac_fill_hal_spec(struct dvobj_priv *, struct hal_spec_t *);
|
||||
int rtw_halmac_p2pps(struct dvobj_priv *dvobj, PHAL_P2P_PS_PARA pp2p_ps_para);
|
||||
int rtw_halmac_iqk(struct dvobj_priv *d, u8 clear, u8 segment);
|
||||
int rtw_halmac_cfg_phy_para(struct dvobj_priv *d, struct rtw_phy_parameter *para);
|
||||
int rtw_halmac_led_cfg(struct dvobj_priv *d, u8 enable, u8 mode);
|
||||
void rtw_halmac_led_switch(struct dvobj_priv *d, u8 on);
|
||||
int rtw_halmac_bt_wake_cfg(struct dvobj_priv *d, u8 enable);
|
||||
#ifdef CONFIG_PNO_SUPPORT
|
||||
int rtw_halmac_pno_scanoffload(struct dvobj_priv *d, u32 enable);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SDIO_HCI
|
||||
int rtw_halmac_query_tx_page_num(struct dvobj_priv *);
|
||||
int rtw_halmac_get_tx_queue_page_num(struct dvobj_priv *, u8 queue, u32 *page);
|
||||
u32 rtw_halmac_sdio_get_tx_addr(struct dvobj_priv *, u8 *desc, u32 size);
|
||||
int rtw_halmac_sdio_tx_allowed(struct dvobj_priv *, u8 *buf, u32 size);
|
||||
u32 rtw_halmac_sdio_get_rx_addr(struct dvobj_priv *, u8 *seq);
|
||||
int rtw_halmac_sdio_set_tx_format(struct dvobj_priv *d, enum halmac_sdio_tx_format format);
|
||||
#endif /* CONFIG_SDIO_HCI */
|
||||
|
||||
#ifdef CONFIG_USB_HCI
|
||||
u8 rtw_halmac_usb_get_bulkout_id(struct dvobj_priv *, u8 *buf, u32 size);
|
||||
int rtw_halmac_usb_get_txagg_desc_num(struct dvobj_priv *d, u8 *num);
|
||||
u8 rtw_halmac_switch_usb_mode(struct dvobj_priv *d, enum RTW_USB_SPEED usb_mode);
|
||||
#endif /* CONFIG_USB_HCI */
|
||||
|
||||
#ifdef CONFIG_SUPPORT_TRX_SHARED
|
||||
void dump_trx_share_mode(void *sel, _adapter *adapter);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BEAMFORMING
|
||||
#ifdef RTW_BEAMFORMING_VERSION_2
|
||||
int rtw_halmac_bf_add_mu_bfer(struct dvobj_priv *d, u16 paid, u16 csi_para,
|
||||
u16 my_aid, enum halmac_csi_seg_len sel, u8 *addr);
|
||||
int rtw_halmac_bf_del_mu_bfer(struct dvobj_priv *d);
|
||||
|
||||
int rtw_halmac_bf_cfg_sounding(struct dvobj_priv *d, enum halmac_snd_role role,
|
||||
enum halmac_data_rate rate);
|
||||
int rtw_halmac_bf_del_sounding(struct dvobj_priv *d, enum halmac_snd_role role);
|
||||
|
||||
int rtw_halmac_bf_cfg_csi_rate(struct dvobj_priv *d, u8 rssi, u8 current_rate,
|
||||
u8 fixrate_en, u8 *new_rate, u8 *bmp_ofdm54);
|
||||
|
||||
int rtw_halmac_bf_cfg_mu_mimo(struct dvobj_priv *d, enum halmac_snd_role role,
|
||||
u8 *sounding_sts, u16 grouping_bitmap, u8 mu_tx_en,
|
||||
u32 *given_gid_tab, u32 *given_user_pos);
|
||||
#define rtw_halmac_bf_cfg_mu_bfee(d, gid_tab, user_pos) \
|
||||
rtw_halmac_bf_cfg_mu_mimo(d, HAL_BFEE, NULL, 0, 0, gid_tab, user_pos)
|
||||
|
||||
#endif /* RTW_BEAMFORMING_VERSION_2 */
|
||||
#endif /* CONFIG_BEAMFORMING */
|
||||
|
||||
#endif /* _HAL_HALMAC_H_ */
|
||||
@@ -1,564 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define _HAL_USB_C_
|
||||
|
||||
#include <drv_types.h>
|
||||
#include <hal_data.h>
|
||||
|
||||
int usb_init_recv_priv(_adapter *padapter, u16 ini_in_buf_sz)
|
||||
{
|
||||
struct recv_priv *precvpriv = &padapter->recvpriv;
|
||||
int i, res = _SUCCESS;
|
||||
struct recv_buf *precvbuf;
|
||||
|
||||
#ifdef PLATFORM_LINUX
|
||||
tasklet_init(&precvpriv->recv_tasklet,
|
||||
(void(*)(unsigned long))usb_recv_tasklet,
|
||||
(unsigned long)padapter);
|
||||
#endif /* PLATFORM_LINUX */
|
||||
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
#ifdef CONFIG_RX_INDICATE_QUEUE
|
||||
TASK_INIT(&precvpriv->rx_indicate_tasklet, 0, rtw_rx_indicate_tasklet, padapter);
|
||||
#endif /* CONFIG_RX_INDICATE_QUEUE */
|
||||
#endif /* PLATFORM_FREEBSD */
|
||||
|
||||
#ifdef CONFIG_USB_INTERRUPT_IN_PIPE
|
||||
#ifdef PLATFORM_LINUX
|
||||
precvpriv->int_in_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (precvpriv->int_in_urb == NULL) {
|
||||
res = _FAIL;
|
||||
RTW_INFO("alloc_urb for interrupt in endpoint fail !!!!\n");
|
||||
goto exit;
|
||||
}
|
||||
#endif /* PLATFORM_LINUX */
|
||||
precvpriv->int_in_buf = rtw_zmalloc(ini_in_buf_sz);
|
||||
if (precvpriv->int_in_buf == NULL) {
|
||||
res = _FAIL;
|
||||
RTW_INFO("alloc_mem for interrupt in endpoint fail !!!!\n");
|
||||
goto exit;
|
||||
}
|
||||
#endif /* CONFIG_USB_INTERRUPT_IN_PIPE */
|
||||
|
||||
/* init recv_buf */
|
||||
_rtw_init_queue(&precvpriv->free_recv_buf_queue);
|
||||
_rtw_init_queue(&precvpriv->recv_buf_pending_queue);
|
||||
#ifndef CONFIG_USE_USB_BUFFER_ALLOC_RX
|
||||
/* this is used only when RX_IOBUF is sk_buff */
|
||||
skb_queue_head_init(&precvpriv->free_recv_skb_queue);
|
||||
#endif
|
||||
|
||||
RTW_INFO("NR_RECVBUFF: %d\n", NR_RECVBUFF);
|
||||
RTW_INFO("MAX_RECVBUF_SZ: %d\n", MAX_RECVBUF_SZ);
|
||||
precvpriv->pallocated_recv_buf = rtw_zmalloc(NR_RECVBUFF * sizeof(struct recv_buf) + 4);
|
||||
if (precvpriv->pallocated_recv_buf == NULL) {
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
precvpriv->precv_buf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(precvpriv->pallocated_recv_buf), 4);
|
||||
|
||||
precvbuf = (struct recv_buf *)precvpriv->precv_buf;
|
||||
|
||||
for (i = 0; i < NR_RECVBUFF ; i++) {
|
||||
_rtw_init_listhead(&precvbuf->list);
|
||||
|
||||
_rtw_spinlock_init(&precvbuf->recvbuf_lock);
|
||||
|
||||
precvbuf->alloc_sz = MAX_RECVBUF_SZ;
|
||||
|
||||
res = rtw_os_recvbuf_resource_alloc(padapter, precvbuf);
|
||||
if (res == _FAIL)
|
||||
break;
|
||||
|
||||
precvbuf->ref_cnt = 0;
|
||||
precvbuf->adapter = padapter;
|
||||
|
||||
/* rtw_list_insert_tail(&precvbuf->list, &(precvpriv->free_recv_buf_queue.queue)); */
|
||||
|
||||
precvbuf++;
|
||||
}
|
||||
|
||||
precvpriv->free_recv_buf_queue_cnt = NR_RECVBUFF;
|
||||
|
||||
#if defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD)
|
||||
|
||||
skb_queue_head_init(&precvpriv->rx_skb_queue);
|
||||
|
||||
#ifdef CONFIG_RX_INDICATE_QUEUE
|
||||
memset(&precvpriv->rx_indicate_queue, 0, sizeof(struct ifqueue));
|
||||
mtx_init(&precvpriv->rx_indicate_queue.ifq_mtx, "rx_indicate_queue", NULL, MTX_DEF);
|
||||
#endif /* CONFIG_RX_INDICATE_QUEUE */
|
||||
|
||||
#ifdef CONFIG_PREALLOC_RECV_SKB
|
||||
{
|
||||
int i;
|
||||
SIZE_PTR tmpaddr = 0;
|
||||
SIZE_PTR alignment = 0;
|
||||
struct sk_buff *pskb = NULL;
|
||||
|
||||
RTW_INFO("NR_PREALLOC_RECV_SKB: %d\n", NR_PREALLOC_RECV_SKB);
|
||||
#ifdef CONFIG_FIX_NR_BULKIN_BUFFER
|
||||
RTW_INFO("Enable CONFIG_FIX_NR_BULKIN_BUFFER\n");
|
||||
#endif
|
||||
|
||||
for (i = 0; i < NR_PREALLOC_RECV_SKB; i++) {
|
||||
#ifdef CONFIG_PREALLOC_RX_SKB_BUFFER
|
||||
pskb = rtw_alloc_skb_premem(MAX_RECVBUF_SZ);
|
||||
#else
|
||||
pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ);
|
||||
#endif /* CONFIG_PREALLOC_RX_SKB_BUFFER */
|
||||
|
||||
if (pskb) {
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
pskb->dev = padapter->pifp;
|
||||
#else
|
||||
pskb->dev = padapter->pnetdev;
|
||||
#endif /* PLATFORM_FREEBSD */
|
||||
|
||||
#ifndef CONFIG_PREALLOC_RX_SKB_BUFFER
|
||||
tmpaddr = (SIZE_PTR)pskb->data;
|
||||
alignment = tmpaddr & (RECVBUFF_ALIGN_SZ - 1);
|
||||
skb_reserve(pskb, (RECVBUFF_ALIGN_SZ - alignment));
|
||||
#endif
|
||||
skb_queue_tail(&precvpriv->free_recv_skb_queue, pskb);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_PREALLOC_RECV_SKB */
|
||||
|
||||
#endif /* defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD) */
|
||||
|
||||
exit:
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void usb_free_recv_priv(_adapter *padapter, u16 ini_in_buf_sz)
|
||||
{
|
||||
int i;
|
||||
struct recv_buf *precvbuf;
|
||||
struct recv_priv *precvpriv = &padapter->recvpriv;
|
||||
|
||||
precvbuf = (struct recv_buf *)precvpriv->precv_buf;
|
||||
|
||||
for (i = 0; i < NR_RECVBUFF ; i++) {
|
||||
rtw_os_recvbuf_resource_free(padapter, precvbuf);
|
||||
precvbuf++;
|
||||
}
|
||||
|
||||
if (precvpriv->pallocated_recv_buf)
|
||||
rtw_mfree(precvpriv->pallocated_recv_buf, NR_RECVBUFF * sizeof(struct recv_buf) + 4);
|
||||
|
||||
#ifdef CONFIG_USB_INTERRUPT_IN_PIPE
|
||||
#ifdef PLATFORM_LINUX
|
||||
if (precvpriv->int_in_urb)
|
||||
usb_free_urb(precvpriv->int_in_urb);
|
||||
#endif
|
||||
if (precvpriv->int_in_buf)
|
||||
rtw_mfree(precvpriv->int_in_buf, ini_in_buf_sz);
|
||||
#endif /* CONFIG_USB_INTERRUPT_IN_PIPE */
|
||||
|
||||
#ifdef PLATFORM_LINUX
|
||||
|
||||
if (skb_queue_len(&precvpriv->rx_skb_queue))
|
||||
RTW_WARN("rx_skb_queue not empty\n");
|
||||
|
||||
rtw_skb_queue_purge(&precvpriv->rx_skb_queue);
|
||||
|
||||
if (skb_queue_len(&precvpriv->free_recv_skb_queue))
|
||||
RTW_WARN("free_recv_skb_queue not empty, %d\n", skb_queue_len(&precvpriv->free_recv_skb_queue));
|
||||
|
||||
#if !defined(CONFIG_USE_USB_BUFFER_ALLOC_RX)
|
||||
#if defined(CONFIG_PREALLOC_RECV_SKB) && defined(CONFIG_PREALLOC_RX_SKB_BUFFER)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
|
||||
while ((skb = skb_dequeue(&precvpriv->free_recv_skb_queue)) != NULL) {
|
||||
if (rtw_free_skb_premem(skb) != 0)
|
||||
rtw_skb_free(skb);
|
||||
}
|
||||
}
|
||||
#else
|
||||
rtw_skb_queue_purge(&precvpriv->free_recv_skb_queue);
|
||||
#endif /* defined(CONFIG_PREALLOC_RX_SKB_BUFFER) && defined(CONFIG_PREALLOC_RECV_SKB) */
|
||||
#endif /* !defined(CONFIG_USE_USB_BUFFER_ALLOC_RX) */
|
||||
|
||||
#endif /* PLATFORM_LINUX */
|
||||
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
struct sk_buff *pskb;
|
||||
while (NULL != (pskb = skb_dequeue(&precvpriv->rx_skb_queue)))
|
||||
rtw_skb_free(pskb);
|
||||
|
||||
#if !defined(CONFIG_USE_USB_BUFFER_ALLOC_RX)
|
||||
rtw_skb_queue_purge(&precvpriv->free_recv_skb_queue);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RX_INDICATE_QUEUE
|
||||
struct mbuf *m;
|
||||
for (;;) {
|
||||
IF_DEQUEUE(&precvpriv->rx_indicate_queue, m);
|
||||
if (m == NULL)
|
||||
break;
|
||||
rtw_os_pkt_free(m);
|
||||
}
|
||||
mtx_destroy(&precvpriv->rx_indicate_queue.ifq_mtx);
|
||||
#endif /* CONFIG_RX_INDICATE_QUEUE */
|
||||
|
||||
#endif /* PLATFORM_FREEBSD */
|
||||
}
|
||||
|
||||
#ifdef CONFIG_FW_C2H_REG
|
||||
void usb_c2h_hisr_hdl(_adapter *adapter, u8 *buf)
|
||||
{
|
||||
u8 *c2h_evt = buf;
|
||||
u8 id, seq, plen;
|
||||
u8 *payload;
|
||||
|
||||
if (rtw_hal_c2h_reg_hdr_parse(adapter, buf, &id, &seq, &plen, &payload) != _SUCCESS)
|
||||
return;
|
||||
|
||||
if (0)
|
||||
RTW_PRINT("%s C2H == %d\n", __func__, id);
|
||||
|
||||
if (rtw_hal_c2h_id_handle_directly(adapter, id, seq, plen, payload)) {
|
||||
/* Handle directly */
|
||||
rtw_hal_c2h_handler(adapter, id, seq, plen, payload);
|
||||
|
||||
/* Replace with special pointer to trigger c2h_evt_clear only */
|
||||
if (rtw_cbuf_push(adapter->evtpriv.c2h_queue, (void*)&adapter->evtpriv) != _SUCCESS)
|
||||
RTW_ERR("%s rtw_cbuf_push fail\n", __func__);
|
||||
} else {
|
||||
c2h_evt = rtw_malloc(C2H_REG_LEN);
|
||||
if (c2h_evt != NULL) {
|
||||
_rtw_memcpy(c2h_evt, buf, C2H_REG_LEN);
|
||||
if (rtw_cbuf_push(adapter->evtpriv.c2h_queue, (void*)c2h_evt) != _SUCCESS)
|
||||
RTW_ERR("%s rtw_cbuf_push fail\n", __func__);
|
||||
} else {
|
||||
/* Error handling for malloc fail */
|
||||
if (rtw_cbuf_push(adapter->evtpriv.c2h_queue, (void*)NULL) != _SUCCESS)
|
||||
RTW_ERR("%s rtw_cbuf_push fail\n", __func__);
|
||||
}
|
||||
}
|
||||
_set_workitem(&adapter->evtpriv.c2h_wk);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USB_SUPPORT_ASYNC_VDN_REQ
|
||||
int usb_write_async(struct usb_device *udev, u32 addr, void *pdata, u16 len)
|
||||
{
|
||||
u8 request;
|
||||
u8 requesttype;
|
||||
u16 wvalue;
|
||||
u16 index;
|
||||
int ret;
|
||||
|
||||
requesttype = VENDOR_WRITE;/* write_out */
|
||||
request = REALTEK_USB_VENQT_CMD_REQ;
|
||||
index = REALTEK_USB_VENQT_CMD_IDX;/* n/a */
|
||||
|
||||
wvalue = (u16)(addr & 0x0000ffff);
|
||||
|
||||
ret = _usbctrl_vendorreq_async_write(udev, request, wvalue, index, pdata, len, requesttype);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int usb_async_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)
|
||||
{
|
||||
u8 data;
|
||||
int ret;
|
||||
struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *)pintfhdl->pintf_dev;
|
||||
struct usb_device *udev = pdvobjpriv->pusbdev;
|
||||
|
||||
data = val;
|
||||
ret = usb_write_async(udev, addr, &data, 1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int usb_async_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
|
||||
{
|
||||
u16 data;
|
||||
int ret;
|
||||
struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *)pintfhdl->pintf_dev;
|
||||
struct usb_device *udev = pdvobjpriv->pusbdev;
|
||||
|
||||
data = val;
|
||||
ret = usb_write_async(udev, addr, &data, 2);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int usb_async_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
|
||||
{
|
||||
u32 data;
|
||||
int ret;
|
||||
struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *)pintfhdl->pintf_dev;
|
||||
struct usb_device *udev = pdvobjpriv->pusbdev;
|
||||
|
||||
data = val;
|
||||
ret = usb_write_async(udev, addr, &data, 4);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif /* CONFIG_USB_SUPPORT_ASYNC_VDN_REQ */
|
||||
|
||||
u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr)
|
||||
{
|
||||
u8 request;
|
||||
u8 requesttype;
|
||||
u16 wvalue;
|
||||
u16 index;
|
||||
u16 len;
|
||||
u8 data = 0;
|
||||
|
||||
|
||||
request = 0x05;
|
||||
requesttype = 0x01;/* read_in */
|
||||
index = 0;/* n/a */
|
||||
|
||||
wvalue = (u16)(addr & 0x0000ffff);
|
||||
len = 1;
|
||||
|
||||
/* WLANON PAGE0_REG needs to add an offset 0x8000 */
|
||||
#if defined(CONFIG_RTL8710B)
|
||||
if(wvalue >= 0x0000 && wvalue < 0x0100)
|
||||
wvalue |= 0x8000;
|
||||
#endif
|
||||
|
||||
usbctrl_vendorreq(pintfhdl, request, wvalue, index,
|
||||
&data, len, requesttype);
|
||||
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr)
|
||||
{
|
||||
u8 request;
|
||||
u8 requesttype;
|
||||
u16 wvalue;
|
||||
u16 index;
|
||||
u16 len;
|
||||
u16 data = 0;
|
||||
|
||||
|
||||
request = 0x05;
|
||||
requesttype = 0x01;/* read_in */
|
||||
index = 0;/* n/a */
|
||||
|
||||
wvalue = (u16)(addr & 0x0000ffff);
|
||||
len = 2;
|
||||
|
||||
/* WLANON PAGE0_REG needs to add an offset 0x8000 */
|
||||
#if defined(CONFIG_RTL8710B)
|
||||
if(wvalue >= 0x0000 && wvalue < 0x0100)
|
||||
wvalue |= 0x8000;
|
||||
#endif
|
||||
|
||||
usbctrl_vendorreq(pintfhdl, request, wvalue, index,
|
||||
&data, len, requesttype);
|
||||
|
||||
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr)
|
||||
{
|
||||
u8 request;
|
||||
u8 requesttype;
|
||||
u16 wvalue;
|
||||
u16 index;
|
||||
u16 len;
|
||||
u32 data = 0;
|
||||
|
||||
|
||||
request = 0x05;
|
||||
requesttype = 0x01;/* read_in */
|
||||
index = 0;/* n/a */
|
||||
|
||||
wvalue = (u16)(addr & 0x0000ffff);
|
||||
len = 4;
|
||||
|
||||
/* WLANON PAGE0_REG needs to add an offset 0x8000 */
|
||||
#if defined(CONFIG_RTL8710B)
|
||||
if(wvalue >= 0x0000 && wvalue < 0x0100)
|
||||
wvalue |= 0x8000;
|
||||
#endif
|
||||
|
||||
usbctrl_vendorreq(pintfhdl, request, wvalue, index,
|
||||
&data, len, requesttype);
|
||||
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)
|
||||
{
|
||||
u8 request;
|
||||
u8 requesttype;
|
||||
u16 wvalue;
|
||||
u16 index;
|
||||
u16 len;
|
||||
u8 data;
|
||||
int ret;
|
||||
|
||||
|
||||
request = 0x05;
|
||||
requesttype = 0x00;/* write_out */
|
||||
index = 0;/* n/a */
|
||||
|
||||
wvalue = (u16)(addr & 0x0000ffff);
|
||||
len = 1;
|
||||
data = val;
|
||||
|
||||
/* WLANON PAGE0_REG needs to add an offset 0x8000 */
|
||||
#if defined(CONFIG_RTL8710B)
|
||||
if(wvalue >= 0x0000 && wvalue < 0x0100)
|
||||
wvalue |= 0x8000;
|
||||
#endif
|
||||
|
||||
ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index,
|
||||
&data, len, requesttype);
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
|
||||
{
|
||||
u8 request;
|
||||
u8 requesttype;
|
||||
u16 wvalue;
|
||||
u16 index;
|
||||
u16 len;
|
||||
u16 data;
|
||||
int ret;
|
||||
|
||||
|
||||
request = 0x05;
|
||||
requesttype = 0x00;/* write_out */
|
||||
index = 0;/* n/a */
|
||||
|
||||
wvalue = (u16)(addr & 0x0000ffff);
|
||||
len = 2;
|
||||
data = val;
|
||||
|
||||
/* WLANON PAGE0_REG needs to add an offset 0x8000 */
|
||||
#if defined(CONFIG_RTL8710B)
|
||||
if(wvalue >= 0x0000 && wvalue < 0x0100)
|
||||
wvalue |= 0x8000;
|
||||
#endif
|
||||
|
||||
ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index,
|
||||
&data, len, requesttype);
|
||||
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
|
||||
{
|
||||
u8 request;
|
||||
u8 requesttype;
|
||||
u16 wvalue;
|
||||
u16 index;
|
||||
u16 len;
|
||||
u32 data;
|
||||
int ret;
|
||||
|
||||
|
||||
request = 0x05;
|
||||
requesttype = 0x00;/* write_out */
|
||||
index = 0;/* n/a */
|
||||
|
||||
wvalue = (u16)(addr & 0x0000ffff);
|
||||
len = 4;
|
||||
data = val;
|
||||
|
||||
/* WLANON PAGE0_REG needs to add an offset 0x8000 */
|
||||
#if defined(CONFIG_RTL8710B)
|
||||
if(wvalue >= 0x0000 && wvalue < 0x0100)
|
||||
wvalue |= 0x8000;
|
||||
#endif
|
||||
|
||||
ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index,
|
||||
&data, len, requesttype);
|
||||
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata)
|
||||
{
|
||||
u8 request;
|
||||
u8 requesttype;
|
||||
u16 wvalue;
|
||||
u16 index;
|
||||
u16 len;
|
||||
u8 buf[VENDOR_CMD_MAX_DATA_LEN] = {0};
|
||||
int ret;
|
||||
|
||||
|
||||
request = 0x05;
|
||||
requesttype = 0x00;/* write_out */
|
||||
index = 0;/* n/a */
|
||||
|
||||
wvalue = (u16)(addr & 0x0000ffff);
|
||||
len = length;
|
||||
_rtw_memcpy(buf, pdata, len);
|
||||
ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index,
|
||||
buf, len, requesttype);
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void usb_set_intf_ops(_adapter *padapter, struct _io_ops *pops)
|
||||
{
|
||||
_rtw_memset((u8 *)pops, 0, sizeof(struct _io_ops));
|
||||
|
||||
pops->_read8 = &usb_read8;
|
||||
pops->_read16 = &usb_read16;
|
||||
pops->_read32 = &usb_read32;
|
||||
pops->_read_mem = &usb_read_mem;
|
||||
pops->_read_port = &usb_read_port;
|
||||
|
||||
pops->_write8 = &usb_write8;
|
||||
pops->_write16 = &usb_write16;
|
||||
pops->_write32 = &usb_write32;
|
||||
pops->_writeN = &usb_writeN;
|
||||
|
||||
#ifdef CONFIG_USB_SUPPORT_ASYNC_VDN_REQ
|
||||
pops->_write8_async = &usb_async_write8;
|
||||
pops->_write16_async = &usb_async_write16;
|
||||
pops->_write32_async = &usb_async_write32;
|
||||
#endif
|
||||
pops->_write_mem = &usb_write_mem;
|
||||
pops->_write_port = &usb_write_port;
|
||||
|
||||
pops->_read_port_cancel = &usb_read_port_cancel;
|
||||
pops->_write_port_cancel = &usb_write_port_cancel;
|
||||
|
||||
#ifdef CONFIG_USB_INTERRUPT_IN_PIPE
|
||||
pops->_read_interrupt = &usb_read_interrupt;
|
||||
#endif
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,257 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define _HAL_PHY_C_
|
||||
|
||||
#include <drv_types.h>
|
||||
|
||||
/**
|
||||
* Function: PHY_CalculateBitShift
|
||||
*
|
||||
* OverView: Get shifted position of the BitMask
|
||||
*
|
||||
* Input:
|
||||
* u32 BitMask,
|
||||
*
|
||||
* Output: none
|
||||
* Return: u32 Return the shift bit bit position of the mask
|
||||
*/
|
||||
u32
|
||||
PHY_CalculateBitShift(
|
||||
u32 BitMask
|
||||
)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i <= 31; i++) {
|
||||
if (((BitMask >> i) & 0x1) == 1)
|
||||
break;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_RF_SHADOW_RW
|
||||
/* ********************************************************************************
|
||||
* Constant.
|
||||
* ********************************************************************************
|
||||
* 2008/11/20 MH For Debug only, RF */
|
||||
static RF_SHADOW_T RF_Shadow[RF6052_MAX_PATH][RF6052_MAX_REG];
|
||||
|
||||
/*
|
||||
* ==> RF shadow Operation API Code Section!!!
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
* Function: PHY_RFShadowRead
|
||||
* PHY_RFShadowWrite
|
||||
* PHY_RFShadowCompare
|
||||
* PHY_RFShadowRecorver
|
||||
* PHY_RFShadowCompareAll
|
||||
* PHY_RFShadowRecorverAll
|
||||
* PHY_RFShadowCompareFlagSet
|
||||
* PHY_RFShadowRecorverFlagSet
|
||||
*
|
||||
* Overview: When we set RF register, we must write shadow at first.
|
||||
* When we are running, we must compare shadow abd locate error addr.
|
||||
* Decide to recorver or not.
|
||||
*
|
||||
* Input: NONE
|
||||
*
|
||||
* Output: NONE
|
||||
*
|
||||
* Return: NONE
|
||||
*
|
||||
* Revised History:
|
||||
* When Who Remark
|
||||
* 11/20/2008 MHC Create Version 0.
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
u32
|
||||
PHY_RFShadowRead(
|
||||
PADAPTER Adapter,
|
||||
enum rf_path eRFPath,
|
||||
u32 Offset)
|
||||
{
|
||||
return RF_Shadow[eRFPath][Offset].Value;
|
||||
|
||||
} /* PHY_RFShadowRead */
|
||||
|
||||
|
||||
void
|
||||
PHY_RFShadowWrite(
|
||||
PADAPTER Adapter,
|
||||
enum rf_path eRFPath,
|
||||
u32 Offset,
|
||||
u32 Data)
|
||||
{
|
||||
RF_Shadow[eRFPath][Offset].Value = (Data & bRFRegOffsetMask);
|
||||
RF_Shadow[eRFPath][Offset].Driver_Write = _TRUE;
|
||||
|
||||
} /* PHY_RFShadowWrite */
|
||||
|
||||
|
||||
BOOLEAN
|
||||
PHY_RFShadowCompare(
|
||||
PADAPTER Adapter,
|
||||
enum rf_path eRFPath,
|
||||
u32 Offset)
|
||||
{
|
||||
u32 reg;
|
||||
/* Check if we need to check the register */
|
||||
if (RF_Shadow[eRFPath][Offset].Compare == _TRUE) {
|
||||
reg = rtw_hal_read_rfreg(Adapter, eRFPath, Offset, bRFRegOffsetMask);
|
||||
/* Compare shadow and real rf register for 20bits!! */
|
||||
if (RF_Shadow[eRFPath][Offset].Value != reg) {
|
||||
/* Locate error position. */
|
||||
RF_Shadow[eRFPath][Offset].ErrorOrNot = _TRUE;
|
||||
}
|
||||
return RF_Shadow[eRFPath][Offset].ErrorOrNot ;
|
||||
}
|
||||
return _FALSE;
|
||||
} /* PHY_RFShadowCompare */
|
||||
|
||||
|
||||
void
|
||||
PHY_RFShadowRecorver(
|
||||
PADAPTER Adapter,
|
||||
enum rf_path eRFPath,
|
||||
u32 Offset)
|
||||
{
|
||||
/* Check if the address is error */
|
||||
if (RF_Shadow[eRFPath][Offset].ErrorOrNot == _TRUE) {
|
||||
/* Check if we need to recorver the register. */
|
||||
if (RF_Shadow[eRFPath][Offset].Recorver == _TRUE) {
|
||||
rtw_hal_write_rfreg(Adapter, eRFPath, Offset, bRFRegOffsetMask,
|
||||
RF_Shadow[eRFPath][Offset].Value);
|
||||
}
|
||||
}
|
||||
|
||||
} /* PHY_RFShadowRecorver */
|
||||
|
||||
|
||||
void
|
||||
PHY_RFShadowCompareAll(
|
||||
PADAPTER Adapter)
|
||||
{
|
||||
enum rf_path eRFPath = RF_PATH_A;
|
||||
u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter);
|
||||
|
||||
for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) {
|
||||
for (Offset = 0; Offset < maxReg; Offset++)
|
||||
PHY_RFShadowCompare(Adapter, eRFPath, Offset);
|
||||
}
|
||||
|
||||
} /* PHY_RFShadowCompareAll */
|
||||
|
||||
|
||||
void
|
||||
PHY_RFShadowRecorverAll(
|
||||
PADAPTER Adapter)
|
||||
{
|
||||
enum rf_path eRFPath = RF_PATH_A;
|
||||
u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter);
|
||||
|
||||
for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) {
|
||||
for (Offset = 0; Offset < maxReg; Offset++)
|
||||
PHY_RFShadowRecorver(Adapter, eRFPath, Offset);
|
||||
}
|
||||
|
||||
} /* PHY_RFShadowRecorverAll */
|
||||
|
||||
|
||||
void
|
||||
PHY_RFShadowCompareFlagSet(
|
||||
PADAPTER Adapter,
|
||||
enum rf_path eRFPath,
|
||||
u32 Offset,
|
||||
u8 Type)
|
||||
{
|
||||
/* Set True or False!!! */
|
||||
RF_Shadow[eRFPath][Offset].Compare = Type;
|
||||
|
||||
} /* PHY_RFShadowCompareFlagSet */
|
||||
|
||||
|
||||
void
|
||||
PHY_RFShadowRecorverFlagSet(
|
||||
PADAPTER Adapter,
|
||||
enum rf_path eRFPath,
|
||||
u32 Offset,
|
||||
u8 Type)
|
||||
{
|
||||
/* Set True or False!!! */
|
||||
RF_Shadow[eRFPath][Offset].Recorver = Type;
|
||||
|
||||
} /* PHY_RFShadowRecorverFlagSet */
|
||||
|
||||
|
||||
void
|
||||
PHY_RFShadowCompareFlagSetAll(
|
||||
PADAPTER Adapter)
|
||||
{
|
||||
enum rf_path eRFPath = RF_PATH_A;
|
||||
u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter);
|
||||
|
||||
for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) {
|
||||
for (Offset = 0; Offset < maxReg; Offset++) {
|
||||
/* 2008/11/20 MH For S3S4 test, we only check reg 26/27 now!!!! */
|
||||
if (Offset != 0x26 && Offset != 0x27)
|
||||
PHY_RFShadowCompareFlagSet(Adapter, eRFPath, Offset, _FALSE);
|
||||
else
|
||||
PHY_RFShadowCompareFlagSet(Adapter, eRFPath, Offset, _TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
} /* PHY_RFShadowCompareFlagSetAll */
|
||||
|
||||
|
||||
void
|
||||
PHY_RFShadowRecorverFlagSetAll(
|
||||
PADAPTER Adapter)
|
||||
{
|
||||
enum rf_path eRFPath = RF_PATH_A;
|
||||
u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter);
|
||||
|
||||
for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) {
|
||||
for (Offset = 0; Offset < maxReg; Offset++) {
|
||||
/* 2008/11/20 MH For S3S4 test, we only check reg 26/27 now!!!! */
|
||||
if (Offset != 0x26 && Offset != 0x27)
|
||||
PHY_RFShadowRecorverFlagSet(Adapter, eRFPath, Offset, _FALSE);
|
||||
else
|
||||
PHY_RFShadowRecorverFlagSet(Adapter, eRFPath, Offset, _TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
} /* PHY_RFShadowCompareFlagSetAll */
|
||||
|
||||
void
|
||||
PHY_RFShadowRefresh(
|
||||
PADAPTER Adapter)
|
||||
{
|
||||
enum rf_path eRFPath = RF_PATH_A;
|
||||
u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter);
|
||||
|
||||
for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) {
|
||||
for (Offset = 0; Offset < maxReg; Offset++) {
|
||||
RF_Shadow[eRFPath][Offset].Value = 0;
|
||||
RF_Shadow[eRFPath][Offset].Compare = _FALSE;
|
||||
RF_Shadow[eRFPath][Offset].Recorver = _FALSE;
|
||||
RF_Shadow[eRFPath][Offset].ErrorOrNot = _FALSE;
|
||||
RF_Shadow[eRFPath][Offset].Driver_Write = _FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
} /* PHY_RFShadowRead */
|
||||
#endif /*CONFIG_RF_SHADOW_RW*/
|
||||
@@ -1,254 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include <drv_types.h>
|
||||
#include <hal_data.h>
|
||||
|
||||
#ifdef CONFIG_RTW_LED
|
||||
void dump_led_config(void *sel, _adapter *adapter)
|
||||
{
|
||||
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
|
||||
struct led_priv *ledpriv = adapter_to_led(adapter);
|
||||
int i;
|
||||
|
||||
RTW_PRINT_SEL(sel, "strategy:%u\n", ledpriv->LedStrategy);
|
||||
#ifdef CONFIG_RTW_SW_LED
|
||||
RTW_PRINT_SEL(sel, "bRegUseLed:%u\n", ledpriv->bRegUseLed);
|
||||
RTW_PRINT_SEL(sel, "iface_en_mask:0x%02X\n", ledpriv->iface_en_mask);
|
||||
for (i = 0; i < dvobj->iface_nums; i++)
|
||||
RTW_PRINT_SEL(sel, "ctl_en_mask[%d]:0x%08X\n", i, ledpriv->ctl_en_mask[i]);
|
||||
#endif
|
||||
}
|
||||
|
||||
void rtw_led_set_strategy(_adapter *adapter, u8 strategy)
|
||||
{
|
||||
struct led_priv *ledpriv = adapter_to_led(adapter);
|
||||
_adapter *pri_adapter = GET_PRIMARY_ADAPTER(adapter);
|
||||
|
||||
#ifndef CONFIG_RTW_SW_LED
|
||||
if (IS_SW_LED_STRATEGY(strategy)) {
|
||||
RTW_WARN("CONFIG_RTW_SW_LED is not defined\n");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RTW_SW_LED
|
||||
if (!ledpriv->bRegUseLed)
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (ledpriv->LedStrategy == strategy)
|
||||
return;
|
||||
|
||||
if (IS_HW_LED_STRATEGY(strategy) || IS_HW_LED_STRATEGY(ledpriv->LedStrategy)) {
|
||||
RTW_WARN("switching on/off HW_LED strategy is not supported\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ledpriv->LedStrategy = strategy;
|
||||
|
||||
#ifdef CONFIG_RTW_SW_LED
|
||||
rtw_hal_sw_led_deinit(pri_adapter);
|
||||
#endif
|
||||
|
||||
rtw_led_control(pri_adapter, RTW_LED_OFF);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_RTW_SW_LED
|
||||
#if CONFIG_RTW_SW_LED_TRX_DA_CLASSIFY
|
||||
void rtw_sw_led_blink_uc_trx_only(LED_DATA *led)
|
||||
{
|
||||
_adapter *adapter = led->padapter;
|
||||
BOOLEAN bStopBlinking = _FALSE;
|
||||
|
||||
if (led->BlinkingLedState == RTW_LED_ON)
|
||||
SwLedOn(adapter, led);
|
||||
else
|
||||
SwLedOff(adapter, led);
|
||||
|
||||
switch (led->CurrLedState) {
|
||||
case RTW_LED_ON:
|
||||
SwLedOn(adapter, led);
|
||||
break;
|
||||
|
||||
case RTW_LED_OFF:
|
||||
SwLedOff(adapter, led);
|
||||
break;
|
||||
|
||||
case LED_BLINK_TXRX:
|
||||
led->BlinkTimes--;
|
||||
if (led->BlinkTimes == 0)
|
||||
bStopBlinking = _TRUE;
|
||||
|
||||
if (adapter_to_pwrctl(adapter)->rf_pwrstate != rf_on
|
||||
&& adapter_to_pwrctl(adapter)->rfoff_reason > RF_CHANGE_BY_PS
|
||||
) {
|
||||
SwLedOff(adapter, led);
|
||||
led->bLedBlinkInProgress = _FALSE;
|
||||
} else {
|
||||
if (led->bLedOn)
|
||||
led->BlinkingLedState = RTW_LED_OFF;
|
||||
else
|
||||
led->BlinkingLedState = RTW_LED_ON;
|
||||
|
||||
if (bStopBlinking) {
|
||||
led->CurrLedState = RTW_LED_OFF;
|
||||
led->bLedBlinkInProgress = _FALSE;
|
||||
}
|
||||
_set_timer(&(led->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void rtw_sw_led_ctl_mode_uc_trx_only(_adapter *adapter, LED_CTL_MODE ctl)
|
||||
{
|
||||
struct led_priv *ledpriv = adapter_to_led(adapter);
|
||||
LED_DATA *led = &(ledpriv->SwLed0);
|
||||
LED_DATA *led1 = &(ledpriv->SwLed1);
|
||||
LED_DATA *led2 = &(ledpriv->SwLed2);
|
||||
|
||||
switch (ctl) {
|
||||
case LED_CTL_UC_TX:
|
||||
case LED_CTL_UC_RX:
|
||||
if (led->bLedBlinkInProgress == _FALSE) {
|
||||
led->bLedBlinkInProgress = _TRUE;
|
||||
led->CurrLedState = LED_BLINK_TXRX;
|
||||
led->BlinkTimes = 2;
|
||||
if (led->bLedOn)
|
||||
led->BlinkingLedState = RTW_LED_OFF;
|
||||
else
|
||||
led->BlinkingLedState = RTW_LED_ON;
|
||||
_set_timer(&(led->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
|
||||
}
|
||||
break;
|
||||
|
||||
case LED_CTL_POWER_OFF:
|
||||
led->CurrLedState = RTW_LED_OFF;
|
||||
led->BlinkingLedState = RTW_LED_OFF;
|
||||
|
||||
if (led->bLedBlinkInProgress) {
|
||||
_cancel_timer_ex(&(led->BlinkTimer));
|
||||
led->bLedBlinkInProgress = _FALSE;
|
||||
}
|
||||
|
||||
SwLedOff(adapter, led);
|
||||
SwLedOff(adapter, led1);
|
||||
SwLedOff(adapter, led2);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_RTW_SW_LED_TRX_DA_CLASSIFY */
|
||||
|
||||
void rtw_led_control(_adapter *adapter, LED_CTL_MODE ctl)
|
||||
{
|
||||
struct led_priv *ledpriv = adapter_to_led(adapter);
|
||||
|
||||
if (ledpriv->LedControlHandler) {
|
||||
#if CONFIG_RTW_SW_LED_TRX_DA_CLASSIFY
|
||||
if (ledpriv->LedStrategy != SW_LED_MODE_UC_TRX_ONLY) {
|
||||
if (ctl == LED_CTL_UC_TX || ctl == LED_CTL_BMC_TX) {
|
||||
if (ledpriv->ctl_en_mask[adapter->iface_id] & BIT(LED_CTL_TX))
|
||||
ctl = LED_CTL_TX; /* transform specific TX ctl to general TX ctl */
|
||||
} else if (ctl == LED_CTL_UC_RX || ctl == LED_CTL_BMC_RX) {
|
||||
if (ledpriv->ctl_en_mask[adapter->iface_id] & BIT(LED_CTL_RX))
|
||||
ctl = LED_CTL_RX; /* transform specific RX ctl to general RX ctl */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((ledpriv->iface_en_mask & BIT(adapter->iface_id))
|
||||
&& (ledpriv->ctl_en_mask[adapter->iface_id] & BIT(ctl)))
|
||||
ledpriv->LedControlHandler(adapter, ctl);
|
||||
}
|
||||
}
|
||||
|
||||
void rtw_led_tx_control(_adapter *adapter, const u8 *da)
|
||||
{
|
||||
#if CONFIG_RTW_SW_LED_TRX_DA_CLASSIFY
|
||||
if (IS_MCAST(da))
|
||||
rtw_led_control(adapter, LED_CTL_BMC_TX);
|
||||
else
|
||||
rtw_led_control(adapter, LED_CTL_UC_TX);
|
||||
#else
|
||||
rtw_led_control(adapter, LED_CTL_TX);
|
||||
#endif
|
||||
}
|
||||
|
||||
void rtw_led_rx_control(_adapter *adapter, const u8 *da)
|
||||
{
|
||||
#if CONFIG_RTW_SW_LED_TRX_DA_CLASSIFY
|
||||
if (IS_MCAST(da))
|
||||
rtw_led_control(adapter, LED_CTL_BMC_RX);
|
||||
else
|
||||
rtw_led_control(adapter, LED_CTL_UC_RX);
|
||||
#else
|
||||
rtw_led_control(adapter, LED_CTL_RX);
|
||||
#endif
|
||||
}
|
||||
|
||||
void rtw_led_set_iface_en(_adapter *adapter, u8 en)
|
||||
{
|
||||
struct led_priv *ledpriv = adapter_to_led(adapter);
|
||||
|
||||
if (en)
|
||||
ledpriv->iface_en_mask |= BIT(adapter->iface_id);
|
||||
else
|
||||
ledpriv->iface_en_mask &= ~BIT(adapter->iface_id);
|
||||
}
|
||||
|
||||
void rtw_led_set_iface_en_mask(_adapter *adapter, u8 mask)
|
||||
{
|
||||
struct led_priv *ledpriv = adapter_to_led(adapter);
|
||||
|
||||
ledpriv->iface_en_mask = mask;
|
||||
}
|
||||
|
||||
void rtw_led_set_ctl_en_mask(_adapter *adapter, u32 ctl_mask)
|
||||
{
|
||||
struct led_priv *ledpriv = adapter_to_led(adapter);
|
||||
|
||||
#if CONFIG_RTW_SW_LED_TRX_DA_CLASSIFY
|
||||
if (ctl_mask & BIT(LED_CTL_TX))
|
||||
ctl_mask |= BIT(LED_CTL_UC_TX) | BIT(LED_CTL_BMC_TX);
|
||||
if (ctl_mask & BIT(LED_CTL_RX))
|
||||
ctl_mask |= BIT(LED_CTL_UC_RX) | BIT(LED_CTL_BMC_RX);
|
||||
#endif
|
||||
|
||||
ledpriv->ctl_en_mask[adapter->iface_id] = ctl_mask;
|
||||
}
|
||||
|
||||
void rtw_led_set_ctl_en_mask_primary(_adapter *adapter)
|
||||
{
|
||||
rtw_led_set_ctl_en_mask(adapter, 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
void rtw_led_set_ctl_en_mask_virtual(_adapter *adapter)
|
||||
{
|
||||
rtw_led_set_ctl_en_mask(adapter
|
||||
, BIT(LED_CTL_POWER_ON) | BIT(LED_CTL_POWER_OFF)
|
||||
| BIT(LED_CTL_TX) | BIT(LED_CTL_RX)
|
||||
);
|
||||
}
|
||||
#endif /* CONFIG_RTW_SW_LED */
|
||||
|
||||
#endif /* CONFIG_RTW_LED */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
2174
drivers/net/wireless/realtek/rtl8188eu/hal/odm.c
Normal file
2174
drivers/net/wireless/realtek/rtl8188eu/hal/odm.c
Normal file
File diff suppressed because it is too large
Load Diff
601
drivers/net/wireless/realtek/rtl8188eu/hal/odm_HWConfig.c
Normal file
601
drivers/net/wireless/realtek/rtl8188eu/hal/odm_HWConfig.c
Normal file
@@ -0,0 +1,601 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/* include files */
|
||||
|
||||
#include "odm_precomp.h"
|
||||
|
||||
#define READ_AND_CONFIG READ_AND_CONFIG_MP
|
||||
|
||||
#define READ_AND_CONFIG_MP(ic, txt) (ODM_ReadAndConfig##txt##ic(dm_odm))
|
||||
#define READ_AND_CONFIG_TC(ic, txt) (ODM_ReadAndConfig_TC##txt##ic(dm_odm))
|
||||
|
||||
static u8 odm_QueryRxPwrPercentage(s8 AntPower)
|
||||
{
|
||||
if ((AntPower <= -100) || (AntPower >= 20))
|
||||
return 0;
|
||||
else if (AntPower >= 0)
|
||||
return 100;
|
||||
else
|
||||
return 100+AntPower;
|
||||
}
|
||||
|
||||
/* 2012/01/12 MH MOve some signal strength smooth method to MP HAL layer. */
|
||||
/* IF other SW team do not support the feature, remove this section.?? */
|
||||
static s32 odm_sig_patch_lenove(struct odm_dm_struct *dm_odm, s32 CurrSig)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static s32 odm_sig_patch_netcore(struct odm_dm_struct *dm_odm, s32 CurrSig)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static s32 odm_SignalScaleMapping_92CSeries(struct odm_dm_struct *dm_odm, s32 CurrSig)
|
||||
{
|
||||
s32 RetSig = 0;
|
||||
|
||||
if ((dm_odm->SupportInterface == ODM_ITRF_USB) ||
|
||||
(dm_odm->SupportInterface == ODM_ITRF_SDIO)) {
|
||||
if (CurrSig >= 51 && CurrSig <= 100)
|
||||
RetSig = 100;
|
||||
else if (CurrSig >= 41 && CurrSig <= 50)
|
||||
RetSig = 80 + ((CurrSig - 40)*2);
|
||||
else if (CurrSig >= 31 && CurrSig <= 40)
|
||||
RetSig = 66 + (CurrSig - 30);
|
||||
else if (CurrSig >= 21 && CurrSig <= 30)
|
||||
RetSig = 54 + (CurrSig - 20);
|
||||
else if (CurrSig >= 10 && CurrSig <= 20)
|
||||
RetSig = 42 + (((CurrSig - 10) * 2) / 3);
|
||||
else if (CurrSig >= 5 && CurrSig <= 9)
|
||||
RetSig = 22 + (((CurrSig - 5) * 3) / 2);
|
||||
else if (CurrSig >= 1 && CurrSig <= 4)
|
||||
RetSig = 6 + (((CurrSig - 1) * 3) / 2);
|
||||
else
|
||||
RetSig = CurrSig;
|
||||
}
|
||||
return RetSig;
|
||||
}
|
||||
|
||||
static s32 odm_SignalScaleMapping(struct odm_dm_struct *dm_odm, s32 CurrSig)
|
||||
{
|
||||
if ((dm_odm->SupportPlatform == ODM_MP) &&
|
||||
(dm_odm->SupportInterface != ODM_ITRF_PCIE) && /* USB & SDIO */
|
||||
(dm_odm->PatchID == 10))
|
||||
return odm_sig_patch_netcore(dm_odm, CurrSig);
|
||||
else if ((dm_odm->SupportPlatform == ODM_MP) &&
|
||||
(dm_odm->SupportInterface == ODM_ITRF_PCIE) &&
|
||||
(dm_odm->PatchID == 19))
|
||||
return odm_sig_patch_lenove(dm_odm, CurrSig);
|
||||
else
|
||||
return odm_SignalScaleMapping_92CSeries(dm_odm, CurrSig);
|
||||
}
|
||||
|
||||
/* pMgntInfo->CustomerID == RT_CID_819x_Lenovo */
|
||||
static u8 odm_SQ_process_patch_RT_CID_819x_Lenovo(struct odm_dm_struct *dm_odm,
|
||||
u8 isCCKrate, u8 PWDB_ALL, u8 path, u8 RSSI)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u8 odm_EVMdbToPercentage(s8 Value)
|
||||
{
|
||||
/* -33dB~0dB to 0%~99% */
|
||||
s8 ret_val;
|
||||
|
||||
ret_val = Value;
|
||||
|
||||
if (ret_val >= 0)
|
||||
ret_val = 0;
|
||||
if (ret_val <= -33)
|
||||
ret_val = -33;
|
||||
|
||||
ret_val = 0 - ret_val;
|
||||
ret_val *= 3;
|
||||
|
||||
if (ret_val == 99)
|
||||
ret_val = 100;
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
static void odm_RxPhyStatus92CSeries_Parsing(struct odm_dm_struct *dm_odm,
|
||||
struct odm_phy_status_info *pPhyInfo,
|
||||
u8 *pPhyStatus,
|
||||
struct odm_per_pkt_info *pPktinfo,
|
||||
struct adapter *adapt)
|
||||
{
|
||||
struct sw_ant_switch *pDM_SWAT_Table = &dm_odm->DM_SWAT_Table;
|
||||
u8 i, Max_spatial_stream;
|
||||
s8 rx_pwr[4], rx_pwr_all = 0;
|
||||
u8 EVM, PWDB_ALL = 0, PWDB_ALL_BT;
|
||||
u8 RSSI, total_rssi = 0;
|
||||
u8 isCCKrate = 0;
|
||||
u8 rf_rx_num = 0;
|
||||
u8 cck_highpwr = 0;
|
||||
u8 LNA_idx, VGA_idx;
|
||||
|
||||
struct phy_status_rpt *pPhyStaRpt = (struct phy_status_rpt *)pPhyStatus;
|
||||
|
||||
isCCKrate = ((pPktinfo->Rate >= DESC92C_RATE1M) && (pPktinfo->Rate <= DESC92C_RATE11M)) ? true : false;
|
||||
|
||||
pPhyInfo->RxMIMOSignalQuality[RF_PATH_A] = -1;
|
||||
pPhyInfo->RxMIMOSignalQuality[RF_PATH_B] = -1;
|
||||
|
||||
if (isCCKrate) {
|
||||
u8 report;
|
||||
u8 cck_agc_rpt;
|
||||
|
||||
dm_odm->PhyDbgInfo.NumQryPhyStatusCCK++;
|
||||
/* (1)Hardware does not provide RSSI for CCK */
|
||||
/* (2)PWDB, Average PWDB cacluated by hardware (for rate adaptive) */
|
||||
|
||||
cck_highpwr = dm_odm->bCckHighPower;
|
||||
|
||||
cck_agc_rpt = pPhyStaRpt->cck_agc_rpt_ofdm_cfosho_a ;
|
||||
|
||||
/* 2011.11.28 LukeLee: 88E use different LNA & VGA gain table */
|
||||
/* The RSSI formula should be modified according to the gain table */
|
||||
/* In 88E, cck_highpwr is always set to 1 */
|
||||
if (dm_odm->SupportICType & (ODM_RTL8188E|ODM_RTL8812)) {
|
||||
LNA_idx = ((cck_agc_rpt & 0xE0) >> 5);
|
||||
VGA_idx = (cck_agc_rpt & 0x1F);
|
||||
switch (LNA_idx) {
|
||||
case 7:
|
||||
if (VGA_idx <= 27)
|
||||
rx_pwr_all = -100 + 2*(27-VGA_idx); /* VGA_idx = 27~2 */
|
||||
else
|
||||
rx_pwr_all = -100;
|
||||
break;
|
||||
case 6:
|
||||
rx_pwr_all = -48 + 2*(2-VGA_idx); /* VGA_idx = 2~0 */
|
||||
break;
|
||||
case 5:
|
||||
rx_pwr_all = -42 + 2*(7-VGA_idx); /* VGA_idx = 7~5 */
|
||||
break;
|
||||
case 4:
|
||||
rx_pwr_all = -36 + 2*(7-VGA_idx); /* VGA_idx = 7~4 */
|
||||
break;
|
||||
case 3:
|
||||
rx_pwr_all = -24 + 2*(7-VGA_idx); /* VGA_idx = 7~0 */
|
||||
break;
|
||||
case 2:
|
||||
if (cck_highpwr)
|
||||
rx_pwr_all = -12 + 2*(5-VGA_idx); /* VGA_idx = 5~0 */
|
||||
else
|
||||
rx_pwr_all = -6 + 2*(5-VGA_idx);
|
||||
break;
|
||||
case 1:
|
||||
rx_pwr_all = 8-2*VGA_idx;
|
||||
break;
|
||||
case 0:
|
||||
rx_pwr_all = 14-2*VGA_idx;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
rx_pwr_all += 6;
|
||||
PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all);
|
||||
if (!cck_highpwr) {
|
||||
if (PWDB_ALL >= 80)
|
||||
PWDB_ALL = ((PWDB_ALL-80)<<1)+((PWDB_ALL-80)>>1)+80;
|
||||
else if ((PWDB_ALL <= 78) && (PWDB_ALL >= 20))
|
||||
PWDB_ALL += 3;
|
||||
if (PWDB_ALL > 100)
|
||||
PWDB_ALL = 100;
|
||||
}
|
||||
} else {
|
||||
if (!cck_highpwr) {
|
||||
report = (cck_agc_rpt & 0xc0)>>6;
|
||||
switch (report) {
|
||||
/* 03312009 modified by cosa */
|
||||
/* Modify the RF RNA gain value to -40, -20, -2, 14 by Jenyu's suggestion */
|
||||
/* Note: different RF with the different RNA gain. */
|
||||
case 0x3:
|
||||
rx_pwr_all = -46 - (cck_agc_rpt & 0x3e);
|
||||
break;
|
||||
case 0x2:
|
||||
rx_pwr_all = -26 - (cck_agc_rpt & 0x3e);
|
||||
break;
|
||||
case 0x1:
|
||||
rx_pwr_all = -12 - (cck_agc_rpt & 0x3e);
|
||||
break;
|
||||
case 0x0:
|
||||
rx_pwr_all = 16 - (cck_agc_rpt & 0x3e);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
report = (cck_agc_rpt & 0x60)>>5;
|
||||
switch (report) {
|
||||
case 0x3:
|
||||
rx_pwr_all = -46 - ((cck_agc_rpt & 0x1f)<<1) ;
|
||||
break;
|
||||
case 0x2:
|
||||
rx_pwr_all = -26 - ((cck_agc_rpt & 0x1f)<<1);
|
||||
break;
|
||||
case 0x1:
|
||||
rx_pwr_all = -12 - ((cck_agc_rpt & 0x1f)<<1);
|
||||
break;
|
||||
case 0x0:
|
||||
rx_pwr_all = 16 - ((cck_agc_rpt & 0x1f)<<1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all);
|
||||
|
||||
/* Modification for ext-LNA board */
|
||||
if (dm_odm->BoardType == ODM_BOARD_HIGHPWR) {
|
||||
if ((cck_agc_rpt>>7) == 0) {
|
||||
PWDB_ALL = (PWDB_ALL > 94) ? 100 : (PWDB_ALL+6);
|
||||
} else {
|
||||
if (PWDB_ALL > 38)
|
||||
PWDB_ALL -= 16;
|
||||
else
|
||||
PWDB_ALL = (PWDB_ALL <= 16) ? (PWDB_ALL>>2) : (PWDB_ALL-12);
|
||||
}
|
||||
|
||||
/* CCK modification */
|
||||
if (PWDB_ALL > 25 && PWDB_ALL <= 60)
|
||||
PWDB_ALL += 6;
|
||||
} else {/* Modification for int-LNA board */
|
||||
if (PWDB_ALL > 99)
|
||||
PWDB_ALL -= 8;
|
||||
else if (PWDB_ALL > 50 && PWDB_ALL <= 68)
|
||||
PWDB_ALL += 4;
|
||||
}
|
||||
}
|
||||
|
||||
pPhyInfo->RxPWDBAll = PWDB_ALL;
|
||||
pPhyInfo->BTRxRSSIPercentage = PWDB_ALL;
|
||||
pPhyInfo->RecvSignalPower = rx_pwr_all;
|
||||
/* (3) Get Signal Quality (EVM) */
|
||||
if (pPktinfo->bPacketMatchBSSID) {
|
||||
u8 SQ, SQ_rpt;
|
||||
|
||||
if ((dm_odm->SupportPlatform == ODM_MP) && (dm_odm->PatchID == 19)) {
|
||||
SQ = odm_SQ_process_patch_RT_CID_819x_Lenovo(dm_odm, isCCKrate, PWDB_ALL, 0, 0);
|
||||
} else if (pPhyInfo->RxPWDBAll > 40 && !dm_odm->bInHctTest) {
|
||||
SQ = 100;
|
||||
} else {
|
||||
SQ_rpt = pPhyStaRpt->cck_sig_qual_ofdm_pwdb_all;
|
||||
|
||||
if (SQ_rpt > 64)
|
||||
SQ = 0;
|
||||
else if (SQ_rpt < 20)
|
||||
SQ = 100;
|
||||
else
|
||||
SQ = ((64-SQ_rpt) * 100) / 44;
|
||||
}
|
||||
pPhyInfo->SignalQuality = SQ;
|
||||
pPhyInfo->RxMIMOSignalQuality[RF_PATH_A] = SQ;
|
||||
pPhyInfo->RxMIMOSignalQuality[RF_PATH_B] = -1;
|
||||
}
|
||||
} else { /* is OFDM rate */
|
||||
dm_odm->PhyDbgInfo.NumQryPhyStatusOFDM++;
|
||||
|
||||
/* (1)Get RSSI for HT rate */
|
||||
|
||||
for (i = RF_PATH_A; i < RF_PATH_MAX; i++) {
|
||||
/* 2008/01/30 MH we will judge RF RX path now. */
|
||||
if (dm_odm->RFPathRxEnable & BIT(i))
|
||||
rf_rx_num++;
|
||||
|
||||
rx_pwr[i] = ((pPhyStaRpt->path_agc[i].gain & 0x3F)*2) - 110;
|
||||
if (i == RF_PATH_A)
|
||||
adapt->signal_strength = rx_pwr[i];
|
||||
|
||||
pPhyInfo->RxPwr[i] = rx_pwr[i];
|
||||
|
||||
/* Translate DBM to percentage. */
|
||||
RSSI = odm_QueryRxPwrPercentage(rx_pwr[i]);
|
||||
total_rssi += RSSI;
|
||||
|
||||
/* Modification for ext-LNA board */
|
||||
if (dm_odm->BoardType == ODM_BOARD_HIGHPWR) {
|
||||
if ((pPhyStaRpt->path_agc[i].trsw) == 1)
|
||||
RSSI = (RSSI > 94) ? 100 : (RSSI + 6);
|
||||
else
|
||||
RSSI = (RSSI <= 16) ? (RSSI >> 3) : (RSSI - 16);
|
||||
|
||||
if ((RSSI <= 34) && (RSSI >= 4))
|
||||
RSSI -= 4;
|
||||
}
|
||||
|
||||
pPhyInfo->RxMIMOSignalStrength[i] = (u8)RSSI;
|
||||
|
||||
/* Get Rx snr value in DB */
|
||||
pPhyInfo->RxSNR[i] = (s32)(pPhyStaRpt->path_rxsnr[i]/2);
|
||||
dm_odm->PhyDbgInfo.RxSNRdB[i] = (s32)(pPhyStaRpt->path_rxsnr[i]/2);
|
||||
|
||||
/* Record Signal Strength for next packet */
|
||||
if (pPktinfo->bPacketMatchBSSID) {
|
||||
if ((dm_odm->SupportPlatform == ODM_MP) && (dm_odm->PatchID == 19)) {
|
||||
if (i == RF_PATH_A)
|
||||
pPhyInfo->SignalQuality = odm_SQ_process_patch_RT_CID_819x_Lenovo(dm_odm, isCCKrate, PWDB_ALL, i, RSSI);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* (2)PWDB, Average PWDB cacluated by hardware (for rate adaptive) */
|
||||
rx_pwr_all = (((pPhyStaRpt->cck_sig_qual_ofdm_pwdb_all) >> 1) & 0x7f) - 110;
|
||||
|
||||
PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all);
|
||||
PWDB_ALL_BT = PWDB_ALL;
|
||||
|
||||
pPhyInfo->RxPWDBAll = PWDB_ALL;
|
||||
pPhyInfo->BTRxRSSIPercentage = PWDB_ALL_BT;
|
||||
pPhyInfo->RxPower = rx_pwr_all;
|
||||
pPhyInfo->RecvSignalPower = rx_pwr_all;
|
||||
|
||||
if ((dm_odm->SupportPlatform == ODM_MP) && (dm_odm->PatchID == 19)) {
|
||||
/* do nothing */
|
||||
} else {
|
||||
/* (3)EVM of HT rate */
|
||||
if (pPktinfo->Rate >= DESC92C_RATEMCS8 && pPktinfo->Rate <= DESC92C_RATEMCS15)
|
||||
Max_spatial_stream = 2; /* both spatial stream make sense */
|
||||
else
|
||||
Max_spatial_stream = 1; /* only spatial stream 1 makes sense */
|
||||
|
||||
for (i = 0; i < Max_spatial_stream; i++) {
|
||||
/* Do not use shift operation like "rx_evmX >>= 1" because the compilor of free build environment */
|
||||
/* fill most significant bit to "zero" when doing shifting operation which may change a negative */
|
||||
/* value to positive one, then the dbm value (which is supposed to be negative) is not correct anymore. */
|
||||
EVM = odm_EVMdbToPercentage((pPhyStaRpt->stream_rxevm[i])); /* dbm */
|
||||
|
||||
if (pPktinfo->bPacketMatchBSSID) {
|
||||
if (i == RF_PATH_A) /* Fill value in RFD, Get the first spatial stream only */
|
||||
pPhyInfo->SignalQuality = (u8)(EVM & 0xff);
|
||||
pPhyInfo->RxMIMOSignalQuality[i] = (u8)(EVM & 0xff);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* UI BSS List signal strength(in percentage), make it good looking, from 0~100. */
|
||||
/* It is assigned to the BSS List in GetValueFromBeaconOrProbeRsp(). */
|
||||
if (isCCKrate) {
|
||||
pPhyInfo->SignalStrength = (u8)(odm_SignalScaleMapping(dm_odm, PWDB_ALL));/* PWDB_ALL; */
|
||||
} else {
|
||||
if (rf_rx_num != 0)
|
||||
pPhyInfo->SignalStrength = (u8)(odm_SignalScaleMapping(dm_odm, total_rssi /= rf_rx_num));
|
||||
}
|
||||
|
||||
/* For 92C/92D HW (Hybrid) Antenna Diversity */
|
||||
pDM_SWAT_Table->antsel = pPhyStaRpt->ant_sel;
|
||||
/* For 88E HW Antenna Diversity */
|
||||
dm_odm->DM_FatTable.antsel_rx_keep_0 = pPhyStaRpt->ant_sel;
|
||||
dm_odm->DM_FatTable.antsel_rx_keep_1 = pPhyStaRpt->ant_sel_b;
|
||||
dm_odm->DM_FatTable.antsel_rx_keep_2 = pPhyStaRpt->antsel_rx_keep_2;
|
||||
}
|
||||
|
||||
void odm_Init_RSSIForDM(struct odm_dm_struct *dm_odm)
|
||||
{
|
||||
}
|
||||
|
||||
static void odm_Process_RSSIForDM(struct odm_dm_struct *dm_odm,
|
||||
struct odm_phy_status_info *pPhyInfo,
|
||||
struct odm_per_pkt_info *pPktinfo)
|
||||
{
|
||||
s32 UndecoratedSmoothedPWDB, UndecoratedSmoothedCCK;
|
||||
s32 UndecoratedSmoothedOFDM, RSSI_Ave;
|
||||
u8 isCCKrate = 0;
|
||||
u8 RSSI_max, RSSI_min, i;
|
||||
u32 OFDM_pkt = 0;
|
||||
u32 Weighting = 0;
|
||||
struct sta_info *pEntry;
|
||||
|
||||
if (pPktinfo->StationID == 0xFF)
|
||||
return;
|
||||
pEntry = dm_odm->pODM_StaInfo[pPktinfo->StationID];
|
||||
if (!IS_STA_VALID(pEntry))
|
||||
return;
|
||||
if ((!pPktinfo->bPacketMatchBSSID))
|
||||
return;
|
||||
|
||||
isCCKrate = ((pPktinfo->Rate >= DESC92C_RATE1M) && (pPktinfo->Rate <= DESC92C_RATE11M)) ? true : false;
|
||||
|
||||
/* Smart Antenna Debug Message------------------ */
|
||||
if (dm_odm->SupportICType == ODM_RTL8188E) {
|
||||
u8 antsel_tr_mux;
|
||||
struct fast_ant_train *pDM_FatTable = &dm_odm->DM_FatTable;
|
||||
|
||||
if (dm_odm->AntDivType == CG_TRX_SMART_ANTDIV) {
|
||||
if (pDM_FatTable->FAT_State == FAT_TRAINING_STATE) {
|
||||
if (pPktinfo->bPacketToSelf) {
|
||||
antsel_tr_mux = (pDM_FatTable->antsel_rx_keep_2<<2) |
|
||||
(pDM_FatTable->antsel_rx_keep_1<<1) |
|
||||
pDM_FatTable->antsel_rx_keep_0;
|
||||
pDM_FatTable->antSumRSSI[antsel_tr_mux] += pPhyInfo->RxPWDBAll;
|
||||
pDM_FatTable->antRSSIcnt[antsel_tr_mux]++;
|
||||
}
|
||||
}
|
||||
} else if ((dm_odm->AntDivType == CG_TRX_HW_ANTDIV) || (dm_odm->AntDivType == CGCS_RX_HW_ANTDIV)) {
|
||||
if (pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon) {
|
||||
antsel_tr_mux = (pDM_FatTable->antsel_rx_keep_2<<2) |
|
||||
(pDM_FatTable->antsel_rx_keep_1<<1) | pDM_FatTable->antsel_rx_keep_0;
|
||||
ODM_AntselStatistics_88E(dm_odm, antsel_tr_mux, pPktinfo->StationID, pPhyInfo->RxPWDBAll);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Smart Antenna Debug Message------------------ */
|
||||
|
||||
UndecoratedSmoothedCCK = pEntry->rssi_stat.UndecoratedSmoothedCCK;
|
||||
UndecoratedSmoothedOFDM = pEntry->rssi_stat.UndecoratedSmoothedOFDM;
|
||||
UndecoratedSmoothedPWDB = pEntry->rssi_stat.UndecoratedSmoothedPWDB;
|
||||
|
||||
if (pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon) {
|
||||
if (!isCCKrate) { /* ofdm rate */
|
||||
if (pPhyInfo->RxMIMOSignalStrength[RF_PATH_B] == 0) {
|
||||
RSSI_Ave = pPhyInfo->RxMIMOSignalStrength[RF_PATH_A];
|
||||
} else {
|
||||
if (pPhyInfo->RxMIMOSignalStrength[RF_PATH_A] > pPhyInfo->RxMIMOSignalStrength[RF_PATH_B]) {
|
||||
RSSI_max = pPhyInfo->RxMIMOSignalStrength[RF_PATH_A];
|
||||
RSSI_min = pPhyInfo->RxMIMOSignalStrength[RF_PATH_B];
|
||||
} else {
|
||||
RSSI_max = pPhyInfo->RxMIMOSignalStrength[RF_PATH_B];
|
||||
RSSI_min = pPhyInfo->RxMIMOSignalStrength[RF_PATH_A];
|
||||
}
|
||||
if ((RSSI_max - RSSI_min) < 3)
|
||||
RSSI_Ave = RSSI_max;
|
||||
else if ((RSSI_max - RSSI_min) < 6)
|
||||
RSSI_Ave = RSSI_max - 1;
|
||||
else if ((RSSI_max - RSSI_min) < 10)
|
||||
RSSI_Ave = RSSI_max - 2;
|
||||
else
|
||||
RSSI_Ave = RSSI_max - 3;
|
||||
}
|
||||
|
||||
/* 1 Process OFDM RSSI */
|
||||
if (UndecoratedSmoothedOFDM <= 0) { /* initialize */
|
||||
UndecoratedSmoothedOFDM = pPhyInfo->RxPWDBAll;
|
||||
} else {
|
||||
if (pPhyInfo->RxPWDBAll > (u32)UndecoratedSmoothedOFDM) {
|
||||
UndecoratedSmoothedOFDM =
|
||||
(((UndecoratedSmoothedOFDM)*(Rx_Smooth_Factor-1)) +
|
||||
(RSSI_Ave)) / (Rx_Smooth_Factor);
|
||||
UndecoratedSmoothedOFDM = UndecoratedSmoothedOFDM + 1;
|
||||
} else {
|
||||
UndecoratedSmoothedOFDM =
|
||||
(((UndecoratedSmoothedOFDM)*(Rx_Smooth_Factor-1)) +
|
||||
(RSSI_Ave)) / (Rx_Smooth_Factor);
|
||||
}
|
||||
}
|
||||
|
||||
pEntry->rssi_stat.PacketMap = (pEntry->rssi_stat.PacketMap<<1) | BIT0;
|
||||
|
||||
} else {
|
||||
RSSI_Ave = pPhyInfo->RxPWDBAll;
|
||||
|
||||
/* 1 Process CCK RSSI */
|
||||
if (UndecoratedSmoothedCCK <= 0) { /* initialize */
|
||||
UndecoratedSmoothedCCK = pPhyInfo->RxPWDBAll;
|
||||
} else {
|
||||
if (pPhyInfo->RxPWDBAll > (u32)UndecoratedSmoothedCCK) {
|
||||
UndecoratedSmoothedCCK =
|
||||
((UndecoratedSmoothedCCK * (Rx_Smooth_Factor-1)) +
|
||||
pPhyInfo->RxPWDBAll) / Rx_Smooth_Factor;
|
||||
UndecoratedSmoothedCCK = UndecoratedSmoothedCCK + 1;
|
||||
} else {
|
||||
UndecoratedSmoothedCCK =
|
||||
((UndecoratedSmoothedCCK * (Rx_Smooth_Factor-1)) +
|
||||
pPhyInfo->RxPWDBAll) / Rx_Smooth_Factor;
|
||||
}
|
||||
}
|
||||
pEntry->rssi_stat.PacketMap = pEntry->rssi_stat.PacketMap<<1;
|
||||
}
|
||||
/* 2011.07.28 LukeLee: modified to prevent unstable CCK RSSI */
|
||||
if (pEntry->rssi_stat.ValidBit >= 64)
|
||||
pEntry->rssi_stat.ValidBit = 64;
|
||||
else
|
||||
pEntry->rssi_stat.ValidBit++;
|
||||
|
||||
for (i = 0; i < pEntry->rssi_stat.ValidBit; i++)
|
||||
OFDM_pkt += (u8)(pEntry->rssi_stat.PacketMap>>i)&BIT0;
|
||||
|
||||
if (pEntry->rssi_stat.ValidBit == 64) {
|
||||
Weighting = ((OFDM_pkt<<4) > 64) ? 64 : (OFDM_pkt<<4);
|
||||
UndecoratedSmoothedPWDB = (Weighting*UndecoratedSmoothedOFDM+(64-Weighting)*UndecoratedSmoothedCCK)>>6;
|
||||
} else {
|
||||
if (pEntry->rssi_stat.ValidBit != 0)
|
||||
UndecoratedSmoothedPWDB = (OFDM_pkt * UndecoratedSmoothedOFDM +
|
||||
(pEntry->rssi_stat.ValidBit-OFDM_pkt) *
|
||||
UndecoratedSmoothedCCK)/pEntry->rssi_stat.ValidBit;
|
||||
else
|
||||
UndecoratedSmoothedPWDB = 0;
|
||||
}
|
||||
pEntry->rssi_stat.UndecoratedSmoothedCCK = UndecoratedSmoothedCCK;
|
||||
pEntry->rssi_stat.UndecoratedSmoothedOFDM = UndecoratedSmoothedOFDM;
|
||||
pEntry->rssi_stat.UndecoratedSmoothedPWDB = UndecoratedSmoothedPWDB;
|
||||
}
|
||||
}
|
||||
|
||||
/* Endianness before calling this API */
|
||||
static void ODM_PhyStatusQuery_92CSeries(struct odm_dm_struct *dm_odm,
|
||||
struct odm_phy_status_info *pPhyInfo,
|
||||
u8 *pPhyStatus,
|
||||
struct odm_per_pkt_info *pPktinfo,
|
||||
struct adapter *adapt)
|
||||
{
|
||||
odm_RxPhyStatus92CSeries_Parsing(dm_odm, pPhyInfo, pPhyStatus,
|
||||
pPktinfo, adapt);
|
||||
if (dm_odm->RSSI_test) {
|
||||
/* Select the packets to do RSSI checking for antenna switching. */
|
||||
if (pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon)
|
||||
ODM_SwAntDivChkPerPktRssi(dm_odm, pPktinfo->StationID, pPhyInfo);
|
||||
} else {
|
||||
odm_Process_RSSIForDM(dm_odm, pPhyInfo, pPktinfo);
|
||||
}
|
||||
}
|
||||
|
||||
void ODM_PhyStatusQuery(struct odm_dm_struct *dm_odm,
|
||||
struct odm_phy_status_info *pPhyInfo,
|
||||
u8 *pPhyStatus, struct odm_per_pkt_info *pPktinfo,
|
||||
struct adapter *adapt)
|
||||
{
|
||||
ODM_PhyStatusQuery_92CSeries(dm_odm, pPhyInfo, pPhyStatus, pPktinfo, adapt);
|
||||
}
|
||||
|
||||
/* For future use. */
|
||||
void ODM_MacStatusQuery(struct odm_dm_struct *dm_odm, u8 *mac_stat,
|
||||
u8 macid, bool pkt_match_bssid,
|
||||
bool pkttoself, bool pkt_beacon)
|
||||
{
|
||||
/* 2011/10/19 Driver team will handle in the future. */
|
||||
}
|
||||
|
||||
enum HAL_STATUS ODM_ConfigRFWithHeaderFile(struct odm_dm_struct *dm_odm,
|
||||
enum rf_radio_path content,
|
||||
enum rf_radio_path rfpath)
|
||||
{
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===>ODM_ConfigRFWithHeaderFile\n"));
|
||||
if (dm_odm->SupportICType == ODM_RTL8188E) {
|
||||
if (rfpath == RF_PATH_A)
|
||||
READ_AND_CONFIG(8188E, _RadioA_1T_);
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> ODM_ConfigRFWithHeaderFile() Radio_A:Rtl8188ERadioA_1TArray\n"));
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> ODM_ConfigRFWithHeaderFile() Radio_B:Rtl8188ERadioB_1TArray\n"));
|
||||
}
|
||||
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("ODM_ConfigRFWithHeaderFile: Radio No %x\n", rfpath));
|
||||
return HAL_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
enum HAL_STATUS ODM_ConfigBBWithHeaderFile(struct odm_dm_struct *dm_odm,
|
||||
enum odm_bb_config_type config_tp)
|
||||
{
|
||||
if (dm_odm->SupportICType == ODM_RTL8188E) {
|
||||
if (config_tp == CONFIG_BB_PHY_REG) {
|
||||
READ_AND_CONFIG(8188E, _PHY_REG_1T_);
|
||||
} else if (config_tp == CONFIG_BB_AGC_TAB) {
|
||||
READ_AND_CONFIG(8188E, _AGC_TAB_1T_);
|
||||
} else if (config_tp == CONFIG_BB_PHY_REG_PG) {
|
||||
READ_AND_CONFIG(8188E, _PHY_REG_PG_);
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_INIT, ODM_DBG_LOUD,
|
||||
(" ===> phy_ConfigBBWithHeaderFile() agc:Rtl8188EPHY_REG_PGArray\n"));
|
||||
}
|
||||
}
|
||||
return HAL_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
enum HAL_STATUS ODM_ConfigMACWithHeaderFile(struct odm_dm_struct *dm_odm)
|
||||
{
|
||||
u8 result = HAL_STATUS_SUCCESS;
|
||||
if (dm_odm->SupportICType == ODM_RTL8188E)
|
||||
result = READ_AND_CONFIG(8188E, _MAC_REG_);
|
||||
return result;
|
||||
}
|
||||
400
drivers/net/wireless/realtek/rtl8188eu/hal/odm_RTL8188E.c
Normal file
400
drivers/net/wireless/realtek/rtl8188eu/hal/odm_RTL8188E.c
Normal file
@@ -0,0 +1,400 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "odm_precomp.h"
|
||||
|
||||
void ODM_DIG_LowerBound_88E(struct odm_dm_struct *dm_odm)
|
||||
{
|
||||
struct rtw_dig *pDM_DigTable = &dm_odm->DM_DigTable;
|
||||
|
||||
if (dm_odm->AntDivType == CG_TRX_HW_ANTDIV) {
|
||||
pDM_DigTable->rx_gain_range_min = (u8) pDM_DigTable->AntDiv_RSSI_max;
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,
|
||||
("ODM_DIG_LowerBound_88E(): pDM_DigTable->AntDiv_RSSI_max=%d\n", pDM_DigTable->AntDiv_RSSI_max));
|
||||
}
|
||||
/* If only one Entry connected */
|
||||
}
|
||||
|
||||
static void odm_RX_HWAntDivInit(struct odm_dm_struct *dm_odm)
|
||||
{
|
||||
u32 value32;
|
||||
|
||||
if (*(dm_odm->mp_mode) == 1) {
|
||||
dm_odm->AntDivType = CGCS_RX_SW_ANTDIV;
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_IGI_A_11N, BIT7, 0); /* disable HW AntDiv */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_LNA_SWITCH_11N, BIT31, 1); /* 1:CG, 0:CS */
|
||||
return;
|
||||
}
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_RX_HWAntDivInit()\n"));
|
||||
|
||||
/* MAC Setting */
|
||||
value32 = ODM_GetMACReg(dm_odm, ODM_REG_ANTSEL_PIN_11N, bMaskDWord);
|
||||
ODM_SetMACReg(dm_odm, ODM_REG_ANTSEL_PIN_11N, bMaskDWord, value32|(BIT23|BIT25)); /* Reg4C[25]=1, Reg4C[23]=1 for pin output */
|
||||
/* Pin Settings */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_PIN_CTRL_11N, BIT9|BIT8, 0);/* Reg870[8]=1'b0, Reg870[9]=1'b0 antsel antselb by HW */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_RX_ANT_CTRL_11N, BIT10, 0); /* Reg864[10]=1'b0 antsel2 by HW */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_LNA_SWITCH_11N, BIT22, 1); /* Regb2c[22]=1'b0 disable CS/CG switch */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_LNA_SWITCH_11N, BIT31, 1); /* Regb2c[31]=1'b1 output at CG only */
|
||||
/* OFDM Settings */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_ANTDIV_PARA1_11N, bMaskDWord, 0x000000a0);
|
||||
/* CCK Settings */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_BB_PWR_SAV4_11N, BIT7, 1); /* Fix CCK PHY status report issue */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_CCK_ANTDIV_PARA2_11N, BIT4, 1); /* CCK complete HW AntDiv within 64 samples */
|
||||
ODM_UpdateRxIdleAnt_88E(dm_odm, MAIN_ANT);
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_ANT_MAPPING1_11N, 0xFFFF, 0x0201); /* antenna mapping table */
|
||||
}
|
||||
|
||||
static void odm_TRX_HWAntDivInit(struct odm_dm_struct *dm_odm)
|
||||
{
|
||||
u32 value32;
|
||||
|
||||
if (*(dm_odm->mp_mode) == 1) {
|
||||
dm_odm->AntDivType = CGCS_RX_SW_ANTDIV;
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_IGI_A_11N, BIT7, 0); /* disable HW AntDiv */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_RX_ANT_CTRL_11N, BIT5|BIT4|BIT3, 0); /* Default RX (0/1) */
|
||||
return;
|
||||
}
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_TRX_HWAntDivInit()\n"));
|
||||
|
||||
/* MAC Setting */
|
||||
value32 = ODM_GetMACReg(dm_odm, ODM_REG_ANTSEL_PIN_11N, bMaskDWord);
|
||||
ODM_SetMACReg(dm_odm, ODM_REG_ANTSEL_PIN_11N, bMaskDWord, value32|(BIT23|BIT25)); /* Reg4C[25]=1, Reg4C[23]=1 for pin output */
|
||||
/* Pin Settings */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_PIN_CTRL_11N, BIT9|BIT8, 0);/* Reg870[8]=1'b0, Reg870[9]=1'b0 antsel antselb by HW */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_RX_ANT_CTRL_11N, BIT10, 0); /* Reg864[10]=1'b0 antsel2 by HW */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_LNA_SWITCH_11N, BIT22, 0); /* Regb2c[22]=1'b0 disable CS/CG switch */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_LNA_SWITCH_11N, BIT31, 1); /* Regb2c[31]=1'b1 output at CG only */
|
||||
/* OFDM Settings */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_ANTDIV_PARA1_11N, bMaskDWord, 0x000000a0);
|
||||
/* CCK Settings */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_BB_PWR_SAV4_11N, BIT7, 1); /* Fix CCK PHY status report issue */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_CCK_ANTDIV_PARA2_11N, BIT4, 1); /* CCK complete HW AntDiv within 64 samples */
|
||||
/* Tx Settings */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_TX_ANT_CTRL_11N, BIT21, 0); /* Reg80c[21]=1'b0 from TX Reg */
|
||||
ODM_UpdateRxIdleAnt_88E(dm_odm, MAIN_ANT);
|
||||
|
||||
/* antenna mapping table */
|
||||
if (!dm_odm->bIsMPChip) { /* testchip */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_RX_DEFUALT_A_11N, BIT10|BIT9|BIT8, 1); /* Reg858[10:8]=3'b001 */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_RX_DEFUALT_A_11N, BIT13|BIT12|BIT11, 2); /* Reg858[13:11]=3'b010 */
|
||||
} else { /* MPchip */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_ANT_MAPPING1_11N, bMaskDWord, 0x0201); /* Reg914=3'b010, Reg915=3'b001 */
|
||||
}
|
||||
}
|
||||
|
||||
static void odm_FastAntTrainingInit(struct odm_dm_struct *dm_odm)
|
||||
{
|
||||
u32 value32, i;
|
||||
struct fast_ant_train *dm_fat_tbl = &dm_odm->DM_FatTable;
|
||||
u32 AntCombination = 2;
|
||||
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_FastAntTrainingInit()\n"));
|
||||
|
||||
if (*(dm_odm->mp_mode) == 1) {
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("dm_odm->AntDivType: %d\n", dm_odm->AntDivType));
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
dm_fat_tbl->Bssid[i] = 0;
|
||||
dm_fat_tbl->antSumRSSI[i] = 0;
|
||||
dm_fat_tbl->antRSSIcnt[i] = 0;
|
||||
dm_fat_tbl->antAveRSSI[i] = 0;
|
||||
}
|
||||
dm_fat_tbl->TrainIdx = 0;
|
||||
dm_fat_tbl->FAT_State = FAT_NORMAL_STATE;
|
||||
|
||||
/* MAC Setting */
|
||||
value32 = ODM_GetMACReg(dm_odm, 0x4c, bMaskDWord);
|
||||
ODM_SetMACReg(dm_odm, 0x4c, bMaskDWord, value32|(BIT23|BIT25)); /* Reg4C[25]=1, Reg4C[23]=1 for pin output */
|
||||
value32 = ODM_GetMACReg(dm_odm, 0x7B4, bMaskDWord);
|
||||
ODM_SetMACReg(dm_odm, 0x7b4, bMaskDWord, value32|(BIT16|BIT17)); /* Reg7B4[16]=1 enable antenna training, Reg7B4[17]=1 enable A2 match */
|
||||
|
||||
/* Match MAC ADDR */
|
||||
ODM_SetMACReg(dm_odm, 0x7b4, 0xFFFF, 0);
|
||||
ODM_SetMACReg(dm_odm, 0x7b0, bMaskDWord, 0);
|
||||
|
||||
ODM_SetBBReg(dm_odm, 0x870, BIT9|BIT8, 0);/* Reg870[8]=1'b0, Reg870[9]=1'b0 antsel antselb by HW */
|
||||
ODM_SetBBReg(dm_odm, 0x864, BIT10, 0); /* Reg864[10]=1'b0 antsel2 by HW */
|
||||
ODM_SetBBReg(dm_odm, 0xb2c, BIT22, 0); /* Regb2c[22]=1'b0 disable CS/CG switch */
|
||||
ODM_SetBBReg(dm_odm, 0xb2c, BIT31, 1); /* Regb2c[31]=1'b1 output at CG only */
|
||||
ODM_SetBBReg(dm_odm, 0xca4, bMaskDWord, 0x000000a0);
|
||||
|
||||
/* antenna mapping table */
|
||||
if (AntCombination == 2) {
|
||||
if (!dm_odm->bIsMPChip) { /* testchip */
|
||||
ODM_SetBBReg(dm_odm, 0x858, BIT10|BIT9|BIT8, 1); /* Reg858[10:8]=3'b001 */
|
||||
ODM_SetBBReg(dm_odm, 0x858, BIT13|BIT12|BIT11, 2); /* Reg858[13:11]=3'b010 */
|
||||
} else { /* MPchip */
|
||||
ODM_SetBBReg(dm_odm, 0x914, bMaskByte0, 1);
|
||||
ODM_SetBBReg(dm_odm, 0x914, bMaskByte1, 2);
|
||||
}
|
||||
} else if (AntCombination == 7) {
|
||||
if (!dm_odm->bIsMPChip) { /* testchip */
|
||||
ODM_SetBBReg(dm_odm, 0x858, BIT10|BIT9|BIT8, 0); /* Reg858[10:8]=3'b000 */
|
||||
ODM_SetBBReg(dm_odm, 0x858, BIT13|BIT12|BIT11, 1); /* Reg858[13:11]=3'b001 */
|
||||
ODM_SetBBReg(dm_odm, 0x878, BIT16, 0);
|
||||
ODM_SetBBReg(dm_odm, 0x858, BIT15|BIT14, 2); /* Reg878[0],Reg858[14:15])=3'b010 */
|
||||
ODM_SetBBReg(dm_odm, 0x878, BIT19|BIT18|BIT17, 3);/* Reg878[3:1]=3b'011 */
|
||||
ODM_SetBBReg(dm_odm, 0x878, BIT22|BIT21|BIT20, 4);/* Reg878[6:4]=3b'100 */
|
||||
ODM_SetBBReg(dm_odm, 0x878, BIT25|BIT24|BIT23, 5);/* Reg878[9:7]=3b'101 */
|
||||
ODM_SetBBReg(dm_odm, 0x878, BIT28|BIT27|BIT26, 6);/* Reg878[12:10]=3b'110 */
|
||||
ODM_SetBBReg(dm_odm, 0x878, BIT31|BIT30|BIT29, 7);/* Reg878[15:13]=3b'111 */
|
||||
} else { /* MPchip */
|
||||
ODM_SetBBReg(dm_odm, 0x914, bMaskByte0, 0);
|
||||
ODM_SetBBReg(dm_odm, 0x914, bMaskByte1, 1);
|
||||
ODM_SetBBReg(dm_odm, 0x914, bMaskByte2, 2);
|
||||
ODM_SetBBReg(dm_odm, 0x914, bMaskByte3, 3);
|
||||
ODM_SetBBReg(dm_odm, 0x918, bMaskByte0, 4);
|
||||
ODM_SetBBReg(dm_odm, 0x918, bMaskByte1, 5);
|
||||
ODM_SetBBReg(dm_odm, 0x918, bMaskByte2, 6);
|
||||
ODM_SetBBReg(dm_odm, 0x918, bMaskByte3, 7);
|
||||
}
|
||||
}
|
||||
|
||||
/* Default Ant Setting when no fast training */
|
||||
ODM_SetBBReg(dm_odm, 0x80c, BIT21, 1); /* Reg80c[21]=1'b1 from TX Info */
|
||||
ODM_SetBBReg(dm_odm, 0x864, BIT5|BIT4|BIT3, 0); /* Default RX */
|
||||
ODM_SetBBReg(dm_odm, 0x864, BIT8|BIT7|BIT6, 1); /* Optional RX */
|
||||
|
||||
/* Enter Traing state */
|
||||
ODM_SetBBReg(dm_odm, 0x864, BIT2|BIT1|BIT0, (AntCombination-1)); /* Reg864[2:0]=3'd6 ant combination=reg864[2:0]+1 */
|
||||
ODM_SetBBReg(dm_odm, 0xc50, BIT7, 1); /* RegC50[7]=1'b1 enable HW AntDiv */
|
||||
}
|
||||
|
||||
void ODM_AntennaDiversityInit_88E(struct odm_dm_struct *dm_odm)
|
||||
{
|
||||
if (dm_odm->SupportICType != ODM_RTL8188E)
|
||||
return;
|
||||
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("dm_odm->AntDivType=%d\n", dm_odm->AntDivType));
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("dm_odm->bIsMPChip=%s\n", (dm_odm->bIsMPChip ? "true" : "false")));
|
||||
|
||||
if (dm_odm->AntDivType == CGCS_RX_HW_ANTDIV)
|
||||
odm_RX_HWAntDivInit(dm_odm);
|
||||
else if (dm_odm->AntDivType == CG_TRX_HW_ANTDIV)
|
||||
odm_TRX_HWAntDivInit(dm_odm);
|
||||
else if (dm_odm->AntDivType == CG_TRX_SMART_ANTDIV)
|
||||
odm_FastAntTrainingInit(dm_odm);
|
||||
}
|
||||
|
||||
void ODM_UpdateRxIdleAnt_88E(struct odm_dm_struct *dm_odm, u8 Ant)
|
||||
{
|
||||
struct fast_ant_train *dm_fat_tbl = &dm_odm->DM_FatTable;
|
||||
u32 DefaultAnt, OptionalAnt;
|
||||
|
||||
if (dm_fat_tbl->RxIdleAnt != Ant) {
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Need to Update Rx Idle Ant\n"));
|
||||
if (Ant == MAIN_ANT) {
|
||||
DefaultAnt = (dm_odm->AntDivType == CG_TRX_HW_ANTDIV) ? MAIN_ANT_CG_TRX : MAIN_ANT_CGCS_RX;
|
||||
OptionalAnt = (dm_odm->AntDivType == CG_TRX_HW_ANTDIV) ? AUX_ANT_CG_TRX : AUX_ANT_CGCS_RX;
|
||||
} else {
|
||||
DefaultAnt = (dm_odm->AntDivType == CG_TRX_HW_ANTDIV) ? AUX_ANT_CG_TRX : AUX_ANT_CGCS_RX;
|
||||
OptionalAnt = (dm_odm->AntDivType == CG_TRX_HW_ANTDIV) ? MAIN_ANT_CG_TRX : MAIN_ANT_CGCS_RX;
|
||||
}
|
||||
|
||||
if (dm_odm->AntDivType == CG_TRX_HW_ANTDIV) {
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_RX_ANT_CTRL_11N, BIT5|BIT4|BIT3, DefaultAnt); /* Default RX */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_RX_ANT_CTRL_11N, BIT8|BIT7|BIT6, OptionalAnt); /* Optional RX */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_ANTSEL_CTRL_11N, BIT14|BIT13|BIT12, DefaultAnt); /* Default TX */
|
||||
ODM_SetMACReg(dm_odm, ODM_REG_RESP_TX_11N, BIT6|BIT7, DefaultAnt); /* Resp Tx */
|
||||
} else if (dm_odm->AntDivType == CGCS_RX_HW_ANTDIV) {
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_RX_ANT_CTRL_11N, BIT5|BIT4|BIT3, DefaultAnt); /* Default RX */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_RX_ANT_CTRL_11N, BIT8|BIT7|BIT6, OptionalAnt); /* Optional RX */
|
||||
}
|
||||
}
|
||||
dm_fat_tbl->RxIdleAnt = Ant;
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("RxIdleAnt=%s\n", (Ant == MAIN_ANT) ? "MAIN_ANT" : "AUX_ANT"));
|
||||
if (Ant != MAIN_ANT)
|
||||
pr_info("RxIdleAnt=AUX_ANT\n");
|
||||
}
|
||||
|
||||
static void odm_UpdateTxAnt_88E(struct odm_dm_struct *dm_odm, u8 Ant, u32 MacId)
|
||||
{
|
||||
struct fast_ant_train *dm_fat_tbl = &dm_odm->DM_FatTable;
|
||||
u8 TargetAnt;
|
||||
|
||||
if (Ant == MAIN_ANT)
|
||||
TargetAnt = MAIN_ANT_CG_TRX;
|
||||
else
|
||||
TargetAnt = AUX_ANT_CG_TRX;
|
||||
dm_fat_tbl->antsel_a[MacId] = TargetAnt&BIT0;
|
||||
dm_fat_tbl->antsel_b[MacId] = (TargetAnt&BIT1)>>1;
|
||||
dm_fat_tbl->antsel_c[MacId] = (TargetAnt&BIT2)>>2;
|
||||
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,
|
||||
("Tx from TxInfo, TargetAnt=%s\n",
|
||||
(Ant == MAIN_ANT) ? "MAIN_ANT" : "AUX_ANT"));
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,
|
||||
("antsel_tr_mux=3'b%d%d%d\n",
|
||||
dm_fat_tbl->antsel_c[MacId], dm_fat_tbl->antsel_b[MacId], dm_fat_tbl->antsel_a[MacId]));
|
||||
}
|
||||
|
||||
void ODM_SetTxAntByTxInfo_88E(struct odm_dm_struct *dm_odm, u8 *pDesc, u8 macId)
|
||||
{
|
||||
struct fast_ant_train *dm_fat_tbl = &dm_odm->DM_FatTable;
|
||||
|
||||
if ((dm_odm->AntDivType == CG_TRX_HW_ANTDIV) || (dm_odm->AntDivType == CG_TRX_SMART_ANTDIV)) {
|
||||
SET_TX_DESC_ANTSEL_A_88E(pDesc, dm_fat_tbl->antsel_a[macId]);
|
||||
SET_TX_DESC_ANTSEL_B_88E(pDesc, dm_fat_tbl->antsel_b[macId]);
|
||||
SET_TX_DESC_ANTSEL_C_88E(pDesc, dm_fat_tbl->antsel_c[macId]);
|
||||
}
|
||||
}
|
||||
|
||||
void ODM_AntselStatistics_88E(struct odm_dm_struct *dm_odm, u8 antsel_tr_mux, u32 MacId, u8 RxPWDBAll)
|
||||
{
|
||||
struct fast_ant_train *dm_fat_tbl = &dm_odm->DM_FatTable;
|
||||
if (dm_odm->AntDivType == CG_TRX_HW_ANTDIV) {
|
||||
if (antsel_tr_mux == MAIN_ANT_CG_TRX) {
|
||||
dm_fat_tbl->MainAnt_Sum[MacId] += RxPWDBAll;
|
||||
dm_fat_tbl->MainAnt_Cnt[MacId]++;
|
||||
} else {
|
||||
dm_fat_tbl->AuxAnt_Sum[MacId] += RxPWDBAll;
|
||||
dm_fat_tbl->AuxAnt_Cnt[MacId]++;
|
||||
}
|
||||
} else if (dm_odm->AntDivType == CGCS_RX_HW_ANTDIV) {
|
||||
if (antsel_tr_mux == MAIN_ANT_CGCS_RX) {
|
||||
dm_fat_tbl->MainAnt_Sum[MacId] += RxPWDBAll;
|
||||
dm_fat_tbl->MainAnt_Cnt[MacId]++;
|
||||
} else {
|
||||
dm_fat_tbl->AuxAnt_Sum[MacId] += RxPWDBAll;
|
||||
dm_fat_tbl->AuxAnt_Cnt[MacId]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void odm_HWAntDiv(struct odm_dm_struct *dm_odm)
|
||||
{
|
||||
u32 i, MinRSSI = 0xFF, AntDivMaxRSSI = 0, MaxRSSI = 0, LocalMinRSSI, LocalMaxRSSI;
|
||||
u32 Main_RSSI, Aux_RSSI;
|
||||
u8 RxIdleAnt = 0, TargetAnt = 7;
|
||||
struct fast_ant_train *dm_fat_tbl = &dm_odm->DM_FatTable;
|
||||
struct rtw_dig *pDM_DigTable = &dm_odm->DM_DigTable;
|
||||
struct sta_info *pEntry;
|
||||
|
||||
for (i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) {
|
||||
pEntry = dm_odm->pODM_StaInfo[i];
|
||||
if (IS_STA_VALID(pEntry)) {
|
||||
/* 2 Caculate RSSI per Antenna */
|
||||
Main_RSSI = (dm_fat_tbl->MainAnt_Cnt[i] != 0) ? (dm_fat_tbl->MainAnt_Sum[i]/dm_fat_tbl->MainAnt_Cnt[i]) : 0;
|
||||
Aux_RSSI = (dm_fat_tbl->AuxAnt_Cnt[i] != 0) ? (dm_fat_tbl->AuxAnt_Sum[i]/dm_fat_tbl->AuxAnt_Cnt[i]) : 0;
|
||||
TargetAnt = (Main_RSSI >= Aux_RSSI) ? MAIN_ANT : AUX_ANT;
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,
|
||||
("MacID=%d, MainAnt_Sum=%d, MainAnt_Cnt=%d\n",
|
||||
i, dm_fat_tbl->MainAnt_Sum[i],
|
||||
dm_fat_tbl->MainAnt_Cnt[i]));
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,
|
||||
("MacID=%d, AuxAnt_Sum=%d, AuxAnt_Cnt=%d\n",
|
||||
i, dm_fat_tbl->AuxAnt_Sum[i], dm_fat_tbl->AuxAnt_Cnt[i]));
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,
|
||||
("MacID=%d, Main_RSSI= %d, Aux_RSSI= %d\n",
|
||||
i, Main_RSSI, Aux_RSSI));
|
||||
/* 2 Select MaxRSSI for DIG */
|
||||
LocalMaxRSSI = (Main_RSSI > Aux_RSSI) ? Main_RSSI : Aux_RSSI;
|
||||
if ((LocalMaxRSSI > AntDivMaxRSSI) && (LocalMaxRSSI < 40))
|
||||
AntDivMaxRSSI = LocalMaxRSSI;
|
||||
if (LocalMaxRSSI > MaxRSSI)
|
||||
MaxRSSI = LocalMaxRSSI;
|
||||
|
||||
/* 2 Select RX Idle Antenna */
|
||||
if ((dm_fat_tbl->RxIdleAnt == MAIN_ANT) && (Main_RSSI == 0))
|
||||
Main_RSSI = Aux_RSSI;
|
||||
else if ((dm_fat_tbl->RxIdleAnt == AUX_ANT) && (Aux_RSSI == 0))
|
||||
Aux_RSSI = Main_RSSI;
|
||||
|
||||
LocalMinRSSI = (Main_RSSI > Aux_RSSI) ? Aux_RSSI : Main_RSSI;
|
||||
if (LocalMinRSSI < MinRSSI) {
|
||||
MinRSSI = LocalMinRSSI;
|
||||
RxIdleAnt = TargetAnt;
|
||||
}
|
||||
/* 2 Select TRX Antenna */
|
||||
if (dm_odm->AntDivType == CG_TRX_HW_ANTDIV)
|
||||
odm_UpdateTxAnt_88E(dm_odm, TargetAnt, i);
|
||||
}
|
||||
dm_fat_tbl->MainAnt_Sum[i] = 0;
|
||||
dm_fat_tbl->AuxAnt_Sum[i] = 0;
|
||||
dm_fat_tbl->MainAnt_Cnt[i] = 0;
|
||||
dm_fat_tbl->AuxAnt_Cnt[i] = 0;
|
||||
}
|
||||
|
||||
/* 2 Set RX Idle Antenna */
|
||||
ODM_UpdateRxIdleAnt_88E(dm_odm, RxIdleAnt);
|
||||
|
||||
pDM_DigTable->AntDiv_RSSI_max = AntDivMaxRSSI;
|
||||
pDM_DigTable->RSSI_max = MaxRSSI;
|
||||
}
|
||||
|
||||
void ODM_AntennaDiversity_88E(struct odm_dm_struct *dm_odm)
|
||||
{
|
||||
struct fast_ant_train *dm_fat_tbl = &dm_odm->DM_FatTable;
|
||||
if ((dm_odm->SupportICType != ODM_RTL8188E) || (!(dm_odm->SupportAbility & ODM_BB_ANT_DIV)))
|
||||
return;
|
||||
if (!dm_odm->bLinked) {
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_AntennaDiversity_88E(): No Link.\n"));
|
||||
if (dm_fat_tbl->bBecomeLinked) {
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Need to Turn off HW AntDiv\n"));
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_IGI_A_11N, BIT7, 0); /* RegC50[7]=1'b1 enable HW AntDiv */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_CCK_ANTDIV_PARA1_11N, BIT15, 0); /* Enable CCK AntDiv */
|
||||
if (dm_odm->AntDivType == CG_TRX_HW_ANTDIV)
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_TX_ANT_CTRL_11N, BIT21, 0); /* Reg80c[21]=1'b0 from TX Reg */
|
||||
dm_fat_tbl->bBecomeLinked = dm_odm->bLinked;
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
if (!dm_fat_tbl->bBecomeLinked) {
|
||||
ODM_RT_TRACE(dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Need to Turn on HW AntDiv\n"));
|
||||
/* Because HW AntDiv is disabled before Link, we enable HW AntDiv after link */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_IGI_A_11N, BIT7, 1); /* RegC50[7]=1'b1 enable HW AntDiv */
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_CCK_ANTDIV_PARA1_11N, BIT15, 1); /* Enable CCK AntDiv */
|
||||
if (dm_odm->AntDivType == CG_TRX_HW_ANTDIV)
|
||||
ODM_SetBBReg(dm_odm, ODM_REG_TX_ANT_CTRL_11N, BIT21, 1); /* Reg80c[21]=1'b1 from TX Info */
|
||||
dm_fat_tbl->bBecomeLinked = dm_odm->bLinked;
|
||||
}
|
||||
}
|
||||
if ((dm_odm->AntDivType == CG_TRX_HW_ANTDIV) || (dm_odm->AntDivType == CGCS_RX_HW_ANTDIV))
|
||||
odm_HWAntDiv(dm_odm);
|
||||
}
|
||||
|
||||
/* 3============================================================ */
|
||||
/* 3 Dynamic Primary CCA */
|
||||
/* 3============================================================ */
|
||||
|
||||
void odm_PrimaryCCA_Init(struct odm_dm_struct *dm_odm)
|
||||
{
|
||||
struct dyn_primary_cca *PrimaryCCA = &(dm_odm->DM_PriCCA);
|
||||
|
||||
PrimaryCCA->DupRTS_flag = 0;
|
||||
PrimaryCCA->intf_flag = 0;
|
||||
PrimaryCCA->intf_type = 0;
|
||||
PrimaryCCA->Monitor_flag = 0;
|
||||
PrimaryCCA->PriCCA_flag = 0;
|
||||
}
|
||||
|
||||
bool ODM_DynamicPrimaryCCA_DupRTS(struct odm_dm_struct *dm_odm)
|
||||
{
|
||||
struct dyn_primary_cca *PrimaryCCA = &(dm_odm->DM_PriCCA);
|
||||
|
||||
return PrimaryCCA->DupRTS_flag;
|
||||
}
|
||||
|
||||
void odm_DynamicPrimaryCCA(struct odm_dm_struct *dm_odm)
|
||||
{
|
||||
return;
|
||||
}
|
||||
130
drivers/net/wireless/realtek/rtl8188eu/hal/odm_RegConfig8188E.c
Normal file
130
drivers/net/wireless/realtek/rtl8188eu/hal/odm_RegConfig8188E.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "odm_precomp.h"
|
||||
|
||||
void odm_ConfigRFReg_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr,
|
||||
u32 Data, enum rf_radio_path RF_PATH,
|
||||
u32 RegAddr)
|
||||
{
|
||||
if (Addr == 0xffe) {
|
||||
ODM_sleep_ms(50);
|
||||
} else if (Addr == 0xfd) {
|
||||
ODM_delay_ms(5);
|
||||
} else if (Addr == 0xfc) {
|
||||
ODM_delay_ms(1);
|
||||
} else if (Addr == 0xfb) {
|
||||
ODM_delay_us(50);
|
||||
} else if (Addr == 0xfa) {
|
||||
ODM_delay_us(5);
|
||||
} else if (Addr == 0xf9) {
|
||||
ODM_delay_us(1);
|
||||
} else {
|
||||
ODM_SetRFReg(pDM_Odm, RF_PATH, RegAddr, bRFRegOffsetMask, Data);
|
||||
/* Add 1us delay between BB/RF register setting. */
|
||||
ODM_delay_us(1);
|
||||
}
|
||||
}
|
||||
|
||||
void odm_ConfigRF_RadioA_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, u32 Data)
|
||||
{
|
||||
u32 content = 0x1000; /* RF_Content: radioa_txt */
|
||||
u32 maskforPhySet = (u32)(content&0xE000);
|
||||
|
||||
odm_ConfigRFReg_8188E(pDM_Odm, Addr, Data, RF_PATH_A, Addr|maskforPhySet);
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigRFWithHeaderFile: [RadioA] %08X %08X\n", Addr, Data));
|
||||
}
|
||||
|
||||
void odm_ConfigRF_RadioB_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, u32 Data)
|
||||
{
|
||||
u32 content = 0x1001; /* RF_Content: radiob_txt */
|
||||
u32 maskforPhySet = (u32)(content&0xE000);
|
||||
|
||||
odm_ConfigRFReg_8188E(pDM_Odm, Addr, Data, RF_PATH_B, Addr|maskforPhySet);
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigRFWithHeaderFile: [RadioB] %08X %08X\n", Addr, Data));
|
||||
}
|
||||
|
||||
void odm_ConfigMAC_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, u8 Data)
|
||||
{
|
||||
ODM_Write1Byte(pDM_Odm, Addr, Data);
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigMACWithHeaderFile: [MAC_REG] %08X %08X\n", Addr, Data));
|
||||
}
|
||||
|
||||
void odm_ConfigBB_AGC_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, u32 Bitmask, u32 Data)
|
||||
{
|
||||
ODM_SetBBReg(pDM_Odm, Addr, Bitmask, Data);
|
||||
/* Add 1us delay between BB/RF register setting. */
|
||||
ODM_delay_us(1);
|
||||
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE,
|
||||
("===> ODM_ConfigBBWithHeaderFile: [AGC_TAB] %08X %08X\n",
|
||||
Addr, Data));
|
||||
}
|
||||
|
||||
void odm_ConfigBB_PHY_REG_PG_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr,
|
||||
u32 Bitmask, u32 Data)
|
||||
{
|
||||
if (Addr == 0xfe) {
|
||||
ODM_sleep_ms(50);
|
||||
} else if (Addr == 0xfd) {
|
||||
ODM_delay_ms(5);
|
||||
} else if (Addr == 0xfc) {
|
||||
ODM_delay_ms(1);
|
||||
} else if (Addr == 0xfb) {
|
||||
ODM_delay_us(50);
|
||||
} else if (Addr == 0xfa) {
|
||||
ODM_delay_us(5);
|
||||
} else if (Addr == 0xf9) {
|
||||
ODM_delay_us(1);
|
||||
} else{
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD,
|
||||
("===> @@@@@@@ ODM_ConfigBBWithHeaderFile: [PHY_REG] %08X %08X %08X\n",
|
||||
Addr, Bitmask, Data));
|
||||
storePwrIndexDiffRateOffset(pDM_Odm->Adapter, Addr, Bitmask, Data);
|
||||
}
|
||||
}
|
||||
|
||||
void odm_ConfigBB_PHY_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, u32 Bitmask, u32 Data)
|
||||
{
|
||||
if (Addr == 0xfe) {
|
||||
ODM_sleep_ms(50);
|
||||
} else if (Addr == 0xfd) {
|
||||
ODM_delay_ms(5);
|
||||
} else if (Addr == 0xfc) {
|
||||
ODM_delay_ms(1);
|
||||
} else if (Addr == 0xfb) {
|
||||
ODM_delay_us(50);
|
||||
} else if (Addr == 0xfa) {
|
||||
ODM_delay_us(5);
|
||||
} else if (Addr == 0xf9) {
|
||||
ODM_delay_us(1);
|
||||
} else {
|
||||
if (Addr == 0xa24)
|
||||
pDM_Odm->RFCalibrateInfo.RegA24 = Data;
|
||||
ODM_SetBBReg(pDM_Odm, Addr, Bitmask, Data);
|
||||
|
||||
/* Add 1us delay between BB/RF register setting. */
|
||||
ODM_delay_us(1);
|
||||
ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE,
|
||||
("===> ODM_ConfigBBWithHeaderFile: [PHY_REG] %08X %08X\n",
|
||||
Addr, Data));
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2013 Realtek Corporation. All rights reserved.
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
@@ -17,25 +17,16 @@
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __HAL_SDIO_COEX_H__
|
||||
#define __HAL_SDIO_COEX_H__
|
||||
|
||||
#include <drv_types.h>
|
||||
/* include files */
|
||||
|
||||
#ifdef CONFIG_SDIO_MULTI_FUNCTION_COEX
|
||||
#include "odm_precomp.h"
|
||||
|
||||
enum { /* for sdio multi-func. coex */
|
||||
SDIO_MULTI_WIFI = 0,
|
||||
SDIO_MULTI_BT,
|
||||
SDIO_MULTI_NUM
|
||||
};
|
||||
void ODM_InitDebugSetting(struct odm_dm_struct *pDM_Odm)
|
||||
{
|
||||
pDM_Odm->DebugLevel = ODM_DBG_TRACE;
|
||||
|
||||
bool ex_hal_sdio_multi_if_bus_available(PADAPTER adapter);
|
||||
|
||||
#else
|
||||
|
||||
#define ex_hal_sdio_multi_if_bus_available(adapter) TRUE
|
||||
|
||||
#endif /* CONFIG_SDIO_MULTI_FUNCTION_COEX */
|
||||
#endif /* !__HAL_SDIO_COEX_H__ */
|
||||
pDM_Odm->DebugComponents = 0;
|
||||
}
|
||||
|
||||
u32 GlobalDebugLevel;
|
||||
205
drivers/net/wireless/realtek/rtl8188eu/hal/odm_interface.c
Normal file
205
drivers/net/wireless/realtek/rtl8188eu/hal/odm_interface.c
Normal file
@@ -0,0 +1,205 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "odm_precomp.h"
|
||||
/* ODM IO Relative API. */
|
||||
|
||||
u8 ODM_Read1Byte(struct odm_dm_struct *pDM_Odm, u32 RegAddr)
|
||||
{
|
||||
struct adapter *Adapter = pDM_Odm->Adapter;
|
||||
return rtw_read8(Adapter, RegAddr);
|
||||
}
|
||||
|
||||
u16 ODM_Read2Byte(struct odm_dm_struct *pDM_Odm, u32 RegAddr)
|
||||
{
|
||||
struct adapter *Adapter = pDM_Odm->Adapter;
|
||||
return rtw_read16(Adapter, RegAddr);
|
||||
}
|
||||
|
||||
u32 ODM_Read4Byte(struct odm_dm_struct *pDM_Odm, u32 RegAddr)
|
||||
{
|
||||
struct adapter *Adapter = pDM_Odm->Adapter;
|
||||
return rtw_read32(Adapter, RegAddr);
|
||||
}
|
||||
|
||||
void ODM_Write1Byte(struct odm_dm_struct *pDM_Odm, u32 RegAddr, u8 Data)
|
||||
{
|
||||
struct adapter *Adapter = pDM_Odm->Adapter;
|
||||
rtw_write8(Adapter, RegAddr, Data);
|
||||
}
|
||||
|
||||
void ODM_Write2Byte(struct odm_dm_struct *pDM_Odm, u32 RegAddr, u16 Data)
|
||||
{
|
||||
struct adapter *Adapter = pDM_Odm->Adapter;
|
||||
rtw_write16(Adapter, RegAddr, Data);
|
||||
}
|
||||
|
||||
void ODM_Write4Byte(struct odm_dm_struct *pDM_Odm, u32 RegAddr, u32 Data)
|
||||
{
|
||||
struct adapter *Adapter = pDM_Odm->Adapter;
|
||||
rtw_write32(Adapter, RegAddr, Data);
|
||||
}
|
||||
|
||||
void ODM_SetMACReg(struct odm_dm_struct *pDM_Odm, u32 RegAddr, u32 BitMask, u32 Data)
|
||||
{
|
||||
struct adapter *Adapter = pDM_Odm->Adapter;
|
||||
PHY_SetBBReg(Adapter, RegAddr, BitMask, Data);
|
||||
}
|
||||
|
||||
u32 ODM_GetMACReg(struct odm_dm_struct *pDM_Odm, u32 RegAddr, u32 BitMask)
|
||||
{
|
||||
struct adapter *Adapter = pDM_Odm->Adapter;
|
||||
return PHY_QueryBBReg(Adapter, RegAddr, BitMask);
|
||||
}
|
||||
|
||||
void ODM_SetBBReg(struct odm_dm_struct *pDM_Odm, u32 RegAddr, u32 BitMask, u32 Data)
|
||||
{
|
||||
struct adapter *Adapter = pDM_Odm->Adapter;
|
||||
PHY_SetBBReg(Adapter, RegAddr, BitMask, Data);
|
||||
}
|
||||
|
||||
u32 ODM_GetBBReg(struct odm_dm_struct *pDM_Odm, u32 RegAddr, u32 BitMask)
|
||||
{
|
||||
struct adapter *Adapter = pDM_Odm->Adapter;
|
||||
return PHY_QueryBBReg(Adapter, RegAddr, BitMask);
|
||||
}
|
||||
|
||||
void ODM_SetRFReg(struct odm_dm_struct *pDM_Odm, enum rf_radio_path eRFPath, u32 RegAddr, u32 BitMask, u32 Data)
|
||||
{
|
||||
struct adapter *Adapter = pDM_Odm->Adapter;
|
||||
PHY_SetRFReg(Adapter, (enum rf_radio_path)eRFPath, RegAddr, BitMask, Data);
|
||||
}
|
||||
|
||||
u32 ODM_GetRFReg(struct odm_dm_struct *pDM_Odm, enum rf_radio_path eRFPath, u32 RegAddr, u32 BitMask)
|
||||
{
|
||||
struct adapter *Adapter = pDM_Odm->Adapter;
|
||||
return PHY_QueryRFReg(Adapter, (enum rf_radio_path)eRFPath, RegAddr, BitMask);
|
||||
}
|
||||
|
||||
/* ODM Memory relative API. */
|
||||
void ODM_AllocateMemory(struct odm_dm_struct *pDM_Odm, void **pPtr, u32 length)
|
||||
{
|
||||
*pPtr = rtw_zvmalloc(length);
|
||||
}
|
||||
|
||||
/* length could be ignored, used to detect memory leakage. */
|
||||
void ODM_FreeMemory(struct odm_dm_struct *pDM_Odm, void *pPtr, u32 length)
|
||||
{
|
||||
rtw_vmfree(pPtr, length);
|
||||
}
|
||||
|
||||
s32 ODM_CompareMemory(struct odm_dm_struct *pDM_Odm, void *pBuf1, void *pBuf2, u32 length)
|
||||
{
|
||||
return !memcmp(pBuf1, pBuf2, length);
|
||||
}
|
||||
|
||||
/* ODM MISC relative API. */
|
||||
void ODM_AcquireSpinLock(struct odm_dm_struct *pDM_Odm, enum RT_SPINLOCK_TYPE type)
|
||||
{
|
||||
}
|
||||
|
||||
void ODM_ReleaseSpinLock(struct odm_dm_struct *pDM_Odm, enum RT_SPINLOCK_TYPE type)
|
||||
{
|
||||
}
|
||||
|
||||
/* Work item relative API. FOr MP driver only~! */
|
||||
void ODM_InitializeWorkItem(struct odm_dm_struct *pDM_Odm, void *pRtWorkItem,
|
||||
RT_WORKITEM_CALL_BACK RtWorkItemCallback,
|
||||
void *pContext, const char *szID)
|
||||
{
|
||||
}
|
||||
|
||||
void ODM_StartWorkItem(void *pRtWorkItem)
|
||||
{
|
||||
}
|
||||
|
||||
void ODM_StopWorkItem(void *pRtWorkItem)
|
||||
{
|
||||
}
|
||||
|
||||
void ODM_FreeWorkItem(void *pRtWorkItem)
|
||||
{
|
||||
}
|
||||
|
||||
void ODM_ScheduleWorkItem(void *pRtWorkItem)
|
||||
{
|
||||
}
|
||||
|
||||
void ODM_IsWorkItemScheduled(void *pRtWorkItem)
|
||||
{
|
||||
}
|
||||
|
||||
/* ODM Timer relative API. */
|
||||
void ODM_StallExecution(u32 usDelay)
|
||||
{
|
||||
rtw_udelay_os(usDelay);
|
||||
}
|
||||
|
||||
void ODM_delay_ms(u32 ms)
|
||||
{
|
||||
rtw_mdelay_os(ms);
|
||||
}
|
||||
|
||||
void ODM_delay_us(u32 us)
|
||||
{
|
||||
rtw_udelay_os(us);
|
||||
}
|
||||
|
||||
void ODM_sleep_ms(u32 ms)
|
||||
{
|
||||
rtw_msleep_os(ms);
|
||||
}
|
||||
|
||||
void ODM_sleep_us(u32 us)
|
||||
{
|
||||
rtw_usleep_os(us);
|
||||
}
|
||||
|
||||
void ODM_SetTimer(struct odm_dm_struct *pDM_Odm, struct timer_list *pTimer, u32 msDelay)
|
||||
{
|
||||
_set_timer(pTimer, msDelay); /* ms */
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
|
||||
void ODM_InitializeTimer(struct odm_dm_struct *pDM_Odm, struct timer_list *pTimer,
|
||||
void *CallBackFunc, void *pContext,
|
||||
const char *szID)
|
||||
{
|
||||
struct adapter *Adapter = pDM_Odm->Adapter;
|
||||
_init_timer(pTimer, Adapter->pnetdev, CallBackFunc, pDM_Odm);
|
||||
}
|
||||
#endif
|
||||
|
||||
void ODM_CancelTimer(struct odm_dm_struct *pDM_Odm, struct timer_list *pTimer)
|
||||
{
|
||||
_cancel_timer_ex(pTimer);
|
||||
}
|
||||
|
||||
void ODM_ReleaseTimer(struct odm_dm_struct *pDM_Odm, struct timer_list *pTimer)
|
||||
{
|
||||
}
|
||||
|
||||
/* ODM FW relative API. */
|
||||
u32 ODM_FillH2CCmd(u8 *pH2CBuffer, u32 H2CBufferLen, u32 CmdNum,
|
||||
u32 *pElementID, u32 *pCmdLen,
|
||||
u8 **pCmbBuffer, u8 *CmdStartSeq)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -1,205 +0,0 @@
|
||||
|
||||
_PHYDM_FILES :=\
|
||||
phydm/phydm.o \
|
||||
phydm/phydm_dig.o\
|
||||
phydm/phydm_antdiv.o\
|
||||
phydm/phydm_soml.o\
|
||||
phydm/phydm_smt_ant.o\
|
||||
phydm/phydm_pathdiv.o\
|
||||
phydm/phydm_rainfo.o\
|
||||
phydm/phydm_dynamictxpower.o\
|
||||
phydm/phydm_adaptivity.o\
|
||||
phydm/phydm_debug.o\
|
||||
phydm/phydm_interface.o\
|
||||
phydm/phydm_phystatus.o\
|
||||
phydm/phydm_hwconfig.o\
|
||||
phydm/phydm_dfs.o\
|
||||
phydm/phydm_cfotracking.o\
|
||||
phydm/phydm_adc_sampling.o\
|
||||
phydm/phydm_ccx.o\
|
||||
phydm/phydm_primary_cca.o\
|
||||
phydm/phydm_cck_pd.o\
|
||||
phydm/phydm_rssi_monitor.o\
|
||||
phydm/phydm_auto_dbg.o\
|
||||
phydm/phydm_math_lib.o\
|
||||
phydm/phydm_noisemonitor.o\
|
||||
phydm/phydm_api.o\
|
||||
phydm/phydm_pow_train.o\
|
||||
phydm/phydm_lna_sat.o\
|
||||
phydm/phydm_pmac_tx_setting.o\
|
||||
phydm/phydm_mp.o\
|
||||
phydm/txbf/phydm_hal_txbf_api.o\
|
||||
EdcaTurboCheck.o\
|
||||
phydm/halrf/halrf.o\
|
||||
phydm/halrf/halrf_debug.o\
|
||||
phydm/halrf/halphyrf_ap.o\
|
||||
phydm/halrf/halrf_powertracking_ap.o\
|
||||
phydm/halrf/halrf_powertracking.o\
|
||||
phydm/halrf/halrf_kfree.o
|
||||
|
||||
ifeq ($(CONFIG_RTL_88E_SUPPORT),y)
|
||||
ifeq ($(CONFIG_RTL_ODM_WLAN_DRIVER),y)
|
||||
_PHYDM_FILES += \
|
||||
phydm/rtl8188e/halhwimg8188e_bb.o\
|
||||
phydm/rtl8188e/halhwimg8188e_mac.o\
|
||||
phydm/rtl8188e/halhwimg8188e_rf.o\
|
||||
phydm/rtl8188e/phydm_regconfig8188e.o\
|
||||
phydm/rtl8188e/hal8188erateadaptive.o\
|
||||
phydm/rtl8188e/phydm_rtl8188e.o\
|
||||
phydm/halrf/rtl8188e/halrf_8188e_ap.o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RTL_8812_SUPPORT),y)
|
||||
ifeq ($(CONFIG_RTL_ODM_WLAN_DRIVER),y)
|
||||
_PHYDM_FILES += ./phydm/halrf/rtl8812a/halrf_8812a_ap.o
|
||||
endif
|
||||
_PHYDM_FILES += phydm/rtl8812a/phydm_rtl8812a.o
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_WLAN_HAL_8881A),y)
|
||||
_PHYDM_FILES += phydm/halrf/rtl8821a/halrf_iqk_8821a_ap.o
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_WLAN_HAL_8192EE),y)
|
||||
_PHYDM_FILES += \
|
||||
phydm/halrf/rtl8192e/halrf_8192e_ap.o\
|
||||
phydm/rtl8192e/phydm_rtl8192e.o
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_WLAN_HAL_8814AE),y)
|
||||
rtl8192cd-objs += phydm/halrf/rtl8814a/halrf_8814a_ap.o
|
||||
rtl8192cd-objs += phydm/halrf/rtl8814a/halrf_iqk_8814a.o
|
||||
ifeq ($(CONFIG_RTL_ODM_WLAN_DRIVER),y)
|
||||
rtl8192cd-objs += \
|
||||
phydm/rtl8814a/halhwimg8814a_bb.o\
|
||||
phydm/rtl8814a/halhwimg8814a_mac.o\
|
||||
phydm/rtl8814a/halhwimg8814a_rf.o\
|
||||
phydm/rtl8814a/phydm_regconfig8814a.o\
|
||||
phydm/rtl8814a/phydm_rtl8814a.o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_WLAN_HAL_8822BE),y)
|
||||
_PHYDM_FILES += phydm/halrf/rtl8822b/halrf_8822b.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8822b/halrf_iqk_8822b.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8822b/halhwimg8822b_rf.o
|
||||
ifeq ($(CONFIG_RTL_ODM_WLAN_DRIVER),y)
|
||||
_PHYDM_FILES += \
|
||||
phydm/rtl8822b/halhwimg8822b_bb.o\
|
||||
phydm/rtl8822b/halhwimg8822b_mac.o\
|
||||
phydm/rtl8822b/phydm_regconfig8822b.o\
|
||||
phydm/rtl8822b/phydm_hal_api8822b.o\
|
||||
phydm/rtl8822b/phydm_rtl8822b.o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_WLAN_HAL_8822CE),y)
|
||||
_PHYDM_FILES += phydm/halrf/rtl8822c/halrf_8822c.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8822c/halrf_iqk_8822c.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8822c/halrf_dpk_8822c.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8822c/halrf_rfk_init_8822c.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8822c/halhwimg8822c_rf.o
|
||||
ifeq ($(CONFIG_RTL_ODM_WLAN_DRIVER),y)
|
||||
_PHYDM_FILES += \
|
||||
phydm/rtl8822c/halhwimg8822c_bb.o\
|
||||
phydm/rtl8822c/halhwimg8822c_mac.o\
|
||||
phydm/rtl8822c/phydm_regconfig8822c.o\
|
||||
phydm/rtl8822c/phydm_hal_api8822c.o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_WLAN_HAL_8812FE),y)
|
||||
_PHYDM_FILES += phydm/halrf/rtl8812f/halrf_8812f.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8812f/halrf_iqk_8812f.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8812f/halrf_dpk_8812f.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8812f/halrf_tssi_8812f.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8812f/halrf_rfk_init_8812f.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8812f/halhwimg8812f_rf.o
|
||||
ifeq ($(CONFIG_RTL_ODM_WLAN_DRIVER),y)
|
||||
_PHYDM_FILES += \
|
||||
phydm/rtl8812f/halhwimg8812f_bb.o\
|
||||
phydm/rtl8812f/halhwimg8812f_mac.o\
|
||||
phydm/rtl8812f/phydm_regconfig8812f.o\
|
||||
phydm/rtl8812f/phydm_hal_api8812f.o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_WLAN_HAL_8821CE),y)
|
||||
_PHYDM_FILES += phydm/halrf/rtl8821c/halrf_8821c.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8821c/halrf_iqk_8821c.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8821c/halhwimg8821c_rf.o
|
||||
ifeq ($(CONFIG_RTL_ODM_WLAN_DRIVER),y)
|
||||
_PHYDM_FILES += \
|
||||
phydm/rtl8821c/halhwimg8821c_bb.o\
|
||||
phydm/rtl8821c/halhwimg8821c_mac.o\
|
||||
phydm/rtl8821c/phydm_regconfig8821c.o\
|
||||
phydm/rtl8821c/phydm_hal_api8821c.o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_WLAN_HAL_8197F),y)
|
||||
_PHYDM_FILES += phydm/halrf/rtl8197f/halrf_8197f.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8197f/halrf_iqk_8197f.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8197f/halrf_dpk_8197f.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8197f/halhwimg8197f_rf.o
|
||||
_PHYDM_FILES += efuse_97f/efuse.o
|
||||
ifeq ($(CONFIG_RTL_ODM_WLAN_DRIVER),y)
|
||||
_PHYDM_FILES += \
|
||||
phydm/rtl8197f/halhwimg8197f_bb.o\
|
||||
phydm/rtl8197f/halhwimg8197f_mac.o\
|
||||
phydm/rtl8197f/phydm_hal_api8197f.o\
|
||||
phydm/rtl8197f/phydm_regconfig8197f.o\
|
||||
phydm/rtl8197f/phydm_rtl8197f.o
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(CONFIG_WLAN_HAL_8192FE),y)
|
||||
_PHYDM_FILES += phydm/halrf/rtl8192f/halrf_8192f.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8192f/halrf_dpk_8192f.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8192f/halhwimg8192f_rf.o
|
||||
ifeq ($(CONFIG_RTL_ODM_WLAN_DRIVER),y)
|
||||
_PHYDM_FILES += \
|
||||
phydm/rtl8192f/halhwimg8192f_bb.o\
|
||||
phydm/rtl8192f/halhwimg8192f_mac.o\
|
||||
phydm/rtl8192f/phydm_hal_api8192f.o\
|
||||
phydm/rtl8192f/phydm_regconfig8192f.o\
|
||||
phydm/rtl8192f/phydm_rtl8192f.o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_WLAN_HAL_8198F),y)
|
||||
_PHYDM_FILES += phydm/halrf/rtl8198f/halrf_8198f.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8198f/halrf_iqk_8198f.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8198f/halrf_dpk_8198f.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8198f/halrf_rfk_init_8198f.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8198f/halhwimg8198f_rf.o
|
||||
ifeq ($(CONFIG_RTL_ODM_WLAN_DRIVER),y)
|
||||
_PHYDM_FILES += \
|
||||
phydm/rtl8198f/phydm_hal_api8198f.o\
|
||||
phydm/rtl8198f/halhwimg8198f_bb.o\
|
||||
phydm/rtl8198f/halhwimg8198f_mac.o\
|
||||
phydm/rtl8198f/phydm_regconfig8198f.o \
|
||||
phydm/halrf/rtl8198f/halrf_8198f.o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_WLAN_HAL_8814BE),y)
|
||||
_PHYDM_FILES += phydm/halrf/rtl8814b/halrf_8814b.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8814b/halrf_iqk_8814b.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8814b/halrf_dpk_8814b.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8814b/halrf_rfk_init_8814b.o
|
||||
_PHYDM_FILES += phydm/halrf/rtl8814b/halhwimg8814b_rf.o
|
||||
ifeq ($(CONFIG_RTL_ODM_WLAN_DRIVER),y)
|
||||
_PHYDM_FILES += \
|
||||
phydm/rtl8814b/phydm_hal_api8814b.o\
|
||||
phydm/rtl8814b/halhwimg8814b_bb.o\
|
||||
phydm/rtl8814b/halhwimg8814b_mac.o\
|
||||
phydm/rtl8814b/phydm_regconfig8814b.o \
|
||||
phydm/halrf/rtl8814b/halrf_8814b.o
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2016 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#pragma once
|
||||
#ifndef __INC_HW_IMG_H
|
||||
#define __INC_HW_IMG_H
|
||||
|
||||
/*@
|
||||
* 2011/03/15 MH Add for different IC HW image file selection. code size consideration.
|
||||
* */
|
||||
#if RT_PLATFORM == PLATFORM_LINUX
|
||||
|
||||
#if (DEV_BUS_TYPE == RT_PCI_INTERFACE)
|
||||
/* @For 92C */
|
||||
#define RTL8192CE_HWIMG_SUPPORT 1
|
||||
#define RTL8192CE_TEST_HWIMG_SUPPORT 0
|
||||
#define RTL8192CU_HWIMG_SUPPORT 0
|
||||
#define RTL8192CU_TEST_HWIMG_SUPPORT 0
|
||||
|
||||
/* @For 92D */
|
||||
#define RTL8192DE_HWIMG_SUPPORT 1
|
||||
#define RTL8192DE_TEST_HWIMG_SUPPORT 0
|
||||
#define RTL8192DU_HWIMG_SUPPORT 0
|
||||
#define RTL8192DU_TEST_HWIMG_SUPPORT 0
|
||||
|
||||
/* @For 8723 */
|
||||
#define RTL8723E_HWIMG_SUPPORT 1
|
||||
#define RTL8723U_HWIMG_SUPPORT 0
|
||||
#define RTL8723S_HWIMG_SUPPORT 0
|
||||
|
||||
/* @For 88E */
|
||||
#define RTL8188EE_HWIMG_SUPPORT 0
|
||||
#define RTL8188EU_HWIMG_SUPPORT 0
|
||||
#define RTL8188ES_HWIMG_SUPPORT 0
|
||||
|
||||
#elif (DEV_BUS_TYPE == RT_USB_INTERFACE)
|
||||
/* @For 92C */
|
||||
#define RTL8192CE_HWIMG_SUPPORT 0
|
||||
#define RTL8192CE_TEST_HWIMG_SUPPORT 0
|
||||
#define RTL8192CU_HWIMG_SUPPORT 1
|
||||
#define RTL8192CU_TEST_HWIMG_SUPPORT 0
|
||||
|
||||
/* @For 92D */
|
||||
#define RTL8192DE_HWIMG_SUPPORT 0
|
||||
#define RTL8192DE_TEST_HWIMG_SUPPORT 0
|
||||
#define RTL8192DU_HWIMG_SUPPORT 1
|
||||
#define RTL8192DU_TEST_HWIMG_SUPPORT 0
|
||||
|
||||
/* @For 8723 */
|
||||
#define RTL8723E_HWIMG_SUPPORT 0
|
||||
#define RTL8723U_HWIMG_SUPPORT 1
|
||||
#define RTL8723S_HWIMG_SUPPORT 0
|
||||
|
||||
/* @For 88E */
|
||||
#define RTL8188EE_HWIMG_SUPPORT 0
|
||||
#define RTL8188EU_HWIMG_SUPPORT 0
|
||||
#define RTL8188ES_HWIMG_SUPPORT 0
|
||||
|
||||
#elif (DEV_BUS_TYPE == RT_SDIO_INTERFACE)
|
||||
/* @For 92C */
|
||||
#define RTL8192CE_HWIMG_SUPPORT 0
|
||||
#define RTL8192CE_TEST_HWIMG_SUPPORT 0
|
||||
#define RTL8192CU_HWIMG_SUPPORT 1
|
||||
#define RTL8192CU_TEST_HWIMG_SUPPORT 0
|
||||
|
||||
/* @For 92D */
|
||||
#define RTL8192DE_HWIMG_SUPPORT 0
|
||||
#define RTL8192DE_TEST_HWIMG_SUPPORT 0
|
||||
#define RTL8192DU_HWIMG_SUPPORT 1
|
||||
#define RTL8192DU_TEST_HWIMG_SUPPORT 0
|
||||
|
||||
/* @For 8723 */
|
||||
#define RTL8723E_HWIMG_SUPPORT 0
|
||||
#define RTL8723U_HWIMG_SUPPORT 0
|
||||
#define RTL8723S_HWIMG_SUPPORT 1
|
||||
|
||||
/* @For 88E */
|
||||
#define RTL8188EE_HWIMG_SUPPORT 0
|
||||
#define RTL8188EU_HWIMG_SUPPORT 0
|
||||
#define RTL8188ES_HWIMG_SUPPORT 0
|
||||
#endif
|
||||
|
||||
#else /* PLATFORM_WINDOWS & MacOSX */
|
||||
|
||||
/* @For 92C */
|
||||
#define RTL8192CE_HWIMG_SUPPORT 1
|
||||
#define RTL8192CE_TEST_HWIMG_SUPPORT 1
|
||||
#define RTL8192CU_HWIMG_SUPPORT 1
|
||||
#define RTL8192CU_TEST_HWIMG_SUPPORT 1
|
||||
|
||||
/* @For 92D */
|
||||
#define RTL8192DE_HWIMG_SUPPORT 1
|
||||
#define RTL8192DE_TEST_HWIMG_SUPPORT 1
|
||||
#define RTL8192DU_HWIMG_SUPPORT 1
|
||||
#define RTL8192DU_TEST_HWIMG_SUPPORT 1
|
||||
|
||||
#if defined(UNDER_CE)
|
||||
/* @For 8723 */
|
||||
#define RTL8723E_HWIMG_SUPPORT 0
|
||||
#define RTL8723U_HWIMG_SUPPORT 0
|
||||
#define RTL8723S_HWIMG_SUPPORT 1
|
||||
|
||||
/* @For 88E */
|
||||
#define RTL8188EE_HWIMG_SUPPORT 0
|
||||
#define RTL8188EU_HWIMG_SUPPORT 0
|
||||
#define RTL8188ES_HWIMG_SUPPORT 0
|
||||
|
||||
#else
|
||||
|
||||
/* @For 8723 */
|
||||
#define RTL8723E_HWIMG_SUPPORT 1
|
||||
/* @#define RTL_8723E_TEST_HWIMG_SUPPORT 1 */
|
||||
#define RTL8723U_HWIMG_SUPPORT 1
|
||||
/* @#define RTL_8723U_TEST_HWIMG_SUPPORT 1 */
|
||||
#define RTL8723S_HWIMG_SUPPORT 1
|
||||
/* @#define RTL_8723S_TEST_HWIMG_SUPPORT 1 */
|
||||
|
||||
/* @For 88E */
|
||||
#define RTL8188EE_HWIMG_SUPPORT 1
|
||||
#define RTL8188EU_HWIMG_SUPPORT 1
|
||||
#define RTL8188ES_HWIMG_SUPPORT 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* @__INC_HW_IMG_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,161 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __HALPHYRF_H__
|
||||
#define __HALPHYRF_H__
|
||||
|
||||
#include "halrf/halrf_powertracking_ap.h"
|
||||
#include "halrf/halrf_kfree.h"
|
||||
|
||||
#if (RTL8814A_SUPPORT == 1)
|
||||
#include "halrf/rtl8814a/halrf_iqk_8814a.h"
|
||||
#endif
|
||||
|
||||
#if (RTL8822B_SUPPORT == 1)
|
||||
#include "halrf/rtl8822b/halrf_iqk_8822b.h"
|
||||
#endif
|
||||
|
||||
#if (RTL8821C_SUPPORT == 1)
|
||||
#include "halrf/rtl8821c/halrf_iqk_8821c.h"
|
||||
#endif
|
||||
|
||||
#if (RTL8195B_SUPPORT == 1)
|
||||
// #include "halrf/rtl8195b/halrf.h"
|
||||
#include "halrf/rtl8195b/halrf_iqk_8195b.h"
|
||||
#include "halrf/rtl8195b/halrf_txgapk_8195b.h"
|
||||
#include "halrf/rtl8195b/halrf_dpk_8195b.h"
|
||||
#endif
|
||||
|
||||
#if (RTL8198F_SUPPORT == 1)
|
||||
#include "halrf/rtl8198f/halrf_iqk_8198f.h"
|
||||
#include "halrf/rtl8198f/halrf_dpk_8198f.h"
|
||||
#endif
|
||||
|
||||
#if (RTL8812F_SUPPORT == 1)
|
||||
#include "halrf/rtl8812f/halrf_iqk_8812f.h"
|
||||
#include "halrf/rtl8812f/halrf_dpk_8812f.h"
|
||||
#include "halrf/rtl8812f/halrf_tssi_8812f.h"
|
||||
#endif
|
||||
|
||||
#if (RTL8814B_SUPPORT == 1)
|
||||
#include "halrf/rtl8814b/halrf_iqk_8814b.h"
|
||||
#include "halrf/rtl8814b/halrf_dpk_8814b.h"
|
||||
#endif
|
||||
|
||||
enum pwrtrack_method {
|
||||
BBSWING,
|
||||
TXAGC,
|
||||
MIX_MODE,
|
||||
TSSI_MODE,
|
||||
MIX_2G_TSSI_5G_MODE,
|
||||
MIX_5G_TSSI_2G_MODE,
|
||||
CLEAN_MODE
|
||||
};
|
||||
|
||||
typedef void (*func_set_pwr)(void *, enum pwrtrack_method, u8, u8);
|
||||
typedef void(*func_iqk)(void *, u8, u8, u8);
|
||||
typedef void (*func_lck)(void *);
|
||||
/* refine by YuChen for 8814A */
|
||||
typedef void (*func_swing)(void *, u8 **, u8 **, u8 **, u8 **);
|
||||
typedef void (*func_swing8814only)(void *, u8 **, u8 **, u8 **, u8 **);
|
||||
typedef void (*func_all_swing)(void *, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **);
|
||||
typedef void (*func_all_swing_ex)(void *, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **);
|
||||
|
||||
struct txpwrtrack_cfg {
|
||||
u8 swing_table_size_cck;
|
||||
u8 swing_table_size_ofdm;
|
||||
u8 threshold_iqk;
|
||||
u8 threshold_dpk;
|
||||
u8 average_thermal_num;
|
||||
u8 rf_path_count;
|
||||
u32 thermal_reg_addr;
|
||||
func_set_pwr odm_tx_pwr_track_set_pwr;
|
||||
func_iqk do_iqk;
|
||||
func_lck phy_lc_calibrate;
|
||||
func_swing get_delta_swing_table;
|
||||
func_swing8814only get_delta_swing_table8814only;
|
||||
func_all_swing get_delta_all_swing_table;
|
||||
func_all_swing_ex get_delta_all_swing_table_ex;
|
||||
};
|
||||
|
||||
void
|
||||
odm_clear_txpowertracking_state(
|
||||
void *dm_void
|
||||
);
|
||||
|
||||
void
|
||||
configure_txpower_track(
|
||||
void *dm_void,
|
||||
struct txpwrtrack_cfg *config
|
||||
);
|
||||
|
||||
|
||||
void
|
||||
odm_txpowertracking_callback_thermal_meter(
|
||||
void *dm_void
|
||||
);
|
||||
|
||||
#if (RTL8192E_SUPPORT == 1)
|
||||
void
|
||||
odm_txpowertracking_callback_thermal_meter_92e(
|
||||
void *dm_void
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (RTL8814A_SUPPORT == 1)
|
||||
void
|
||||
odm_txpowertracking_callback_thermal_meter_jaguar_series2(
|
||||
void *dm_void
|
||||
);
|
||||
|
||||
#elif ODM_IC_11AC_SERIES_SUPPORT
|
||||
void
|
||||
odm_txpowertracking_callback_thermal_meter_jaguar_series(
|
||||
void *dm_void
|
||||
);
|
||||
|
||||
#elif (RTL8197F_SUPPORT == 1 || RTL8192F_SUPPORT == 1 || RTL8822B_SUPPORT == 1 ||\
|
||||
RTL8821C_SUPPORT == 1 || RTL8198F_SUPPORT == 1)
|
||||
void
|
||||
odm_txpowertracking_callback_thermal_meter_jaguar_series3(
|
||||
void *dm_void
|
||||
);
|
||||
|
||||
#elif (RTL8814B_SUPPORT == 1)
|
||||
void
|
||||
odm_txpowertracking_callback_thermal_meter_jaguar_series4(
|
||||
void *dm_void
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
#define IS_CCK_RATE(_rate) (ODM_MGN_1M == _rate || _rate == ODM_MGN_2M || _rate == ODM_MGN_5_5M || _rate == ODM_MGN_11M)
|
||||
|
||||
#define ODM_TARGET_CHNL_NUM_2G_5G 59
|
||||
|
||||
|
||||
void
|
||||
odm_reset_iqk_result(
|
||||
void *dm_void
|
||||
);
|
||||
u8
|
||||
odm_get_right_chnl_place_for_iqk(
|
||||
u8 chnl
|
||||
);
|
||||
|
||||
void phydm_rf_init(void *dm_void);
|
||||
void phydm_rf_watchdog(void *dm_void);
|
||||
|
||||
#endif /*#ifndef __HALPHYRF_H__*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,120 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution in the
|
||||
* file called LICENSE.
|
||||
*
|
||||
* Contact Information:
|
||||
* wlanfae <wlanfae@realtek.com>
|
||||
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
|
||||
* Hsinchu 300, Taiwan.
|
||||
*
|
||||
* Larry Finger <Larry.Finger@lwfinger.net>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __HALPHYRF_H__
|
||||
#define __HALPHYRF_H__
|
||||
|
||||
#include "halrf/halrf_kfree.h"
|
||||
#if (RTL8814A_SUPPORT == 1)
|
||||
#include "halrf/rtl8814a/halrf_iqk_8814a.h"
|
||||
#endif
|
||||
|
||||
#if (RTL8822B_SUPPORT == 1)
|
||||
#include "halrf/rtl8822b/halrf_iqk_8822b.h"
|
||||
#endif
|
||||
|
||||
#if (RTL8821C_SUPPORT == 1)
|
||||
#include "halrf/rtl8821c/halrf_iqk_8821c.h"
|
||||
#endif
|
||||
|
||||
#if (RTL8195B_SUPPORT == 1)
|
||||
/* #include "halrf/rtl8195b/halrf.h" */
|
||||
#include "halrf/rtl8195b/halrf_iqk_8195b.h"
|
||||
#include "halrf/rtl8195b/halrf_txgapk_8195b.h"
|
||||
#include "halrf/rtl8195b/halrf_dpk_8195b.h"
|
||||
#endif
|
||||
|
||||
#if (RTL8814B_SUPPORT == 1)
|
||||
#include "halrf/rtl8814b/halrf_iqk_8814b.h"
|
||||
#include "halrf/rtl8814b/halrf_dpk_8814b.h"
|
||||
#endif
|
||||
|
||||
#include "halrf/halrf_powertracking_ce.h"
|
||||
|
||||
enum spur_cal_method {
|
||||
PLL_RESET,
|
||||
AFE_PHASE_SEL
|
||||
};
|
||||
|
||||
enum pwrtrack_method {
|
||||
BBSWING,
|
||||
TXAGC,
|
||||
MIX_MODE,
|
||||
TSSI_MODE,
|
||||
MIX_2G_TSSI_5G_MODE,
|
||||
MIX_5G_TSSI_2G_MODE,
|
||||
CLEAN_MODE
|
||||
};
|
||||
|
||||
typedef void (*func_set_pwr)(void *, enum pwrtrack_method, u8, u8);
|
||||
typedef void (*func_iqk)(void *, u8, u8, u8);
|
||||
typedef void (*func_lck)(void *);
|
||||
typedef void (*func_swing)(void *, u8 **, u8 **, u8 **, u8 **);
|
||||
typedef void (*func_swing8814only)(void *, u8 **, u8 **, u8 **, u8 **);
|
||||
typedef void (*func_swing_xtal)(void *, s8 **, s8 **);
|
||||
typedef void (*func_set_xtal)(void *);
|
||||
|
||||
struct txpwrtrack_cfg {
|
||||
u8 swing_table_size_cck;
|
||||
u8 swing_table_size_ofdm;
|
||||
u8 threshold_iqk;
|
||||
u8 threshold_dpk;
|
||||
u8 average_thermal_num;
|
||||
u8 rf_path_count;
|
||||
u32 thermal_reg_addr;
|
||||
func_set_pwr odm_tx_pwr_track_set_pwr;
|
||||
func_iqk do_iqk;
|
||||
func_lck phy_lc_calibrate;
|
||||
func_swing get_delta_swing_table;
|
||||
func_swing8814only get_delta_swing_table8814only;
|
||||
func_swing_xtal get_delta_swing_xtal_table;
|
||||
func_set_xtal odm_txxtaltrack_set_xtal;
|
||||
};
|
||||
|
||||
void configure_txpower_track(void *dm_void, struct txpwrtrack_cfg *config);
|
||||
|
||||
void odm_clear_txpowertracking_state(void *dm_void);
|
||||
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
void odm_txpowertracking_callback_thermal_meter(void *dm_void);
|
||||
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
||||
void odm_txpowertracking_callback_thermal_meter(void *dm);
|
||||
#else
|
||||
void odm_txpowertracking_callback_thermal_meter(void *adapter);
|
||||
#endif
|
||||
|
||||
#if (RTL8822C_SUPPORT == 1)
|
||||
void odm_txpowertracking_new_callback_thermal_meter(void *dm_void);
|
||||
#endif
|
||||
|
||||
#define ODM_TARGET_CHNL_NUM_2G_5G 59
|
||||
|
||||
void odm_reset_iqk_result(void *dm_void);
|
||||
u8 odm_get_right_chnl_place_for_iqk(u8 chnl);
|
||||
|
||||
void phydm_rf_init(void *dm_void);
|
||||
void phydm_rf_watchdog(void *dm_void);
|
||||
|
||||
#endif /*__HALPHYRF_H__*/
|
||||
@@ -1,617 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution in the
|
||||
* file called LICENSE.
|
||||
*
|
||||
* Contact Information:
|
||||
* wlanfae <wlanfae@realtek.com>
|
||||
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
|
||||
* Hsinchu 300, Taiwan.
|
||||
*
|
||||
* Larry Finger <Larry.Finger@lwfinger.net>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include "mp_precomp.h"
|
||||
#include "phydm_precomp.h"
|
||||
|
||||
#define CALCULATE_SWINGTALBE_OFFSET(_offset, _direction, _size, _delta_thermal) \
|
||||
do {\
|
||||
for (_offset = 0; _offset < _size; _offset++) { \
|
||||
if (_delta_thermal < thermal_threshold[_direction][_offset]) { \
|
||||
if (_offset != 0)\
|
||||
_offset--;\
|
||||
break;\
|
||||
} \
|
||||
} \
|
||||
if (_offset >= _size)\
|
||||
_offset = _size-1;\
|
||||
} while (0)
|
||||
|
||||
void configure_txpower_track(
|
||||
void *dm_void,
|
||||
struct txpwrtrack_cfg *config
|
||||
)
|
||||
{
|
||||
struct dm_struct *dm = (struct dm_struct *)dm_void;
|
||||
#if RTL8195B_SUPPORT
|
||||
if (dm->support_ic_type == ODM_RTL8195B)
|
||||
configure_txpower_track_8195b(config);
|
||||
#endif
|
||||
#if RTL8710C_SUPPORT
|
||||
if (dm->support_ic_type == ODM_RTL8710C)
|
||||
configure_txpower_track_8710c(config);
|
||||
#endif
|
||||
#if RTL8721D_SUPPORT
|
||||
if (dm->support_ic_type == ODM_RTL8721D)
|
||||
configure_txpower_track_8721d(config);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/* **********************************************************************
|
||||
* <20121113, Kordan> This function should be called when tx_agc changed.
|
||||
* Otherwise the previous compensation is gone, because we record the
|
||||
* delta of temperature between two TxPowerTracking watch dogs.
|
||||
*
|
||||
* NOTE: If Tx BB swing or Tx scaling is varified during run-time, still
|
||||
* need to call this function.
|
||||
* ********************************************************************** */
|
||||
void
|
||||
odm_clear_txpowertracking_state(
|
||||
void *dm_void
|
||||
)
|
||||
{
|
||||
struct dm_struct *dm = (struct dm_struct *)dm_void;
|
||||
struct _hal_rf_ *rf = &dm->rf_table;
|
||||
u8 p = 0;
|
||||
struct dm_rf_calibration_struct *cali_info = &dm->rf_calibrate_info;
|
||||
|
||||
cali_info->bb_swing_idx_cck_base = cali_info->default_cck_index;
|
||||
cali_info->bb_swing_idx_cck = cali_info->default_cck_index;
|
||||
dm->rf_calibrate_info.CCK_index = 0;
|
||||
|
||||
for (p = RF_PATH_A; p < MAX_RF_PATH; ++p) {
|
||||
cali_info->bb_swing_idx_ofdm_base[p] = cali_info->default_ofdm_index;
|
||||
cali_info->bb_swing_idx_ofdm[p] = cali_info->default_ofdm_index;
|
||||
cali_info->OFDM_index[p] = cali_info->default_ofdm_index;
|
||||
|
||||
cali_info->power_index_offset[p] = 0;
|
||||
cali_info->delta_power_index[p] = 0;
|
||||
cali_info->delta_power_index_last[p] = 0;
|
||||
|
||||
cali_info->absolute_ofdm_swing_idx[p] = 0;
|
||||
cali_info->remnant_ofdm_swing_idx[p] = 0;
|
||||
cali_info->kfree_offset[p] = 0;
|
||||
}
|
||||
|
||||
cali_info->modify_tx_agc_flag_path_a = false;
|
||||
cali_info->modify_tx_agc_flag_path_b = false;
|
||||
cali_info->modify_tx_agc_flag_path_c = false;
|
||||
cali_info->modify_tx_agc_flag_path_d = false;
|
||||
cali_info->remnant_cck_swing_idx = 0;
|
||||
cali_info->thermal_value = rf->eeprom_thermal;
|
||||
cali_info->modify_tx_agc_value_cck = 0;
|
||||
cali_info->modify_tx_agc_value_ofdm = 0;
|
||||
}
|
||||
|
||||
void
|
||||
odm_txpowertracking_callback_thermal_meter(
|
||||
void *dm_void
|
||||
)
|
||||
{
|
||||
struct dm_struct *dm = (struct dm_struct *)dm_void;
|
||||
struct _hal_rf_ *rf = &dm->rf_table;
|
||||
struct dm_rf_calibration_struct *cali_info = &dm->rf_calibrate_info;
|
||||
struct dm_iqk_info *iqk_info = &dm->IQK_info;
|
||||
|
||||
u8 thermal_value = 0, delta, delta_LCK, delta_IQK, p = 0, i = 0;
|
||||
u8 thermal_value_avg_count = 0;
|
||||
u32 thermal_value_avg = 0, regc80, regcd0, regcd4, regab4;
|
||||
|
||||
u8 OFDM_min_index = 0; /* OFDM BB Swing should be less than +3.0dB, which is required by Arthur */
|
||||
u8 indexforchannel = 0; /* get_right_chnl_place_for_iqk(hal_data->current_channel) */
|
||||
u8 power_tracking_type = rf->pwt_type;
|
||||
u8 xtal_offset_eanble = 0;
|
||||
s8 thermal_value_temp = 0;
|
||||
|
||||
struct txpwrtrack_cfg c = {0};
|
||||
|
||||
/* 4 1. The following TWO tables decide the final index of OFDM/CCK swing table. */
|
||||
u8 *delta_swing_table_idx_tup_a = NULL;
|
||||
u8 *delta_swing_table_idx_tdown_a = NULL;
|
||||
u8 *delta_swing_table_idx_tup_b = NULL;
|
||||
u8 *delta_swing_table_idx_tdown_b = NULL;
|
||||
#if (RTL8721D_SUPPORT == 1)
|
||||
u8 *delta_swing_table_idx_tup_a_cck = NULL;
|
||||
u8 *delta_swing_table_idx_tdown_a_cck = NULL;
|
||||
u8 *delta_swing_table_idx_tup_b_cck = NULL;
|
||||
u8 *delta_swing_table_idx_tdown_b_cck = NULL;
|
||||
#endif
|
||||
/*for Xtal Offset by James.Tung*/
|
||||
s8 *delta_swing_table_xtal_up = NULL;
|
||||
s8 *delta_swing_table_xtal_down = NULL;
|
||||
|
||||
/* 4 2. Initialization ( 7 steps in total ) */
|
||||
|
||||
configure_txpower_track(dm, &c);
|
||||
#if (RTL8721D_SUPPORT == 1)
|
||||
(*c.get_delta_swing_table)(dm, (u8 **)&delta_swing_table_idx_tup_a, (u8 **)&delta_swing_table_idx_tdown_a,
|
||||
(u8 **)&delta_swing_table_idx_tup_b, (u8 **)&delta_swing_table_idx_tdown_b,
|
||||
(u8 **)&delta_swing_table_idx_tup_a_cck, (u8 **)&delta_swing_table_idx_tdown_a_cck,
|
||||
(u8 **)&delta_swing_table_idx_tup_b_cck, (u8 **)&delta_swing_table_idx_tdown_b_cck);
|
||||
#else
|
||||
(*c.get_delta_swing_table)(dm, (u8 **)&delta_swing_table_idx_tup_a, (u8 **)&delta_swing_table_idx_tdown_a,
|
||||
(u8 **)&delta_swing_table_idx_tup_b, (u8 **)&delta_swing_table_idx_tdown_b);
|
||||
#endif
|
||||
|
||||
/*for Xtal Offset*/
|
||||
if (dm->support_ic_type == ODM_RTL8195B ||
|
||||
dm->support_ic_type == ODM_RTL8721D)
|
||||
(*c.get_delta_swing_xtal_table)(dm,
|
||||
(s8 **)&delta_swing_table_xtal_up,
|
||||
(s8 **)&delta_swing_table_xtal_down);
|
||||
|
||||
cali_info->txpowertracking_callback_cnt++; /*cosa add for debug*/
|
||||
cali_info->is_txpowertracking_init = true;
|
||||
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"===>odm_txpowertracking_callback_thermal_meter\n cali_info->bb_swing_idx_cck_base: %d, cali_info->bb_swing_idx_ofdm_base[A]: %d, cali_info->default_ofdm_index: %d\n",
|
||||
cali_info->bb_swing_idx_cck_base,
|
||||
cali_info->bb_swing_idx_ofdm_base[RF_PATH_A],
|
||||
cali_info->default_ofdm_index);
|
||||
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"cali_info->txpowertrack_control = %d, hal_data->eeprom_thermal_meter %d\n",
|
||||
cali_info->txpowertrack_control, rf->eeprom_thermal);
|
||||
|
||||
if (dm->support_ic_type == ODM_RTL8721D)
|
||||
thermal_value = (u8)odm_get_rf_reg(dm, RF_PATH_A,
|
||||
c.thermal_reg_addr, 0x7e0);
|
||||
/* 0x42: RF Reg[10:5] 8721D */
|
||||
else
|
||||
thermal_value = (u8)odm_get_rf_reg(dm, RF_PATH_A,
|
||||
c.thermal_reg_addr, 0xfc00);
|
||||
/* 0x42: RF Reg[15:10] 88E */
|
||||
|
||||
thermal_value_temp = thermal_value + phydm_get_thermal_offset(dm);
|
||||
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"thermal_value_temp(%d) = thermal_value(%d) + power_trim_thermal(%d)\n", thermal_value_temp, thermal_value, phydm_get_thermal_offset(dm));
|
||||
|
||||
if (thermal_value_temp > 63)
|
||||
thermal_value = 63;
|
||||
else if (thermal_value_temp < 0)
|
||||
thermal_value = 0;
|
||||
else
|
||||
thermal_value = thermal_value_temp;
|
||||
|
||||
if (!cali_info->txpowertrack_control)
|
||||
return;
|
||||
|
||||
if (rf->eeprom_thermal == 0xff) {
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK, "no pg, hal_data->eeprom_thermal_meter = 0x%x\n", rf->eeprom_thermal);
|
||||
return;
|
||||
}
|
||||
#if 0
|
||||
/*4 3. Initialize ThermalValues of rf_calibrate_info*/
|
||||
//if (cali_info->is_reloadtxpowerindex)
|
||||
// RF_DBG(dm, DBG_RF_TX_PWR_TRACK, "reload ofdm index for band switch\n");
|
||||
#endif
|
||||
/*4 4. Calculate average thermal meter*/
|
||||
|
||||
cali_info->thermal_value_avg[cali_info->thermal_value_avg_index] = thermal_value;
|
||||
cali_info->thermal_value_avg_index++;
|
||||
if (cali_info->thermal_value_avg_index == c.average_thermal_num) /*Average times = c.average_thermal_num*/
|
||||
cali_info->thermal_value_avg_index = 0;
|
||||
|
||||
for (i = 0; i < c.average_thermal_num; i++) {
|
||||
if (cali_info->thermal_value_avg[i]) {
|
||||
thermal_value_avg += cali_info->thermal_value_avg[i];
|
||||
thermal_value_avg_count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (thermal_value_avg_count) { /* Calculate Average thermal_value after average enough times */
|
||||
thermal_value = (u8)(thermal_value_avg / thermal_value_avg_count);
|
||||
cali_info->thermal_value_delta = thermal_value - rf->eeprom_thermal;
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"AVG Thermal Meter = 0x%X, EFUSE Thermal base = 0x%X\n", thermal_value, rf->eeprom_thermal);
|
||||
}
|
||||
|
||||
/* 4 5. Calculate delta, delta_LCK, delta_IQK. */
|
||||
/* "delta" here is used to determine whether thermal value changes or not. */
|
||||
delta = (thermal_value > cali_info->thermal_value) ? (thermal_value - cali_info->thermal_value) : (cali_info->thermal_value - thermal_value);
|
||||
delta_LCK = (thermal_value > cali_info->thermal_value_lck) ? (thermal_value - cali_info->thermal_value_lck) : (cali_info->thermal_value_lck - thermal_value);
|
||||
delta_IQK = (thermal_value > cali_info->thermal_value_iqk) ? (thermal_value - cali_info->thermal_value_iqk) : (cali_info->thermal_value_iqk - thermal_value);
|
||||
|
||||
/*4 6. If necessary, do LCK.*/
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK, "(delta, delta_LCK, delta_IQK) = (%d, %d, %d)\n", delta, delta_LCK, delta_IQK);
|
||||
|
||||
/* Wait sacn to do LCK by RF Jenyu*/
|
||||
if ((!*dm->is_scan_in_process) && !iqk_info->rfk_forbidden &&
|
||||
(!*dm->is_tdma)) {
|
||||
/* Delta temperature is equal to or larger than 20 centigrade.*/
|
||||
if (delta_LCK >= c.threshold_iqk) {
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK, "delta_LCK(%d) >= threshold_iqk(%d)\n", delta_LCK, c.threshold_iqk);
|
||||
cali_info->thermal_value_lck = thermal_value;
|
||||
|
||||
/*Use RTLCK, so close power tracking driver LCK*/
|
||||
(*c.phy_lc_calibrate)(dm);
|
||||
}
|
||||
}
|
||||
|
||||
/*3 7. If necessary, move the index of swing table to adjust Tx power.*/
|
||||
if (delta > 0 && cali_info->txpowertrack_control) {
|
||||
/* "delta" here is used to record the absolute value of difference. */
|
||||
delta = thermal_value > rf->eeprom_thermal ? (thermal_value - rf->eeprom_thermal) : (rf->eeprom_thermal - thermal_value);
|
||||
|
||||
if (delta >= TXPWR_TRACK_TABLE_SIZE)
|
||||
delta = TXPWR_TRACK_TABLE_SIZE - 1;
|
||||
|
||||
/*4 7.1 The Final Power index = BaseIndex + power_index_offset*/
|
||||
if (thermal_value > rf->eeprom_thermal) {
|
||||
for (p = RF_PATH_A; p < c.rf_path_count; p++) {
|
||||
cali_info->delta_power_index_last[p] = cali_info->delta_power_index[p]; /*recording poer index offset*/
|
||||
switch (p) {
|
||||
case RF_PATH_B:
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"delta_swing_table_idx_tup_b[%d] = %d\n", delta, delta_swing_table_idx_tup_b[delta]);
|
||||
#if (RTL8721D_SUPPORT == 1)
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"delta_swing_table_idx_tup_b_cck[%d] = %d\n", delta, delta_swing_table_idx_tup_b_cck[delta]);
|
||||
|
||||
cali_info->absolute_cck_swing_idx[p] = delta_swing_table_idx_tup_b_cck[delta];
|
||||
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"******Temp is higher and cali_info->absolute_cck_swing_idx[RF_PATH_B] = %d\n",
|
||||
cali_info->absolute_cck_swing_idx[p]);
|
||||
#endif
|
||||
cali_info->delta_power_index[p] =
|
||||
delta_swing_table_idx_tup_b
|
||||
[delta];
|
||||
cali_info->absolute_ofdm_swing_idx[p] =
|
||||
delta_swing_table_idx_tup_b
|
||||
[delta];
|
||||
/*Record delta swing for mix mode*/
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"******Temp is higher and cali_info->absolute_ofdm_swing_idx[RF_PATH_B] = %d\n", cali_info->absolute_ofdm_swing_idx[p]);
|
||||
break;
|
||||
|
||||
default:
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"delta_swing_table_idx_tup_a[%d] = %d\n", delta, delta_swing_table_idx_tup_a[delta]);
|
||||
#if (RTL8721D_SUPPORT == 1)
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"delta_swing_table_idx_tup_a_cck[%d] = %d\n", delta, delta_swing_table_idx_tup_a_cck[delta]);
|
||||
|
||||
cali_info->absolute_cck_swing_idx[p] = delta_swing_table_idx_tup_a_cck[delta];
|
||||
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"******Temp is higher and cali_info->absolute_cck_swing_idx[RF_PATH_A] = %d\n", cali_info->absolute_cck_swing_idx[p]);
|
||||
#endif
|
||||
cali_info->delta_power_index[p] = delta_swing_table_idx_tup_a[delta];
|
||||
cali_info->absolute_ofdm_swing_idx[p] =
|
||||
delta_swing_table_idx_tup_a[delta];
|
||||
/*Record delta swing*/
|
||||
/*for mix mode power tracking*/
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"******Temp is higher and cali_info->absolute_ofdm_swing_idx[RF_PATH_A] = %d\n", cali_info->absolute_ofdm_swing_idx[p]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* JJ ADD 20161014 */
|
||||
if (dm->support_ic_type == ODM_RTL8195B ||
|
||||
dm->support_ic_type == ODM_RTL8721D) {
|
||||
/*Save xtal_offset from Xtal table*/
|
||||
cali_info->xtal_offset_last = cali_info->xtal_offset; /*recording last Xtal offset*/
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"[Xtal] delta_swing_table_xtal_up[%d] = %d\n", delta, delta_swing_table_xtal_up[delta]);
|
||||
cali_info->xtal_offset = delta_swing_table_xtal_up[delta];
|
||||
xtal_offset_eanble = (cali_info->xtal_offset_last != cali_info->xtal_offset);
|
||||
}
|
||||
|
||||
} else {
|
||||
for (p = RF_PATH_A; p < c.rf_path_count; p++) {
|
||||
cali_info->delta_power_index_last[p] = cali_info->delta_power_index[p]; /*recording poer index offset*/
|
||||
|
||||
switch (p) {
|
||||
case RF_PATH_B:
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"delta_swing_table_idx_tdown_b[%d] = %d\n", delta, delta_swing_table_idx_tdown_b[delta]);
|
||||
#if (RTL8721D_SUPPORT == 1)
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"delta_swing_table_idx_tdown_b_cck[%d] = %d\n", delta, delta_swing_table_idx_tdown_b_cck[delta]);
|
||||
|
||||
cali_info->absolute_cck_swing_idx[p] = -1 * delta_swing_table_idx_tdown_b_cck[delta];
|
||||
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"******Temp is lower and cali_info->absolute_cck_swing_idx[RF_PATH_B] = %d\n", cali_info->absolute_cck_swing_idx[p]);
|
||||
#endif
|
||||
cali_info->delta_power_index[p] = -1 * delta_swing_table_idx_tdown_b[delta];
|
||||
cali_info->absolute_ofdm_swing_idx[p] = -1 * delta_swing_table_idx_tdown_b[delta]; /*Record delta swing for mix mode power tracking*/
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"******Temp is lower and cali_info->absolute_ofdm_swing_idx[RF_PATH_B] = %d\n", cali_info->absolute_ofdm_swing_idx[p]);
|
||||
break;
|
||||
|
||||
default:
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"delta_swing_table_idx_tdown_a[%d] = %d\n", delta, delta_swing_table_idx_tdown_a[delta]);
|
||||
#if (RTL8721D_SUPPORT == 1)
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"delta_swing_table_idx_tdown_a_cck[%d] = %d\n", delta, delta_swing_table_idx_tdown_a_cck[delta]);
|
||||
|
||||
cali_info->absolute_cck_swing_idx[p] = -1 * delta_swing_table_idx_tdown_a_cck[delta];
|
||||
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"******Temp is lower and cali_info->absolute_cck_swing_idx[RF_PATH_A] = %d\n", cali_info->absolute_cck_swing_idx[p]);
|
||||
#endif
|
||||
cali_info->delta_power_index[p] = -1 * delta_swing_table_idx_tdown_a[delta];
|
||||
cali_info->absolute_ofdm_swing_idx[p] = -1 * delta_swing_table_idx_tdown_a[delta]; /*Record delta swing for mix mode power tracking*/
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"******Temp is lower and cali_info->absolute_ofdm_swing_idx[RF_PATH_A] = %d\n", cali_info->absolute_ofdm_swing_idx[p]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* JJ ADD 20161014 */
|
||||
|
||||
if (dm->support_ic_type == ODM_RTL8195B ||
|
||||
dm->support_ic_type == ODM_RTL8721D) {
|
||||
/*Save xtal_offset from Xtal table*/
|
||||
cali_info->xtal_offset_last = cali_info->xtal_offset; /*recording last Xtal offset*/
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"[Xtal] delta_swing_table_xtal_down[%d] = %d\n", delta, delta_swing_table_xtal_down[delta]);
|
||||
cali_info->xtal_offset = delta_swing_table_xtal_down[delta];
|
||||
xtal_offset_eanble = (cali_info->xtal_offset_last != cali_info->xtal_offset);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
for (p = RF_PATH_A; p < c.rf_path_count; p++) {
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"\n\n=========================== [path-%d] Calculating power_index_offset===========================\n", p);
|
||||
|
||||
if (cali_info->delta_power_index[p] == cali_info->delta_power_index_last[p]) /*If Thermal value changes but lookup table value still the same*/
|
||||
cali_info->power_index_offset[p] = 0;
|
||||
else
|
||||
cali_info->power_index_offset[p] = cali_info->delta_power_index[p] - cali_info->delta_power_index_last[p]; /*Power index diff between 2 times Power Tracking*/
|
||||
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"[path-%d] power_index_offset(%d) = delta_power_index(%d) - delta_power_index_last(%d)\n", p, cali_info->power_index_offset[p], cali_info->delta_power_index[p], cali_info->delta_power_index_last[p]);
|
||||
|
||||
cali_info->OFDM_index[p] = cali_info->bb_swing_idx_ofdm_base[p] + cali_info->power_index_offset[p];
|
||||
cali_info->CCK_index = cali_info->bb_swing_idx_cck_base + cali_info->power_index_offset[p];
|
||||
|
||||
cali_info->bb_swing_idx_cck = cali_info->CCK_index;
|
||||
cali_info->bb_swing_idx_ofdm[p] = cali_info->OFDM_index[p];
|
||||
|
||||
/*************Print BB Swing base and index Offset*************/
|
||||
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"The 'CCK' final index(%d) = BaseIndex(%d) + power_index_offset(%d)\n", cali_info->bb_swing_idx_cck, cali_info->bb_swing_idx_cck_base, cali_info->power_index_offset[p]);
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"The 'OFDM' final index(%d) = BaseIndex[%d](%d) + power_index_offset(%d)\n", cali_info->bb_swing_idx_ofdm[p], p, cali_info->bb_swing_idx_ofdm_base[p], cali_info->power_index_offset[p]);
|
||||
|
||||
/*4 7.1 Handle boundary conditions of index.*/
|
||||
|
||||
if (cali_info->OFDM_index[p] > c.swing_table_size_ofdm - 1)
|
||||
cali_info->OFDM_index[p] = c.swing_table_size_ofdm - 1;
|
||||
else if (cali_info->OFDM_index[p] <= OFDM_min_index)
|
||||
cali_info->OFDM_index[p] = OFDM_min_index;
|
||||
}
|
||||
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"\n\n========================================================================================================\n");
|
||||
|
||||
if (cali_info->CCK_index > c.swing_table_size_cck - 1)
|
||||
cali_info->CCK_index = c.swing_table_size_cck - 1;
|
||||
else if (cali_info->CCK_index <= 0)
|
||||
cali_info->CCK_index = 0;
|
||||
#endif
|
||||
} else {
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"The thermal meter is unchanged or TxPowerTracking OFF(%d): thermal_value: %d, cali_info->thermal_value: %d\n",
|
||||
cali_info->txpowertrack_control, thermal_value, cali_info->thermal_value);
|
||||
|
||||
for (p = RF_PATH_A; p < c.rf_path_count; p++)
|
||||
cali_info->power_index_offset[p] = 0;
|
||||
}
|
||||
#if 0
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"TxPowerTracking: [CCK] Swing Current index: %d, Swing base index: %d\n",
|
||||
cali_info->CCK_index, cali_info->bb_swing_idx_cck_base); /*Print Swing base & current*/
|
||||
|
||||
for (p = RF_PATH_A; p < c.rf_path_count; p++) {
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"TxPowerTracking: [OFDM] Swing Current index: %d, Swing base index[%d]: %d\n",
|
||||
cali_info->OFDM_index[p], p, cali_info->bb_swing_idx_ofdm_base[p]);
|
||||
}
|
||||
#endif
|
||||
if (thermal_value > rf->eeprom_thermal) {
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"Temperature(%d) higher than PG value(%d)\n", thermal_value, rf->eeprom_thermal);
|
||||
|
||||
if (dm->support_ic_type == ODM_RTL8188E ||
|
||||
dm->support_ic_type == ODM_RTL8192E ||
|
||||
dm->support_ic_type == ODM_RTL8821 ||
|
||||
dm->support_ic_type == ODM_RTL8812 ||
|
||||
dm->support_ic_type == ODM_RTL8723B ||
|
||||
dm->support_ic_type == ODM_RTL8814A ||
|
||||
dm->support_ic_type == ODM_RTL8703B ||
|
||||
dm->support_ic_type == ODM_RTL8188F ||
|
||||
dm->support_ic_type == ODM_RTL8822B ||
|
||||
dm->support_ic_type == ODM_RTL8723D ||
|
||||
dm->support_ic_type == ODM_RTL8821C ||
|
||||
dm->support_ic_type == ODM_RTL8710B ||
|
||||
dm->support_ic_type == ODM_RTL8192F ||
|
||||
dm->support_ic_type == ODM_RTL8195B ||
|
||||
dm->support_ic_type == ODM_RTL8721D){
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK, "**********Enter POWER Tracking MIX_MODE**********\n");
|
||||
for (p = RF_PATH_A; p < c.rf_path_count; p++)
|
||||
(*c.odm_tx_pwr_track_set_pwr)(dm, MIX_MODE, p, 0);
|
||||
} else {
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK, "**********Enter POWER Tracking BBSWING_MODE**********\n");
|
||||
for (p = RF_PATH_A; p < c.rf_path_count; p++)
|
||||
(*c.odm_tx_pwr_track_set_pwr)(dm, BBSWING, p, indexforchannel);
|
||||
}
|
||||
} else {
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"Temperature(%d) lower than PG value(%d)\n", thermal_value, rf->eeprom_thermal);
|
||||
|
||||
if (dm->support_ic_type == ODM_RTL8188E ||
|
||||
dm->support_ic_type == ODM_RTL8192E ||
|
||||
dm->support_ic_type == ODM_RTL8821 ||
|
||||
dm->support_ic_type == ODM_RTL8812 ||
|
||||
dm->support_ic_type == ODM_RTL8723B ||
|
||||
dm->support_ic_type == ODM_RTL8814A ||
|
||||
dm->support_ic_type == ODM_RTL8703B ||
|
||||
dm->support_ic_type == ODM_RTL8188F ||
|
||||
dm->support_ic_type == ODM_RTL8822B ||
|
||||
dm->support_ic_type == ODM_RTL8723D ||
|
||||
dm->support_ic_type == ODM_RTL8821C ||
|
||||
dm->support_ic_type == ODM_RTL8710B ||
|
||||
dm->support_ic_type == ODM_RTL8192F ||
|
||||
dm->support_ic_type == ODM_RTL8195B ||
|
||||
dm->support_ic_type == ODM_RTL8721D) {
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK, "**********Enter POWER Tracking MIX_MODE**********\n");
|
||||
for (p = RF_PATH_A; p < c.rf_path_count; p++)
|
||||
(*c.odm_tx_pwr_track_set_pwr)(dm, MIX_MODE, p, indexforchannel);
|
||||
} else {
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK, "**********Enter POWER Tracking BBSWING_MODE**********\n");
|
||||
for (p = RF_PATH_A; p < c.rf_path_count; p++)
|
||||
(*c.odm_tx_pwr_track_set_pwr)(dm, BBSWING, p, indexforchannel);
|
||||
}
|
||||
|
||||
cali_info->bb_swing_idx_cck_base = cali_info->bb_swing_idx_cck; /*Record last time Power Tracking result as base.*/
|
||||
for (p = RF_PATH_A; p < c.rf_path_count; p++)
|
||||
cali_info->bb_swing_idx_ofdm_base[p] = cali_info->bb_swing_idx_ofdm[p];
|
||||
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"cali_info->thermal_value = %d thermal_value= %d\n", cali_info->thermal_value, thermal_value);
|
||||
|
||||
cali_info->thermal_value = thermal_value; /*Record last Power Tracking Thermal value*/
|
||||
}
|
||||
|
||||
/* JJ ADD 20161014 */
|
||||
if (dm->support_ic_type == ODM_RTL8195B ||
|
||||
dm->support_ic_type == ODM_RTL8721D) {
|
||||
if (xtal_offset_eanble != 0 && cali_info->txpowertrack_control && (rf->eeprom_thermal != 0xff)) {
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK, "**********Enter Xtal Tracking**********\n");
|
||||
|
||||
if (thermal_value > rf->eeprom_thermal) {
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"Temperature(%d) higher than PG value(%d)\n", thermal_value, rf->eeprom_thermal);
|
||||
(*c.odm_txxtaltrack_set_xtal)(dm);
|
||||
} else {
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK,
|
||||
"Temperature(%d) lower than PG value(%d)\n", thermal_value, rf->eeprom_thermal);
|
||||
(*c.odm_txxtaltrack_set_xtal)(dm);
|
||||
}
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK, "**********End Xtal Tracking**********\n");
|
||||
}
|
||||
}
|
||||
#if (!RTL8721D_SUPPORT)
|
||||
/* Wait sacn to do IQK by RF Jenyu*/
|
||||
if ((!*dm->is_scan_in_process) && (!iqk_info->rfk_forbidden)) {
|
||||
/*Delta temperature is equal to or larger than 20 centigrade (When threshold is 8).*/
|
||||
if (delta_IQK >= c.threshold_iqk) {
|
||||
cali_info->thermal_value_iqk = thermal_value;
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK, "delta_IQK(%d) >= threshold_iqk(%d)\n", delta_IQK, c.threshold_iqk);
|
||||
if (!cali_info->is_iqk_in_progress)
|
||||
(*c.do_iqk)(dm, delta_IQK, thermal_value, 8);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
RF_DBG(dm, DBG_RF_TX_PWR_TRACK, "<===odm_txpowertracking_callback_thermal_meter\n");
|
||||
|
||||
cali_info->tx_powercount = 0;
|
||||
}
|
||||
|
||||
/* 3============================================================
|
||||
* 3 IQ Calibration
|
||||
* 3============================================================
|
||||
*/
|
||||
|
||||
void
|
||||
odm_reset_iqk_result(
|
||||
void *dm_void
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
u8 odm_get_right_chnl_place_for_iqk(u8 chnl)
|
||||
{
|
||||
u8 channel_all[ODM_TARGET_CHNL_NUM_2G_5G] = {
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
||||
36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64,
|
||||
100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122,
|
||||
124, 126, 128, 130, 132, 134, 136, 138, 140,
|
||||
149, 151, 153, 155, 157, 159, 161, 163, 165};
|
||||
u8 place = chnl;
|
||||
|
||||
if (chnl > 14) {
|
||||
for (place = 14; place < sizeof(channel_all); place++) {
|
||||
if (channel_all[place] == chnl)
|
||||
return place - 13;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
odm_iq_calibrate(
|
||||
struct dm_struct *dm
|
||||
)
|
||||
{
|
||||
#if (RTL8721D_SUPPORT == 1)
|
||||
struct dm_iqk_info *iqk_info = &dm->IQK_info;
|
||||
|
||||
if (dm->is_linked && !iqk_info->rfk_forbidden) {
|
||||
if ((*dm->channel != dm->pre_channel) &&
|
||||
(!*dm->is_scan_in_process)) {
|
||||
dm->pre_channel = *dm->channel;
|
||||
dm->linked_interval = 0;
|
||||
}
|
||||
|
||||
if (dm->linked_interval < 3)
|
||||
dm->linked_interval++;
|
||||
|
||||
if (dm->linked_interval == 2)
|
||||
halrf_iqk_trigger(dm, false);
|
||||
} else {
|
||||
dm->linked_interval = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void phydm_rf_init(void *dm_void)
|
||||
{
|
||||
struct dm_struct *dm = (struct dm_struct *)dm_void;
|
||||
|
||||
odm_txpowertracking_init(dm);
|
||||
|
||||
odm_clear_txpowertracking_state(dm);
|
||||
}
|
||||
|
||||
void phydm_rf_watchdog(void *dm_void)
|
||||
{
|
||||
struct dm_struct *dm = (struct dm_struct *)dm_void;
|
||||
|
||||
odm_txpowertracking_check(dm);
|
||||
#if (RTL8721D_SUPPORT == 1)
|
||||
odm_iq_calibrate(dm);
|
||||
#endif
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2017 Realtek Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution in the
|
||||
* file called LICENSE.
|
||||
*
|
||||
* Contact Information:
|
||||
* wlanfae <wlanfae@realtek.com>
|
||||
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
|
||||
* Hsinchu 300, Taiwan.
|
||||
*
|
||||
* Larry Finger <Larry.Finger@lwfinger.net>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __HALPHYRF_H__
|
||||
#define __HALPHYRF_H__
|
||||
|
||||
#include "halrf/halrf_kfree.h"
|
||||
|
||||
#if (RTL8821C_SUPPORT == 1)
|
||||
#include "halrf/rtl8821c/halrf_iqk_8821c.h"
|
||||
#endif
|
||||
|
||||
#if (RTL8195B_SUPPORT == 1)
|
||||
// #include "halrf/rtl8195b/halrf.h"
|
||||
#include "halrf/rtl8195b/halrf_iqk_8195b.h"
|
||||
#include "halrf/rtl8195b/halrf_txgapk_8195b.h"
|
||||
#include "halrf/rtl8195b/halrf_dpk_8195b.h"
|
||||
#endif
|
||||
|
||||
#include "halrf/halrf_powertracking_iot.h"
|
||||
|
||||
|
||||
enum spur_cal_method {
|
||||
PLL_RESET,
|
||||
AFE_PHASE_SEL
|
||||
};
|
||||
|
||||
enum pwrtrack_method {
|
||||
BBSWING,
|
||||
TXAGC,
|
||||
MIX_MODE,
|
||||
TSSI_MODE,
|
||||
MIX_2G_TSSI_5G_MODE,
|
||||
MIX_5G_TSSI_2G_MODE
|
||||
};
|
||||
|
||||
typedef void (*func_set_pwr)(void *, enum pwrtrack_method, u8, u8);
|
||||
typedef void(*func_iqk)(void *, u8, u8, u8);
|
||||
typedef void (*func_lck)(void *);
|
||||
#if (RTL8721D_SUPPORT == 1)
|
||||
typedef void (*func_swing)(void *, u8 **, u8 **, u8 **, u8 **,
|
||||
u8 **, u8 **, u8 **, u8 **);
|
||||
#else
|
||||
typedef void (*func_swing)(void *, u8 **, u8 **, u8 **, u8 **);
|
||||
#endif
|
||||
typedef void (*func_swing8814only)(void *, u8 **, u8 **, u8 **, u8 **);
|
||||
typedef void(*func_swing_xtal)(void *, s8 **, s8 **);
|
||||
typedef void(*func_set_xtal)(void *);
|
||||
|
||||
struct txpwrtrack_cfg {
|
||||
u8 swing_table_size_cck;
|
||||
u8 swing_table_size_ofdm;
|
||||
u8 threshold_iqk;
|
||||
u8 threshold_dpk;
|
||||
u8 average_thermal_num;
|
||||
u8 rf_path_count;
|
||||
u32 thermal_reg_addr;
|
||||
func_set_pwr odm_tx_pwr_track_set_pwr;
|
||||
func_iqk do_iqk;
|
||||
func_lck phy_lc_calibrate;
|
||||
func_swing get_delta_swing_table;
|
||||
func_swing8814only get_delta_swing_table8814only;
|
||||
func_swing_xtal get_delta_swing_xtal_table;
|
||||
func_set_xtal odm_txxtaltrack_set_xtal;
|
||||
};
|
||||
|
||||
void
|
||||
configure_txpower_track(
|
||||
void *dm_void,
|
||||
struct txpwrtrack_cfg *config
|
||||
);
|
||||
|
||||
|
||||
void
|
||||
odm_clear_txpowertracking_state(
|
||||
void *dm_void
|
||||
);
|
||||
|
||||
void
|
||||
odm_txpowertracking_callback_thermal_meter(
|
||||
#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
|
||||
void *dm_void
|
||||
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
|
||||
void *dm
|
||||
#else
|
||||
void *adapter
|
||||
#endif
|
||||
);
|
||||
|
||||
|
||||
|
||||
#define ODM_TARGET_CHNL_NUM_2G_5G 59
|
||||
|
||||
|
||||
void
|
||||
odm_reset_iqk_result(
|
||||
void *dm_void
|
||||
);
|
||||
u8
|
||||
odm_get_right_chnl_place_for_iqk(
|
||||
u8 chnl
|
||||
);
|
||||
|
||||
void phydm_rf_init(void *dm_void);
|
||||
void phydm_rf_watchdog(void *dm_void);
|
||||
|
||||
#endif /*#ifndef __HALPHYRF_H__*/
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user