diff options
author | Chaoming_Li <chaoming_li@realsil.com.cn> | 2011-04-25 13:52:49 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-04-26 16:13:31 -0400 |
commit | 3dad618b7b929010f05b179bbc4d56e3d5956083 (patch) | |
tree | f947031d757017841ef145811a42774e3c31f129 | |
parent | e25f51d4f9f8c45382a33b6283418be46425195c (diff) |
rtlwifi: Change wifi.h for rtl8192se and rtl8192de
Change wifi.h for addition of RTL8192SE and RTL8192DE code
Signed-off-by: Chaoming_Li <chaoming_li@realsil.com.cn>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/rtlwifi/wifi.h | 161 |
2 files changed, 155 insertions, 10 deletions
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c index c228b9ee3711..5ea3a5ef819b 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c +++ b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c | |||
@@ -640,7 +640,7 @@ static void rtl92c_dm_txpower_tracking_callback_thermalmeter(struct ieee80211_hw | |||
640 | u8 txpwr_level[2] = {0, 0}; | 640 | u8 txpwr_level[2] = {0, 0}; |
641 | u8 ofdm_min_index = 6, rf; | 641 | u8 ofdm_min_index = 6, rf; |
642 | 642 | ||
643 | rtlpriv->dm.txpower_trackingInit = true; | 643 | rtlpriv->dm.txpower_trackinginit = true; |
644 | RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, | 644 | RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, |
645 | ("rtl92c_dm_txpower_tracking_callback_thermalmeter\n")); | 645 | ("rtl92c_dm_txpower_tracking_callback_thermalmeter\n")); |
646 | 646 | ||
@@ -1062,7 +1062,7 @@ static void rtl92c_dm_initialize_txpower_tracking_thermalmeter( | |||
1062 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1062 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1063 | 1063 | ||
1064 | rtlpriv->dm.txpower_tracking = true; | 1064 | rtlpriv->dm.txpower_tracking = true; |
1065 | rtlpriv->dm.txpower_trackingInit = false; | 1065 | rtlpriv->dm.txpower_trackinginit = false; |
1066 | 1066 | ||
1067 | RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, | 1067 | RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, |
1068 | ("pMgntInfo->txpower_tracking = %d\n", | 1068 | ("pMgntInfo->txpower_tracking = %d\n", |
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h index 4ce4853975f1..9124b30c605d 100644 --- a/drivers/net/wireless/rtlwifi/wifi.h +++ b/drivers/net/wireless/rtlwifi/wifi.h | |||
@@ -68,6 +68,8 @@ | |||
68 | #define QBSS_LOAD_SIZE 5 | 68 | #define QBSS_LOAD_SIZE 5 |
69 | #define MAX_WMMELE_LENGTH 64 | 69 | #define MAX_WMMELE_LENGTH 64 |
70 | 70 | ||
71 | #define TOTAL_CAM_ENTRY 32 | ||
72 | |||
71 | /*slot time for 11g. */ | 73 | /*slot time for 11g. */ |
72 | #define RTL_SLOT_TIME_9 9 | 74 | #define RTL_SLOT_TIME_9 9 |
73 | #define RTL_SLOT_TIME_20 20 | 75 | #define RTL_SLOT_TIME_20 20 |
@@ -94,8 +96,10 @@ | |||
94 | #define CHANNEL_GROUP_MAX_5G 9 | 96 | #define CHANNEL_GROUP_MAX_5G 9 |
95 | #define CHANNEL_MAX_NUMBER_2G 14 | 97 | #define CHANNEL_MAX_NUMBER_2G 14 |
96 | #define AVG_THERMAL_NUM 8 | 98 | #define AVG_THERMAL_NUM 8 |
99 | #define MAX_TID_COUNT 9 | ||
97 | 100 | ||
98 | /* for early mode */ | 101 | /* for early mode */ |
102 | #define FCS_LEN 4 | ||
99 | #define EM_HDR_LEN 8 | 103 | #define EM_HDR_LEN 8 |
100 | enum intf_type { | 104 | enum intf_type { |
101 | INTF_PCI = 0, | 105 | INTF_PCI = 0, |
@@ -159,6 +163,8 @@ enum hardware_type { | |||
159 | (IS_HARDWARE_TYPE_8192DE(rtlhal) || IS_HARDWARE_TYPE_8192DU(rtlhal)) | 163 | (IS_HARDWARE_TYPE_8192DE(rtlhal) || IS_HARDWARE_TYPE_8192DU(rtlhal)) |
160 | #define IS_HARDWARE_TYPE_8723(rtlhal) \ | 164 | #define IS_HARDWARE_TYPE_8723(rtlhal) \ |
161 | (IS_HARDWARE_TYPE_8723E(rtlhal) || IS_HARDWARE_TYPE_8723U(rtlhal)) | 165 | (IS_HARDWARE_TYPE_8723E(rtlhal) || IS_HARDWARE_TYPE_8723U(rtlhal)) |
166 | #define IS_HARDWARE_TYPE_8723U(rtlhal) \ | ||
167 | (rtlhal->hw_type == HARDWARE_TYPE_RTL8723U) | ||
162 | 168 | ||
163 | enum scan_operation_backup_opt { | 169 | enum scan_operation_backup_opt { |
164 | SCAN_OPT_BACKUP = 0, | 170 | SCAN_OPT_BACKUP = 0, |
@@ -843,6 +849,7 @@ struct rtl_phy { | |||
843 | bool apk_done; | 849 | bool apk_done; |
844 | u32 reg_rf3c[2]; /* pathA / pathB */ | 850 | u32 reg_rf3c[2]; /* pathA / pathB */ |
845 | 851 | ||
852 | /* bfsync */ | ||
846 | u8 framesync; | 853 | u8 framesync; |
847 | u32 framesync_c34; | 854 | u32 framesync_c34; |
848 | 855 | ||
@@ -852,6 +859,10 @@ struct rtl_phy { | |||
852 | }; | 859 | }; |
853 | 860 | ||
854 | #define MAX_TID_COUNT 9 | 861 | #define MAX_TID_COUNT 9 |
862 | #define RTL_AGG_STOP 0 | ||
863 | #define RTL_AGG_PROGRESS 1 | ||
864 | #define RTL_AGG_START 2 | ||
865 | #define RTL_AGG_OPERATIONAL 3 | ||
855 | #define RTL_AGG_OFF 0 | 866 | #define RTL_AGG_OFF 0 |
856 | #define RTL_AGG_ON 1 | 867 | #define RTL_AGG_ON 1 |
857 | #define RTL_AGG_EMPTYING_HW_QUEUE_ADDBA 2 | 868 | #define RTL_AGG_EMPTYING_HW_QUEUE_ADDBA 2 |
@@ -871,6 +882,13 @@ struct rtl_tid_data { | |||
871 | struct rtl_ht_agg agg; | 882 | struct rtl_ht_agg agg; |
872 | }; | 883 | }; |
873 | 884 | ||
885 | struct rtl_sta_info { | ||
886 | u8 ratr_index; | ||
887 | u8 wireless_mode; | ||
888 | u8 mimo_ps; | ||
889 | struct rtl_tid_data tids[MAX_TID_COUNT]; | ||
890 | } __packed; | ||
891 | |||
874 | struct rtl_priv; | 892 | struct rtl_priv; |
875 | struct rtl_io { | 893 | struct rtl_io { |
876 | struct device *dev; | 894 | struct device *dev; |
@@ -894,6 +912,7 @@ struct rtl_io { | |||
894 | u32(*read32_sync) (struct rtl_priv *rtlpriv, u32 addr); | 912 | u32(*read32_sync) (struct rtl_priv *rtlpriv, u32 addr); |
895 | int (*readN_sync) (struct rtl_priv *rtlpriv, u32 addr, u16 len, | 913 | int (*readN_sync) (struct rtl_priv *rtlpriv, u32 addr, u16 len, |
896 | u8 *pdata); | 914 | u8 *pdata); |
915 | |||
897 | }; | 916 | }; |
898 | 917 | ||
899 | struct rtl_mac { | 918 | struct rtl_mac { |
@@ -916,6 +935,8 @@ struct rtl_mac { | |||
916 | int n_channels; | 935 | int n_channels; |
917 | int n_bitrates; | 936 | int n_bitrates; |
918 | 937 | ||
938 | bool offchan_deley; | ||
939 | |||
919 | /*filters */ | 940 | /*filters */ |
920 | u32 rx_conf; | 941 | u32 rx_conf; |
921 | u16 rx_mgt_filter; | 942 | u16 rx_mgt_filter; |
@@ -1032,7 +1053,9 @@ struct rtl_security { | |||
1032 | enum rt_enc_alg pairwise_enc_algorithm; | 1053 | enum rt_enc_alg pairwise_enc_algorithm; |
1033 | /*Encryption Algorithm for Brocast/Multicast */ | 1054 | /*Encryption Algorithm for Brocast/Multicast */ |
1034 | enum rt_enc_alg group_enc_algorithm; | 1055 | enum rt_enc_alg group_enc_algorithm; |
1035 | 1056 | /*Cam Entry Bitmap */ | |
1057 | u32 hwsec_cam_bitmap; | ||
1058 | u8 hwsec_cam_sta_addr[TOTAL_CAM_ENTRY][ETH_ALEN]; | ||
1036 | /*local Key buffer, indx 0 is for | 1059 | /*local Key buffer, indx 0 is for |
1037 | pairwise key 1-4 is for agoup key. */ | 1060 | pairwise key 1-4 is for agoup key. */ |
1038 | u8 key_buf[KEY_BUF_SIZE][MAX_KEY_LEN]; | 1061 | u8 key_buf[KEY_BUF_SIZE][MAX_KEY_LEN]; |
@@ -1053,7 +1076,7 @@ struct rtl_dm { | |||
1053 | bool current_turbo_edca; | 1076 | bool current_turbo_edca; |
1054 | bool is_any_nonbepkts; /*out dm */ | 1077 | bool is_any_nonbepkts; /*out dm */ |
1055 | bool is_cur_rdlstate; | 1078 | bool is_cur_rdlstate; |
1056 | bool txpower_trackingInit; | 1079 | bool txpower_trackinginit; |
1057 | bool disable_framebursting; | 1080 | bool disable_framebursting; |
1058 | bool cck_inch14; | 1081 | bool cck_inch14; |
1059 | bool txpower_tracking; | 1082 | bool txpower_tracking; |
@@ -1079,7 +1102,6 @@ struct rtl_dm { | |||
1079 | bool disable_tx_int; | 1102 | bool disable_tx_int; |
1080 | char ofdm_index[2]; | 1103 | char ofdm_index[2]; |
1081 | char cck_index; | 1104 | char cck_index; |
1082 | u8 power_index_backup[6]; | ||
1083 | }; | 1105 | }; |
1084 | 1106 | ||
1085 | #define EFUSE_MAX_LOGICAL_SIZE 256 | 1107 | #define EFUSE_MAX_LOGICAL_SIZE 256 |
@@ -1175,6 +1197,7 @@ struct rtl_ps_ctl { | |||
1175 | * otherwise Offset[560h] = 0x00. | 1197 | * otherwise Offset[560h] = 0x00. |
1176 | * */ | 1198 | * */ |
1177 | bool support_aspm; | 1199 | bool support_aspm; |
1200 | |||
1178 | bool support_backdoor; | 1201 | bool support_backdoor; |
1179 | 1202 | ||
1180 | /*for LPS */ | 1203 | /*for LPS */ |
@@ -1201,7 +1224,6 @@ struct rtl_ps_ctl { | |||
1201 | 1224 | ||
1202 | /*just for PCIE ASPM */ | 1225 | /*just for PCIE ASPM */ |
1203 | u8 const_amdpci_aspm; | 1226 | u8 const_amdpci_aspm; |
1204 | |||
1205 | bool pwrdown_mode; | 1227 | bool pwrdown_mode; |
1206 | 1228 | ||
1207 | enum rf_pwrstate inactive_pwrstate; | 1229 | enum rf_pwrstate inactive_pwrstate; |
@@ -1282,6 +1304,10 @@ struct rt_link_detect { | |||
1282 | bool busytraffic; | 1304 | bool busytraffic; |
1283 | bool higher_busytraffic; | 1305 | bool higher_busytraffic; |
1284 | bool higher_busyrxtraffic; | 1306 | bool higher_busyrxtraffic; |
1307 | |||
1308 | u32 tidtx_in4period[MAX_TID_COUNT][4]; | ||
1309 | u32 tidtx_inperiod[MAX_TID_COUNT]; | ||
1310 | bool higher_busytxtraffic[MAX_TID_COUNT]; | ||
1285 | }; | 1311 | }; |
1286 | 1312 | ||
1287 | struct rtl_tcb_desc { | 1313 | struct rtl_tcb_desc { |
@@ -1344,13 +1370,26 @@ struct rtl_hal_ops { | |||
1344 | u32 add_msr, u32 rm_msr); | 1370 | u32 add_msr, u32 rm_msr); |
1345 | void (*get_hw_reg) (struct ieee80211_hw *hw, u8 variable, u8 *val); | 1371 | void (*get_hw_reg) (struct ieee80211_hw *hw, u8 variable, u8 *val); |
1346 | void (*set_hw_reg) (struct ieee80211_hw *hw, u8 variable, u8 *val); | 1372 | void (*set_hw_reg) (struct ieee80211_hw *hw, u8 variable, u8 *val); |
1373 | #if 0 /* temporary */ | ||
1374 | void (*update_rate_tbl) (struct ieee80211_hw *hw, | ||
1375 | struct ieee80211_sta *sta, u8 rssi_level); | ||
1376 | #else | ||
1347 | void (*update_rate_table) (struct ieee80211_hw *hw); | 1377 | void (*update_rate_table) (struct ieee80211_hw *hw); |
1378 | #endif | ||
1348 | void (*update_rate_mask) (struct ieee80211_hw *hw, u8 rssi_level); | 1379 | void (*update_rate_mask) (struct ieee80211_hw *hw, u8 rssi_level); |
1380 | #if 0 /* temporary */ | ||
1381 | void (*fill_tx_desc) (struct ieee80211_hw *hw, | ||
1382 | struct ieee80211_hdr *hdr, u8 *pdesc_tx, | ||
1383 | struct ieee80211_tx_info *info, | ||
1384 | struct sk_buff *skb, u8 hw_queue, | ||
1385 | struct rtl_tcb_desc *ptcb_desc); | ||
1386 | #else | ||
1349 | void (*fill_tx_desc) (struct ieee80211_hw *hw, | 1387 | void (*fill_tx_desc) (struct ieee80211_hw *hw, |
1350 | struct ieee80211_hdr *hdr, u8 *pdesc_tx, | 1388 | struct ieee80211_hdr *hdr, u8 *pdesc_tx, |
1351 | struct ieee80211_tx_info *info, | 1389 | struct ieee80211_tx_info *info, |
1352 | struct sk_buff *skb, unsigned int queue_index); | 1390 | struct sk_buff *skb, unsigned int queue_index); |
1353 | void (*fill_fake_txdesc) (struct ieee80211_hw *hw, u8 * pDesc, | 1391 | #endif |
1392 | void (*fill_fake_txdesc) (struct ieee80211_hw *hw, u8 *pDesc, | ||
1354 | u32 buffer_len, bool bIsPsPoll); | 1393 | u32 buffer_len, bool bIsPsPoll); |
1355 | void (*fill_tx_cmddesc) (struct ieee80211_hw *hw, u8 *pdesc, | 1394 | void (*fill_tx_cmddesc) (struct ieee80211_hw *hw, u8 *pdesc, |
1356 | bool firstseg, bool lastseg, | 1395 | bool firstseg, bool lastseg, |
@@ -1370,10 +1409,10 @@ struct rtl_hal_ops { | |||
1370 | enum led_ctl_mode ledaction); | 1409 | enum led_ctl_mode ledaction); |
1371 | void (*set_desc) (u8 *pdesc, bool istx, u8 desc_name, u8 *val); | 1410 | void (*set_desc) (u8 *pdesc, bool istx, u8 desc_name, u8 *val); |
1372 | u32 (*get_desc) (u8 *pdesc, bool istx, u8 desc_name); | 1411 | u32 (*get_desc) (u8 *pdesc, bool istx, u8 desc_name); |
1373 | void (*tx_polling) (struct ieee80211_hw *hw, unsigned int hw_queue); | 1412 | void (*tx_polling) (struct ieee80211_hw *hw, u8 hw_queue); |
1374 | void (*enable_hw_sec) (struct ieee80211_hw *hw); | 1413 | void (*enable_hw_sec) (struct ieee80211_hw *hw); |
1375 | void (*set_key) (struct ieee80211_hw *hw, u32 key_index, | 1414 | void (*set_key) (struct ieee80211_hw *hw, u32 key_index, |
1376 | u8 *p_macaddr, bool is_group, u8 enc_algo, | 1415 | u8 *macaddr, bool is_group, u8 enc_algo, |
1377 | bool is_wepkey, bool clear_all); | 1416 | bool is_wepkey, bool clear_all); |
1378 | void (*init_sw_leds) (struct ieee80211_hw *hw); | 1417 | void (*init_sw_leds) (struct ieee80211_hw *hw); |
1379 | void (*deinit_sw_leds) (struct ieee80211_hw *hw); | 1418 | void (*deinit_sw_leds) (struct ieee80211_hw *hw); |
@@ -1384,6 +1423,7 @@ struct rtl_hal_ops { | |||
1384 | u32 regaddr, u32 bitmask); | 1423 | u32 regaddr, u32 bitmask); |
1385 | void (*set_rfreg) (struct ieee80211_hw *hw, enum radio_path rfpath, | 1424 | void (*set_rfreg) (struct ieee80211_hw *hw, enum radio_path rfpath, |
1386 | u32 regaddr, u32 bitmask, u32 data); | 1425 | u32 regaddr, u32 bitmask, u32 data); |
1426 | void (*linked_set_reg) (struct ieee80211_hw *hw); | ||
1387 | bool (*phy_rf6052_config) (struct ieee80211_hw *hw); | 1427 | bool (*phy_rf6052_config) (struct ieee80211_hw *hw); |
1388 | void (*phy_rf6052_set_cck_txpower) (struct ieee80211_hw *hw, | 1428 | void (*phy_rf6052_set_cck_txpower) (struct ieee80211_hw *hw, |
1389 | u8 *powerlevel); | 1429 | u8 *powerlevel); |
@@ -1404,7 +1444,13 @@ struct rtl_intf_ops { | |||
1404 | int (*adapter_start) (struct ieee80211_hw *hw); | 1444 | int (*adapter_start) (struct ieee80211_hw *hw); |
1405 | void (*adapter_stop) (struct ieee80211_hw *hw); | 1445 | void (*adapter_stop) (struct ieee80211_hw *hw); |
1406 | 1446 | ||
1447 | #if 0 /* temporary */ | ||
1448 | int (*adapter_tx) (struct ieee80211_hw *hw, struct sk_buff *skb, | ||
1449 | struct rtl_tcb_desc *ptcb_desc); | ||
1450 | #else | ||
1407 | int (*adapter_tx) (struct ieee80211_hw *hw, struct sk_buff *skb); | 1451 | int (*adapter_tx) (struct ieee80211_hw *hw, struct sk_buff *skb); |
1452 | #endif | ||
1453 | void (*flush)(struct ieee80211_hw *hw, bool drop); | ||
1408 | int (*reset_trx_ring) (struct ieee80211_hw *hw); | 1454 | int (*reset_trx_ring) (struct ieee80211_hw *hw); |
1409 | bool (*waitq_insert) (struct ieee80211_hw *hw, struct sk_buff *skb); | 1455 | bool (*waitq_insert) (struct ieee80211_hw *hw, struct sk_buff *skb); |
1410 | 1456 | ||
@@ -1418,6 +1464,15 @@ struct rtl_intf_ops { | |||
1418 | struct rtl_mod_params { | 1464 | struct rtl_mod_params { |
1419 | /* default: 0 = using hardware encryption */ | 1465 | /* default: 0 = using hardware encryption */ |
1420 | int sw_crypto; | 1466 | int sw_crypto; |
1467 | |||
1468 | /* default: 1 = using no linked power save */ | ||
1469 | bool inactiveps; | ||
1470 | |||
1471 | /* default: 1 = using linked sw power save */ | ||
1472 | bool swctrl_lps; | ||
1473 | |||
1474 | /* default: 1 = using linked fw power save */ | ||
1475 | bool fwctrl_lps; | ||
1421 | }; | 1476 | }; |
1422 | 1477 | ||
1423 | struct rtl_hal_usbint_cfg { | 1478 | struct rtl_hal_usbint_cfg { |
@@ -1445,6 +1500,7 @@ struct rtl_hal_usbint_cfg { | |||
1445 | 1500 | ||
1446 | struct rtl_hal_cfg { | 1501 | struct rtl_hal_cfg { |
1447 | u8 bar_id; | 1502 | u8 bar_id; |
1503 | bool write_readback; | ||
1448 | char *name; | 1504 | char *name; |
1449 | char *fw_name; | 1505 | char *fw_name; |
1450 | struct rtl_hal_ops *ops; | 1506 | struct rtl_hal_ops *ops; |
@@ -1469,7 +1525,6 @@ struct rtl_locks { | |||
1469 | spinlock_t rf_lock; | 1525 | spinlock_t rf_lock; |
1470 | spinlock_t lps_lock; | 1526 | spinlock_t lps_lock; |
1471 | spinlock_t waitq_lock; | 1527 | spinlock_t waitq_lock; |
1472 | spinlock_t tx_urb_lock; | ||
1473 | 1528 | ||
1474 | /*Dual mac*/ | 1529 | /*Dual mac*/ |
1475 | spinlock_t cck_and_rw_pagea_lock; | 1530 | spinlock_t cck_and_rw_pagea_lock; |
@@ -1653,13 +1708,23 @@ struct bt_coexist_info { | |||
1653 | #define EF4BYTE(_val) \ | 1708 | #define EF4BYTE(_val) \ |
1654 | (le32_to_cpu(_val)) | 1709 | (le32_to_cpu(_val)) |
1655 | 1710 | ||
1711 | /* Read data from memory */ | ||
1712 | #define READEF1BYTE(_ptr) \ | ||
1713 | EF1BYTE(*((u8 *)(_ptr))) | ||
1656 | /* Read le16 data from memory and convert to host ordering */ | 1714 | /* Read le16 data from memory and convert to host ordering */ |
1657 | #define READEF2BYTE(_ptr) \ | 1715 | #define READEF2BYTE(_ptr) \ |
1658 | EF2BYTE(*((u16 *)(_ptr))) | 1716 | EF2BYTE(*((u16 *)(_ptr))) |
1717 | #define READEF4BYTE(_ptr) \ | ||
1718 | EF4BYTE(*((u32 *)(_ptr))) | ||
1659 | 1719 | ||
1720 | /* Write data to memory */ | ||
1721 | #define WRITEEF1BYTE(_ptr, _val) \ | ||
1722 | (*((u8 *)(_ptr))) = EF1BYTE(_val) | ||
1660 | /* Write le16 data to memory in host ordering */ | 1723 | /* Write le16 data to memory in host ordering */ |
1661 | #define WRITEEF2BYTE(_ptr, _val) \ | 1724 | #define WRITEEF2BYTE(_ptr, _val) \ |
1662 | (*((u16 *)(_ptr))) = EF2BYTE(_val) | 1725 | (*((u16 *)(_ptr))) = EF2BYTE(_val) |
1726 | #define WRITEEF4BYTE(_ptr, _val) \ | ||
1727 | (*((u16 *)(_ptr))) = EF2BYTE(_val) | ||
1663 | 1728 | ||
1664 | /* Create a bit mask | 1729 | /* Create a bit mask |
1665 | * Examples: | 1730 | * Examples: |
@@ -1698,6 +1763,25 @@ struct bt_coexist_info { | |||
1698 | #define LE_P1BYTE_TO_HOST_1BYTE(__pstart) \ | 1763 | #define LE_P1BYTE_TO_HOST_1BYTE(__pstart) \ |
1699 | (EF1BYTE(*((u8 *)(__pstart)))) | 1764 | (EF1BYTE(*((u8 *)(__pstart)))) |
1700 | 1765 | ||
1766 | /*Description: | ||
1767 | Translate subfield (continuous bits in little-endian) of 4-byte | ||
1768 | value to host byte ordering.*/ | ||
1769 | #define LE_BITS_TO_4BYTE(__pstart, __bitoffset, __bitlen) \ | ||
1770 | ( \ | ||
1771 | (LE_P4BYTE_TO_HOST_4BYTE(__pstart) >> (__bitoffset)) & \ | ||
1772 | BIT_LEN_MASK_32(__bitlen) \ | ||
1773 | ) | ||
1774 | #define LE_BITS_TO_2BYTE(__pstart, __bitoffset, __bitlen) \ | ||
1775 | ( \ | ||
1776 | (LE_P2BYTE_TO_HOST_2BYTE(__pstart) >> (__bitoffset)) & \ | ||
1777 | BIT_LEN_MASK_16(__bitlen) \ | ||
1778 | ) | ||
1779 | #define LE_BITS_TO_1BYTE(__pstart, __bitoffset, __bitlen) \ | ||
1780 | ( \ | ||
1781 | (LE_P1BYTE_TO_HOST_1BYTE(__pstart) >> (__bitoffset)) & \ | ||
1782 | BIT_LEN_MASK_8(__bitlen) \ | ||
1783 | ) | ||
1784 | |||
1701 | /* Description: | 1785 | /* Description: |
1702 | * Mask subfield (continuous bits in little-endian) of 4-byte value | 1786 | * Mask subfield (continuous bits in little-endian) of 4-byte value |
1703 | * and return the result in 4-byte value in host byte ordering. | 1787 | * and return the result in 4-byte value in host byte ordering. |
@@ -1721,6 +1805,18 @@ struct bt_coexist_info { | |||
1721 | /* Description: | 1805 | /* Description: |
1722 | * Set subfield of little-endian 4-byte value to specified value. | 1806 | * Set subfield of little-endian 4-byte value to specified value. |
1723 | */ | 1807 | */ |
1808 | #define SET_BITS_TO_LE_4BYTE(__pstart, __bitoffset, __bitlen, __val) \ | ||
1809 | *((u32 *)(__pstart)) = EF4BYTE \ | ||
1810 | ( \ | ||
1811 | LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) | \ | ||
1812 | ((((u32)__val) & BIT_LEN_MASK_32(__bitlen)) << (__bitoffset)) \ | ||
1813 | ); | ||
1814 | #define SET_BITS_TO_LE_2BYTE(__pstart, __bitoffset, __bitlen, __val) \ | ||
1815 | *((u16 *)(__pstart)) = EF2BYTE \ | ||
1816 | ( \ | ||
1817 | LE_BITS_CLEARED_TO_2BYTE(__pstart, __bitoffset, __bitlen) | \ | ||
1818 | ((((u16)__val) & BIT_LEN_MASK_16(__bitlen)) << (__bitoffset)) \ | ||
1819 | ); | ||
1724 | #define SET_BITS_TO_LE_1BYTE(__pstart, __bitoffset, __bitlen, __val) \ | 1820 | #define SET_BITS_TO_LE_1BYTE(__pstart, __bitoffset, __bitlen, __val) \ |
1725 | *((u8 *)(__pstart)) = EF1BYTE \ | 1821 | *((u8 *)(__pstart)) = EF1BYTE \ |
1726 | ( \ | 1822 | ( \ |
@@ -1728,12 +1824,16 @@ struct bt_coexist_info { | |||
1728 | ((((u8)__val) & BIT_LEN_MASK_8(__bitlen)) << (__bitoffset)) \ | 1824 | ((((u8)__val) & BIT_LEN_MASK_8(__bitlen)) << (__bitoffset)) \ |
1729 | ); | 1825 | ); |
1730 | 1826 | ||
1827 | #define N_BYTE_ALIGMENT(__value, __aligment) ((__aligment == 1) ? \ | ||
1828 | (__value) : (((__value + __aligment - 1) / __aligment) * __aligment)) | ||
1829 | |||
1731 | /**************************************** | 1830 | /**************************************** |
1732 | mem access macro define end | 1831 | mem access macro define end |
1733 | ****************************************/ | 1832 | ****************************************/ |
1734 | 1833 | ||
1735 | #define byte(x, n) ((x >> (8 * n)) & 0xff) | 1834 | #define byte(x, n) ((x >> (8 * n)) & 0xff) |
1736 | 1835 | ||
1836 | #define packet_get_type(_packet) (EF1BYTE((_packet).octet[0]) & 0xFC) | ||
1737 | #define RTL_WATCH_DOG_TIME 2000 | 1837 | #define RTL_WATCH_DOG_TIME 2000 |
1738 | #define MSECS(t) msecs_to_jiffies(t) | 1838 | #define MSECS(t) msecs_to_jiffies(t) |
1739 | #define WLAN_FC_GET_VERS(fc) (le16_to_cpu(fc) & IEEE80211_FCTL_VERS) | 1839 | #define WLAN_FC_GET_VERS(fc) (le16_to_cpu(fc) & IEEE80211_FCTL_VERS) |
@@ -1768,6 +1868,15 @@ struct bt_coexist_info { | |||
1768 | #define container_of_dwork_rtl(x, y, z) \ | 1868 | #define container_of_dwork_rtl(x, y, z) \ |
1769 | container_of(container_of(x, struct delayed_work, work), y, z) | 1869 | container_of(container_of(x, struct delayed_work, work), y, z) |
1770 | 1870 | ||
1871 | #define FILL_OCTET_STRING(_os, _octet, _len) \ | ||
1872 | (_os).octet = (u8 *)(_octet); \ | ||
1873 | (_os).length = (_len); | ||
1874 | |||
1875 | #define CP_MACADDR(des, src) \ | ||
1876 | ((des)[0] = (src)[0], (des)[1] = (src)[1],\ | ||
1877 | (des)[2] = (src)[2], (des)[3] = (src)[3],\ | ||
1878 | (des)[4] = (src)[4], (des)[5] = (src)[5]) | ||
1879 | |||
1771 | static inline u8 rtl_read_byte(struct rtl_priv *rtlpriv, u32 addr) | 1880 | static inline u8 rtl_read_byte(struct rtl_priv *rtlpriv, u32 addr) |
1772 | { | 1881 | { |
1773 | return rtlpriv->io.read8_sync(rtlpriv, addr); | 1882 | return rtlpriv->io.read8_sync(rtlpriv, addr); |
@@ -1786,17 +1895,26 @@ static inline u32 rtl_read_dword(struct rtl_priv *rtlpriv, u32 addr) | |||
1786 | static inline void rtl_write_byte(struct rtl_priv *rtlpriv, u32 addr, u8 val8) | 1895 | static inline void rtl_write_byte(struct rtl_priv *rtlpriv, u32 addr, u8 val8) |
1787 | { | 1896 | { |
1788 | rtlpriv->io.write8_async(rtlpriv, addr, val8); | 1897 | rtlpriv->io.write8_async(rtlpriv, addr, val8); |
1898 | |||
1899 | if (rtlpriv->cfg->write_readback) | ||
1900 | rtlpriv->io.read8_sync(rtlpriv, addr); | ||
1789 | } | 1901 | } |
1790 | 1902 | ||
1791 | static inline void rtl_write_word(struct rtl_priv *rtlpriv, u32 addr, u16 val16) | 1903 | static inline void rtl_write_word(struct rtl_priv *rtlpriv, u32 addr, u16 val16) |
1792 | { | 1904 | { |
1793 | rtlpriv->io.write16_async(rtlpriv, addr, val16); | 1905 | rtlpriv->io.write16_async(rtlpriv, addr, val16); |
1906 | |||
1907 | if (rtlpriv->cfg->write_readback) | ||
1908 | rtlpriv->io.read16_sync(rtlpriv, addr); | ||
1794 | } | 1909 | } |
1795 | 1910 | ||
1796 | static inline void rtl_write_dword(struct rtl_priv *rtlpriv, | 1911 | static inline void rtl_write_dword(struct rtl_priv *rtlpriv, |
1797 | u32 addr, u32 val32) | 1912 | u32 addr, u32 val32) |
1798 | { | 1913 | { |
1799 | rtlpriv->io.write32_async(rtlpriv, addr, val32); | 1914 | rtlpriv->io.write32_async(rtlpriv, addr, val32); |
1915 | |||
1916 | if (rtlpriv->cfg->write_readback) | ||
1917 | rtlpriv->io.read32_sync(rtlpriv, addr); | ||
1800 | } | 1918 | } |
1801 | 1919 | ||
1802 | static inline u32 rtl_get_bbreg(struct ieee80211_hw *hw, | 1920 | static inline u32 rtl_get_bbreg(struct ieee80211_hw *hw, |
@@ -1855,4 +1973,31 @@ static inline u8 get_rf_type(struct rtl_phy *rtlphy) | |||
1855 | return rtlphy->rf_type; | 1973 | return rtlphy->rf_type; |
1856 | } | 1974 | } |
1857 | 1975 | ||
1976 | static inline struct ieee80211_hdr *rtl_get_hdr(struct sk_buff *skb) | ||
1977 | { | ||
1978 | return (struct ieee80211_hdr *)(skb->data); | ||
1979 | } | ||
1980 | |||
1981 | static inline u16 rtl_get_fc(struct sk_buff *skb) | ||
1982 | { | ||
1983 | return le16_to_cpu(rtl_get_hdr(skb)->frame_control); | ||
1984 | } | ||
1985 | |||
1986 | static inline u16 rtl_get_tid_h(struct ieee80211_hdr *hdr) | ||
1987 | { | ||
1988 | return (ieee80211_get_qos_ctl(hdr))[0] & IEEE80211_QOS_CTL_TID_MASK; | ||
1989 | } | ||
1990 | |||
1991 | static inline u16 rtl_get_tid(struct sk_buff *skb) | ||
1992 | { | ||
1993 | return rtl_get_tid_h(rtl_get_hdr(skb)); | ||
1994 | } | ||
1995 | |||
1996 | static inline struct ieee80211_sta *get_sta(struct ieee80211_hw *hw, | ||
1997 | struct ieee80211_vif *vif, | ||
1998 | u8 *bssid) | ||
1999 | { | ||
2000 | return ieee80211_find_sta(vif, bssid); | ||
2001 | } | ||
2002 | |||
1858 | #endif | 2003 | #endif |