├── common ├── vht.c ├── cmm_aes.c ├── cmm_wpa.c ├── ee_efuse.c ├── image.bin ├── wsc_tlv.c ├── crypt_hmac.c ├── p2p_packet.c ├── rt2860.bin.dfs ├── rt2870_wow.bin ├── rt_rf.c ├── rtusb_data.c ├── misc.c ├── rtusb_dev_id.c ├── eeprom.c ├── netif_block.c └── cmm_cmd.c ├── sta ├── assoc.c └── p2pcli_assoc.c ├── tools ├── bin2h └── Makefile ├── Kconfig ├── README_STA_usb ├── mcu ├── bin │ ├── MT7601.bin │ ├── MT7650.bin │ ├── RT85592.bin │ ├── rt2860.bin │ ├── rt2870.bin │ ├── MT7601.bin_PRE │ ├── rt2870_wow.bin │ └── MT7601_formal_1.3_Debug.bin └── rtmp_mcu.c ├── include ├── mlme_sys.h ├── wapi_sms4.h ├── video.h ├── netif_block.h ├── vht.h ├── misc.h ├── misc_cmm.h ├── chip │ ├── rt28xx.h │ ├── chip_id.h │ ├── rt3290.h │ └── rt6590.h ├── vrut_ubm.h ├── client_wds_cmm.h ├── client_wds.h ├── rtmp_M51.h ├── action.h ├── mac_ral │ ├── fce.h │ ├── pbf.h │ ├── omac │ │ ├── ral_omac_rf_ctrl.h │ │ ├── ral_omac_usb.h │ │ ├── ral_omac_pbf.h │ │ └── ral_omac_rxwi.h │ ├── nmac │ │ └── ral_nmac_rxwi.h │ └── rf_ctrl.h ├── crypt_arc4.h ├── ap_autoChSel_cmm.h ├── vr_ikans.h ├── rtmp_iface.h ├── rtmp_osabl.h ├── ap_autoChSel.h ├── crypt_md5.h ├── crypt_hmac.h ├── p2p_inf.h ├── ap_ids.h ├── br_ftph.h ├── iface │ ├── iface_util.h │ └── rtmp_usb.h ├── crypt_dh.h ├── rtmp_mcu.h ├── ap_mbss.h ├── sta_cfg.h ├── radar.h ├── rtmp_dot11.h ├── crypt_sha2.h ├── ags.h ├── dot11r_ft.h ├── frq_cal.h ├── crypt_biginteger.h └── link_list.h ├── sta_ate_iwpriv_usage.txt ├── elian ├── os │ └── linux │ │ ├── glue.h │ │ ├── osal.h │ │ ├── osal.c │ │ └── glue.c ├── lib │ ├── plat.h │ ├── sccb.c │ ├── sccb.h │ └── plat_mt7601.c └── msc │ └── msc.h ├── os └── linux │ ├── rt_symb.c │ ├── Makefile.libwapi.6 │ ├── Makefile.libautoprovision.6 │ ├── android_priv_cmd.c │ ├── Makefile.libwapi.4 │ ├── rt_rbus_pci_drv.c │ ├── Makefile.6.prealloc │ ├── vr_bdlt.c │ ├── inf_ppa.c │ ├── Makefile.clean │ ├── Kconfig.sta.soc │ ├── Kconfig.ap.usb │ ├── EEPROMDump.txt │ ├── Makefile.4.util │ ├── Makefile.6.util │ ├── Makefile.4.netif │ ├── Makefile.6.netif │ └── Kconfig.ap.soc ├── RT2870APCard.dat ├── RT2870STACard.dat ├── mgmt ├── mgmt_hw.c ├── mgmt_vht.c └── mgmt_dev.c ├── mac ├── ral_nmac.c └── ral_omac.c ├── ate └── chips │ ├── rt30xx_ate.c │ ├── rt33xx_ate.c │ └── rt5390_ate.c ├── ap ├── ap_wds_inf.c └── ap_ftkd.c ├── RT2870STA.dat ├── RT2870STA_7601.dat ├── MT7601USTA.dat └── RT2870AP.dat /common/vht.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/mt7601u/master/common/vht.c -------------------------------------------------------------------------------- /sta/assoc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/mt7601u/master/sta/assoc.c -------------------------------------------------------------------------------- /tools/bin2h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/mt7601u/master/tools/bin2h -------------------------------------------------------------------------------- /Kconfig: -------------------------------------------------------------------------------- 1 | config MT7601_STA 2 | tristate "MT7601 STA support" 3 | default m 4 | -------------------------------------------------------------------------------- /README_STA_usb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/mt7601u/master/README_STA_usb -------------------------------------------------------------------------------- /common/cmm_aes.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/mt7601u/master/common/cmm_aes.c -------------------------------------------------------------------------------- /common/cmm_wpa.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/mt7601u/master/common/cmm_wpa.c -------------------------------------------------------------------------------- /common/ee_efuse.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/mt7601u/master/common/ee_efuse.c -------------------------------------------------------------------------------- /common/image.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/mt7601u/master/common/image.bin -------------------------------------------------------------------------------- /common/wsc_tlv.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/mt7601u/master/common/wsc_tlv.c -------------------------------------------------------------------------------- /common/crypt_hmac.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/mt7601u/master/common/crypt_hmac.c -------------------------------------------------------------------------------- /common/p2p_packet.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/mt7601u/master/common/p2p_packet.c -------------------------------------------------------------------------------- /mcu/bin/MT7601.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/mt7601u/master/mcu/bin/MT7601.bin -------------------------------------------------------------------------------- /mcu/bin/MT7650.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/mt7601u/master/mcu/bin/MT7650.bin -------------------------------------------------------------------------------- /mcu/bin/RT85592.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/mt7601u/master/mcu/bin/RT85592.bin -------------------------------------------------------------------------------- /mcu/bin/rt2860.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/mt7601u/master/mcu/bin/rt2860.bin -------------------------------------------------------------------------------- /mcu/bin/rt2870.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/mt7601u/master/mcu/bin/rt2870.bin -------------------------------------------------------------------------------- /sta/p2pcli_assoc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/mt7601u/master/sta/p2pcli_assoc.c -------------------------------------------------------------------------------- /common/rt2860.bin.dfs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/mt7601u/master/common/rt2860.bin.dfs -------------------------------------------------------------------------------- /common/rt2870_wow.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/mt7601u/master/common/rt2870_wow.bin -------------------------------------------------------------------------------- /mcu/bin/MT7601.bin_PRE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/mt7601u/master/mcu/bin/MT7601.bin_PRE -------------------------------------------------------------------------------- /mcu/bin/rt2870_wow.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/mt7601u/master/mcu/bin/rt2870_wow.bin -------------------------------------------------------------------------------- /tools/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | gcc -g bin2h.c -o bin2h 3 | clean: 4 | rm -f *.o bin2h 5 | 6 | 7 | -------------------------------------------------------------------------------- /include/mlme_sys.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | 6 | #include "rtmp_type.h" 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /sta_ate_iwpriv_usage.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/mt7601u/master/sta_ate_iwpriv_usage.txt -------------------------------------------------------------------------------- /mcu/bin/MT7601_formal_1.3_Debug.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/mt7601u/master/mcu/bin/MT7601_formal_1.3_Debug.bin -------------------------------------------------------------------------------- /elian/os/linux/glue.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __MSC_GLUE_H__ 3 | #define __MSC_GLUE_H__ 4 | 5 | int msc_proc_create(void *priv); 6 | void msc_proc_destroy(void); 7 | 8 | #endif 9 | 10 | -------------------------------------------------------------------------------- /os/linux/rt_symb.c: -------------------------------------------------------------------------------- 1 | #ifdef OS_ABL_SUPPORT 2 | 3 | #include 4 | #include "rt_config.h" 5 | 6 | EXPORT_SYMBOL(RTMP_DRV_OPS_FUNCTION); 7 | 8 | #endif /* OS_ABL_SUPPORT */ 9 | 10 | -------------------------------------------------------------------------------- /os/linux/Makefile.libwapi.6: -------------------------------------------------------------------------------- 1 | # 2 | # Release file for AP Mode 3 | # 4 | include $(RT28xx_DIR)/os/linux/config.mk 5 | 6 | obj-m := wapi_module.o 7 | 8 | wapi_module-objs := \ 9 | ../../common/wapi_sms4.o\ 10 | ../../common/wapi_crypt.o 11 | -------------------------------------------------------------------------------- /os/linux/Makefile.libautoprovision.6: -------------------------------------------------------------------------------- 1 | include $(RT28xx_DIR)/os/linux/config.mk 2 | 3 | #ifdef CONFIG_AP_SUPPORT 4 | 5 | ifeq ($(HAS_SAMSUNG_EASY_CONFIG_SUPPORT),y) 6 | lib-y := ../../common/auto_provision.o 7 | endif 8 | 9 | #endif // CONFIG_AP_SUPPORT // 10 | -------------------------------------------------------------------------------- /include/wapi_sms4.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | /* SMS4 encryption/decryption definition */ 4 | /* Parameter : */ 5 | /* Input - the incoming message packet */ 6 | /* Ouput - the result ouput */ 7 | /* rk - key */ 8 | void SMS4Crypt(unsigned char *Input, unsigned char *Output, unsigned int *rk); 9 | 10 | /* SMS4 key extend algorithm */ 11 | void SMS4KeyExt(unsigned char *Key, unsigned int *rk, unsigned int CryptFlag); 12 | 13 | -------------------------------------------------------------------------------- /os/linux/android_priv_cmd.c: -------------------------------------------------------------------------------- 1 | 2 | #define RTMP_MODULE_OS 3 | 4 | #include "rt_config.h" 5 | #include "rtmp_comm.h" 6 | #include "rt_os_util.h" 7 | #include "rt_os_net.h" 8 | 9 | #ifdef RT_CFG80211_SUPPORT 10 | int rt_android_private_command_entry( 11 | IN VOID *pAdSrc, 12 | IN VOID *pData, 13 | IN int cmd) 14 | { 15 | //PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)pAdSrc; 16 | 17 | return 0; 18 | } 19 | #endif /* RT_CFG80211_SUPPORT */ 20 | -------------------------------------------------------------------------------- /include/video.h: -------------------------------------------------------------------------------- 1 | #ifdef VIDEO_TURBINE_SUPPORT 2 | extern AP_VIDEO_STRUCT GLOBAL_AP_VIDEO_CONFIG; 3 | 4 | VOID VideoModeUpdate(IN PRTMP_ADAPTER pAd); 5 | VOID VideoModeDynamicTune(IN PRTMP_ADAPTER pAd); 6 | UINT32 GetAsicDefaultRetry(IN PRTMP_ADAPTER pAd); 7 | UCHAR GetAsicDefaultTxBA(IN PRTMP_ADAPTER pAd); 8 | UINT32 GetAsicVideoRetry(IN PRTMP_ADAPTER pAd); 9 | UCHAR GetAsicVideoTxBA(IN PRTMP_ADAPTER pAd); 10 | VOID VideoConfigInit(IN PRTMP_ADAPTER pAd); 11 | #endif /* VIDEO_TURBINE_SUPPORT */ 12 | 13 | -------------------------------------------------------------------------------- /os/linux/Makefile.libwapi.4: -------------------------------------------------------------------------------- 1 | # 2 | # Release file for AP Mode 3 | # 4 | include $(RT28xx_DIR)/os/linux/config.mk 5 | 6 | MOD_NAME = wapi_module 7 | 8 | OBJ := $(MOD_NAME).o 9 | 10 | WAPI_M_OBJ := \ 11 | $(RT28xx_DIR)/common/wapi_sms4.o\ 12 | $(RT28xx_DIR)/common/wapi_crypt.o 13 | 14 | PHONY := all 15 | 16 | all:$(OBJ) 17 | 18 | $(MOD_NAME).o: $(WAPI_M_OBJ) 19 | $(LD) -r $^ -o $@ 20 | 21 | # Declare the contents of the .PHONY variable as phony. We keep that 22 | # information in a variable so we can use it in if_changed and friends. 23 | .PHONY: $(PHONY) -------------------------------------------------------------------------------- /elian/lib/plat.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __MSC_PLAT_H__ 3 | #define __MSC_PLAT_H__ 4 | 5 | #include "sccb.h" 6 | #include "../msc/msc.h" 7 | 8 | int sc_plt_enter_monitor_mode(struct monitor_info *info, void *priv); 9 | int sc_plt_leave_monitor_mode(void *priv); 10 | int sc_plt_set_monitor_chan(struct chan_info *info, void *priv); 11 | char *sc_plt_get_la(void *priv); 12 | void sc_plt_aes128_decrypt(unsigned char *,unsigned int, unsigned char *, 13 | unsigned int, unsigned char *, unsigned int *); 14 | void sc_plt_add_timer(struct etimer *); 15 | int sc_plt_del_timer(struct etimer *); 16 | #endif 17 | -------------------------------------------------------------------------------- /RT2870APCard.dat: -------------------------------------------------------------------------------- 1 | #The word of "Default" must not be removed, maximum 32 cards, 00 ~ 31 2 | Default 3 | 4 | #CARDID, MAC, CARDTYPE 5 | SELECT=CARDTYPE 6 | 7 | 00CARDID=/etc/Wireless/RT2870AP/RT2870AP1.dat 8 | 01CARDID=/etc/Wireless/RT2870AP/RT2870AP2.dat 9 | 02CARDID=/etc/Wireless/RT2870AP/RT2870AP3.dat 10 | 11 | 00MAC00:0E:2E:C3:D0:48=/etc/Wireless/RT2870AP/RT2870AP1.dat 12 | 01MAC00:40:F4:FF:AA:40=/etc/Wireless/RT2870AP/RT2870AP2.dat 13 | 02MAC00:0C:43:10:11:5C=/etc/Wireless/RT2870AP/RT2870AP3.dat 14 | 15 | 00CARDTYPEbgn=/etc/Wireless/RT2870AP/RT2870AP1.dat 16 | 01CARDTYPEbgn=/etc/Wireless/RT2870AP/RT2870AP2.dat 17 | 02CARDTYPEabgn=/etc/Wireless/RT2870AP/RT2870AP3.dat 18 | 19 | 20 | -------------------------------------------------------------------------------- /RT2870STACard.dat: -------------------------------------------------------------------------------- 1 | #The word of "Default" must not be removed, maximum 32 cards, 00 ~ 31 2 | Default 3 | 4 | #CARDID, MAC, CARDTYPE 5 | SELECT=CARDTYPE 6 | 7 | 00CARDID=/etc/Wireless/RT2870STA/RT2870STA1.dat 8 | 01CARDID=/etc/Wireless/RT2870STA/RT2870STA2.dat 9 | 02CARDID=/etc/Wireless/RT2870STA/RT2870STA3.dat 10 | 11 | 00MAC00:0E:2E:C3:D0:48=/etc/Wireless/RT2870STA/RT2870STA1.dat 12 | 01MAC00:40:F4:FF:AA:40=/etc/Wireless/RT2870STA/RT2870STA2.dat 13 | 02MAC00:0C:43:10:11:5C=/etc/Wireless/RT2870STA/RT2870STA3.dat 14 | 15 | 00CARDTYPEbgn=/etc/Wireless/RT2870STA/RT2870STA1.dat 16 | 01CARDTYPEbgn=/etc/Wireless/RT2870STA/RT2870STA2.dat 17 | 02CARDTYPEabgn=/etc/Wireless/RT2870STA/RT2870STA3.dat 18 | 19 | 20 | -------------------------------------------------------------------------------- /mgmt/mgmt_hw.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | 4 | */ 5 | 6 | 7 | #include 8 | 9 | 10 | INT dev_adjust_radio(RTMP_ADAPTER *pAd) 11 | { 12 | struct hw_setting *hw_cfg = &pAd->hw_cfg, new_cfg; 13 | 14 | 15 | NdisZeroMemory(&new_cfg, sizeof(struct hw_setting)); 16 | 17 | 18 | /* For all wdev, find the maximum inter-set */ 19 | 20 | 21 | if (hw_cfg->bbp_bw != new_cfg.bbp_bw) 22 | { 23 | rtmp_bbp_set_bw(pAd, new_cfg.bbp_bw); 24 | hw_cfg->bbp_bw = new_cfg.bbp_bw; 25 | } 26 | 27 | if (hw_cfg->cent_ch != new_cfg.cent_ch) 28 | { 29 | UCHAR ext_ch = EXTCHA_NONE; 30 | 31 | rtmp_bbp_set_ctrlch(pAd, ext_ch); 32 | rtmp_mac_set_ctrlch(pAd, ext_ch); 33 | } 34 | 35 | return TRUE; 36 | } 37 | 38 | -------------------------------------------------------------------------------- /include/netif_block.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __NET_IF_BLOCK_H__ 3 | #define __NET_IF_BLOCK_H__ 4 | 5 | #include "link_list.h" 6 | #include "rtmp.h" 7 | 8 | #define FREE_NETIF_POOL_SIZE 32 9 | 10 | typedef struct _NETIF_ENTRY 11 | { 12 | struct _NETIF_ENTRY *pNext; 13 | PNET_DEV pNetDev; 14 | } NETIF_ENTRY, *PNETIF_ENTRY; 15 | 16 | void initblockQueueTab( 17 | IN PRTMP_ADAPTER pAd); 18 | 19 | BOOLEAN blockNetIf( 20 | IN PBLOCK_QUEUE_ENTRY pBlockQueueEntry, 21 | IN PNET_DEV pNetDev); 22 | 23 | VOID releaseNetIf( 24 | IN PBLOCK_QUEUE_ENTRY pBlockQueueEntry); 25 | 26 | VOID StopNetIfQueue( 27 | IN PRTMP_ADAPTER pAd, 28 | IN UCHAR QueIdx, 29 | IN PNDIS_PACKET pPacket); 30 | #endif /* __NET_IF_BLOCK_H__ */ 31 | 32 | -------------------------------------------------------------------------------- /mac/ral_nmac.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | 6 | #include "rt_config.h" 7 | 8 | 9 | INT get_pkt_phymode_by_rxwi(RXWI_STRUC *rxwi) 10 | { 11 | return rxwi->RXWI_N.phy_mode; 12 | } 13 | 14 | INT get_pkt_rssi_by_rxwi(struct _RTMP_ADAPTER *pAd, RXWI_STRUC *rxwi, INT size, CHAR *rssi) 15 | { 16 | if (size < sizeof(rxwi->RXWI_N.rssi)/ sizeof(UINT8)) 17 | NdisMoveMemory(rssi, &rxwi->RXWI_N.rssi[0], size); 18 | 19 | return 0; 20 | } 21 | 22 | 23 | INT get_pkt_snr_by_rxwi(struct _RTMP_ADAPTER *pAd, RXWI_STRUC *rxwi, INT size, UCHAR *snr) 24 | { 25 | // TODO: shiang-6590, fix me for SNR info of RXWI!! 26 | if (size < 3) 27 | NdisMoveMemory(snr, &rxwi->RXWI_N.bbp_rxinfo[0], size); 28 | 29 | return 0; 30 | } 31 | 32 | -------------------------------------------------------------------------------- /os/linux/rt_rbus_pci_drv.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * Taiwan, R.O.C. 4 | * 5 | * (c) Copyright 2002, Ralink Technology, Inc. 6 | * 7 | * All rights reserved. Ralink's source code is an unpublished work and the 8 | * use of a copyright notice does not imply otherwise. This source code 9 | * contains confidential trade secret material of Ralink Tech. Any attemp 10 | * or participation in deciphering, decoding, reverse engineering or in any 11 | * way altering the source code is stricitly prohibited, unless the prior 12 | * written consent of Ralink Technology, Inc. is obtained. 13 | ***************************************************************************/ 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /elian/msc/msc.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __MSC_H__ 3 | #define __MSC_H__ 4 | 5 | #include "core.h" 6 | 7 | #define MSC_RESULT_BUFFER_SIZE 256 8 | typedef void (*msc_evt_cb)(unsigned int eid); 9 | 10 | struct msc_param { 11 | msc_evt_cb evt_cb; 12 | int chl_num; 13 | unsigned char *chls; 14 | unsigned char *key; 15 | void *reserved; 16 | }; 17 | 18 | struct msc_result { 19 | unsigned char auth_mode; 20 | unsigned char cust_data_len; 21 | char ssid[33]; 22 | char pwd[65]; 23 | char user[65]; 24 | char cust_data[256]; 25 | }; 26 | 27 | int msc_start(struct msc_param *p, void *priv); 28 | void msc_stop(void *pirv); 29 | int msc_reset(void); 30 | int msc_get_result(struct msc_result *result); 31 | int msc_cmd_handler(char *cmd, int len, char *result_str, void *priv); 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /mgmt/mgmt_vht.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | #include "rt_config.h" 6 | 7 | 8 | #ifdef DOT11_VHT_AC 9 | 10 | VOID rtmp_set_vht(RTMP_ADAPTER *pAd, RT_PHY_INFO *phy_info) 11 | { 12 | if (!phy_info) 13 | return; 14 | 15 | if (phy_info->bVhtEnable) 16 | phy_info->vht_bw = VHT_BW_80; 17 | 18 | } 19 | 20 | 21 | INT SetCommonVHT(RTMP_ADAPTER *pAd) 22 | { 23 | UCHAR cent_ch = 0; 24 | 25 | if (!WMODE_CAP_AC(pAd->CommonCfg.PhyMode)) 26 | { 27 | /* Clear previous VHT information */ 28 | return FALSE; 29 | } 30 | 31 | 32 | pAd->CommonCfg.vht_cent_ch = vht_cent_ch_freq(pAd, pAd->CommonCfg.Channel); 33 | 34 | DBGPRINT(RT_DEBUG_TRACE, ("%s(): Config VHT parameters!cent_ch=%d!vht_cent_ch = %d, vht_cent_ch2 = %d\n", 35 | __FUNCTION__, cent_ch, pAd->CommonCfg.vht_cent_ch, pAd->CommonCfg.vht_cent_ch2)); 36 | return TRUE; 37 | } 38 | 39 | #endif /* DOT11_VHT_AC */ 40 | -------------------------------------------------------------------------------- /include/vht.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | #include "dot11ac_vht.h" 6 | 7 | 8 | struct _RTMP_ADAPTER; 9 | struct _RT_PHY_INFO; 10 | 11 | 12 | VOID dump_vht_cap(struct _RTMP_ADAPTER *pAd, VHT_CAP_IE *vht_ie); 13 | VOID dump_vht_op(struct _RTMP_ADAPTER *pAd, VHT_OP_IE *vht_ie); 14 | 15 | INT build_vht_ies(struct _RTMP_ADAPTER *pAd, UCHAR *buf, UCHAR frm); 16 | INT build_vht_cap_ie(RTMP_ADAPTER *pAd, UCHAR *buf); 17 | 18 | UCHAR vht_cent_ch_freq(struct _RTMP_ADAPTER *pAd, UCHAR prim_ch); 19 | INT vht_mode_adjust(struct _RTMP_ADAPTER *pAd, MAC_TABLE_ENTRY *pEntry, VHT_CAP_IE *cap, VHT_OP_IE *op); 20 | INT SetCommonVHT(struct _RTMP_ADAPTER *pAd); 21 | VOID rtmp_set_vht(struct _RTMP_ADAPTER *pAd, struct _RT_PHY_INFO *phy_info); 22 | 23 | void assoc_vht_info_debugshow( 24 | IN RTMP_ADAPTER *pAd, 25 | IN MAC_TABLE_ENTRY *pEntry, 26 | IN VHT_CAP_IE *vht_cap, 27 | IN VHT_OP_IE *vht_op); 28 | 29 | -------------------------------------------------------------------------------- /ate/chips/rt30xx_ate.c: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002-2011, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | rt5592_ate.c 20 | 21 | Abstract: 22 | Specific ATE funcitons and variables for RT5572/RT5592 23 | 24 | Revision History: 25 | Who When What 26 | -------- ---------- ---------------------------------------------- 27 | */ 28 | 29 | -------------------------------------------------------------------------------- /ate/chips/rt33xx_ate.c: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002-2011, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | rt5592_ate.c 20 | 21 | Abstract: 22 | Specific ATE funcitons and variables for RT5572/RT5592 23 | 24 | Revision History: 25 | Who When What 26 | -------- ---------- ---------------------------------------------- 27 | */ 28 | 29 | -------------------------------------------------------------------------------- /ate/chips/rt5390_ate.c: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002-2011, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | rt5592_ate.c 20 | 21 | Abstract: 22 | Specific ATE funcitons and variables for RT5572/RT5592 23 | 24 | Revision History: 25 | Who When What 26 | -------- ---------- ---------------------------------------------- 27 | */ 28 | 29 | 30 | -------------------------------------------------------------------------------- /include/misc.h: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002-2009, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | misc.h 20 | 21 | Abstract: 22 | 23 | Handling Misc Problem 24 | 25 | Revision History: 26 | Who When What 27 | -------- ---------- ---------------------------------------------- 28 | Sean Wang 2009-08-12 Create 29 | John Li 2009-12-23 Modified 30 | */ 31 | 32 | 33 | -------------------------------------------------------------------------------- /common/rt_rf.c: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002-2004, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | rt_rf.c 20 | 21 | Abstract: 22 | Ralink Wireless driver RF related functions 23 | 24 | Revision History: 25 | Who When What 26 | -------- ---------- ---------------------------------------------- 27 | */ 28 | 29 | 30 | #include "rt_config.h" 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /include/misc_cmm.h: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002-2009, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | misc_cmm.h 20 | 21 | Abstract: 22 | 23 | Handling Misc Problem 24 | 25 | Revision History: 26 | Who When What 27 | -------- ---------- ---------------------------------------------- 28 | Sean Wang 2009-08-12 Create 29 | John Li 2009-12-23 Modified 30 | */ 31 | 32 | 33 | -------------------------------------------------------------------------------- /common/rtusb_data.c: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002-2005, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | rtusb_data.c 20 | 21 | Abstract: 22 | Ralink USB driver Tx/Rx functions. 23 | 24 | Revision History: 25 | Who When What 26 | -------- ---------- ---------------------------------------------- 27 | Jan 03-25-2006 created 28 | 29 | */ 30 | 31 | 32 | -------------------------------------------------------------------------------- /ap/ap_wds_inf.c: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | *************************************************************************** 4 | * Ralink Tech Inc. 5 | * 4F, No. 2 Technology 5th Rd. 6 | * Science-based Industrial Park 7 | * Hsin-chu, Taiwan, R.O.C. 8 | * 9 | * (c) Copyright 2002, Ralink Technology, Inc. 10 | * 11 | * All rights reserved. Ralink's source code is an unpublished work and the 12 | * use of a copyright notice does not imply otherwise. This source code 13 | * contains confidential trade secret material of Ralink Tech. Any attemp 14 | * or participation in deciphering, decoding, reverse engineering or in any 15 | * way altering the source code is stricitly prohibited, unless the prior 16 | * written consent of Ralink Technology, Inc. is obtained. 17 | *************************************************************************** 18 | 19 | Module Name: 20 | ap_wds.c 21 | 22 | Abstract: 23 | Support WDS function. 24 | 25 | Revision History: 26 | Who When What 27 | ------ ---------- ---------------------------------------------- 28 | Fonchi 02-13-2007 created 29 | */ 30 | #define RTMP_MODULE_OS 31 | 32 | -------------------------------------------------------------------------------- /common/misc.c: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002-2009, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | misc.c 20 | 21 | Abstract: 22 | 23 | Handling Misc Problem 24 | 25 | Revision History: 26 | Who When What 27 | -------- ---------- ---------------------------------------------- 28 | Sean Wang 2009-08-12 Create 29 | John Li 2009-11-30 Modified 30 | */ 31 | 32 | #include "rt_config.h" 33 | #include "misc.h" 34 | 35 | 36 | -------------------------------------------------------------------------------- /mac/ral_omac.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | 6 | #include "rt_config.h" 7 | 8 | 9 | INT get_pkt_phymode_by_rxwi(RXWI_STRUC *rxwi) 10 | { 11 | return rxwi->RXWI_O.phy_mode; 12 | } 13 | 14 | INT get_pkt_rssi_by_rxwi(struct _RTMP_ADAPTER *pAd, RXWI_STRUC *rxwi, INT size, CHAR *rssi) 15 | { 16 | switch (size) { 17 | case 3: 18 | rssi[2] = rxwi->RxWIRSSI2; 19 | case 2: 20 | rssi[1] = rxwi->RxWIRSSI1; 21 | case 1: 22 | default: 23 | #ifdef MT7601 24 | if ( IS_MT7601(pAd) ) 25 | rssi[0] = rxwi->RxWISNR2; 26 | else 27 | #endif /* MT7601 */ 28 | rssi[0] = rxwi->RxWIRSSI0; 29 | break; 30 | } 31 | 32 | return 0; 33 | } 34 | 35 | 36 | INT get_pkt_snr_by_rxwi(struct _RTMP_ADAPTER *pAd, RXWI_STRUC *rxwi, INT size, UCHAR *snr) 37 | { 38 | 39 | #ifdef MT7601 40 | /* 41 | snr[2] = Gain Report 42 | snr[1] = Antenna report 43 | */ 44 | 45 | if ( IS_MT7601(pAd) ) 46 | { 47 | snr[0] = rxwi->RxWISNR0; 48 | snr[1] = 0; 49 | snr[2] = 0; 50 | return 0; 51 | } 52 | #endif /* MT7601 */ 53 | 54 | switch (size) { 55 | case 3: 56 | snr[2] = rxwi->RxWISNR2; 57 | case 2: 58 | snr[1] = rxwi->RxWISNR1; 59 | case 1: 60 | default: 61 | snr[0] = rxwi->RxWISNR0; 62 | break; 63 | } 64 | 65 | return 0; 66 | } 67 | 68 | -------------------------------------------------------------------------------- /include/chip/rt28xx.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * 4F, No. 2 Technology 5th Rd. 4 | * Science-based Industrial Park 5 | * Hsin-chu, Taiwan, R.O.C. 6 | * (c) Copyright 2002, Ralink Technology, Inc. 7 | * 8 | * All rights reserved. Ralink's source code is an unpublished work and the 9 | * use of a copyright notice does not imply otherwise. This source code 10 | * contains confidential trade secret material of Ralink Tech. Any attemp 11 | * or participation in deciphering, decoding, reverse engineering or in any 12 | * way altering the source code is stricitly prohibited, unless the prior 13 | * written consent of Ralink Technology, Inc. is obtained. 14 | **************************************************************************** 15 | 16 | Module Name: 17 | rt28xx.h 18 | 19 | Abstract: 20 | 21 | Revision History: 22 | Who When What 23 | --------- ---------- ---------------------------------------------- 24 | */ 25 | 26 | #ifndef __RT28XX_H__ 27 | #define __RT28XX_H__ 28 | 29 | #ifdef RT28xx 30 | 31 | VOID RT28xx_ChipSwitchChannel( 32 | IN struct _RTMP_ADAPTER *pAd, 33 | IN UCHAR Channel, 34 | IN BOOLEAN bScan); 35 | 36 | #endif /* RT28xx */ 37 | 38 | #endif /*__RT28XX_H__ */ 39 | 40 | -------------------------------------------------------------------------------- /mgmt/mgmt_dev.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | #include "rt_config.h" 6 | 7 | 8 | struct wifi_dev *get_wdev_by_idx(RTMP_ADAPTER *pAd, INT idx) 9 | { 10 | struct wifi_dev *wdev = NULL; 11 | 12 | do 13 | { 14 | #if define(P2P_SUPPORT) || define(SOFTAP_SUPPORT) 15 | if (idx >= MIN_NET_DEVICE_FOR_P2P_GO) 16 | { 17 | wdev = &pAd->ApCfg.MBSSID[idx - MIN_NET_DEVICE_FOR_P2P_GO].wdev; 18 | break; 19 | } 20 | #endif /* P2P_SUPPORT */ 21 | 22 | 23 | #ifdef CONFIG_AP_SUPPORT 24 | #ifdef APCLI_SUPPORT 25 | if (idx >= MIN_NET_DEVICE_FOR_APCLI) 26 | { 27 | idx -= MIN_NET_DEVICE_FOR_APCLI; 28 | if (idx < MAX_APCLI_NUM) 29 | { 30 | wdev = &pAd->ApCfg.ApCliTab[idx].wdev; 31 | break; 32 | } 33 | } 34 | #endif /* APCLI_SUPPORT */ 35 | 36 | IF_DEV_CONFIG_OPMODE_ON_AP(pAd) 37 | { 38 | 39 | if ((idx < pAd->ApCfg.BssidNum) && (idx < MAX_MBSSID_NUM(pAd)) && (idx < HW_BEACON_MAX_NUM)) 40 | wdev = &pAd->ApCfg.MBSSID[idx].wdev; 41 | 42 | break; 43 | } 44 | #endif /* CONFIG_AP_SUPPORT */ 45 | #ifdef CONFIG_STA_SUPPORT 46 | IF_DEV_CONFIG_OPMODE_ON_STA(pAd) 47 | { 48 | wdev = &pAd->StaCfg.wdev; 49 | break; 50 | } 51 | #endif /* CONFIG_STA_SUPPORT */ 52 | } while (FALSE); 53 | 54 | if (wdev == NULL) 55 | { 56 | DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetIndividualHT: invalid idx(%d)\n", idx)); 57 | } 58 | 59 | return wdev; 60 | } 61 | 62 | -------------------------------------------------------------------------------- /os/linux/Makefile.6.prealloc: -------------------------------------------------------------------------------- 1 | include $(RT28xx_DIR)/os/linux/config.mk 2 | 3 | #ifdef CONFIG_STA_SUPPORT 4 | ifeq ($(RT28xx_MODE), STA) 5 | ifneq ($(findstring 7601,$(CHIPSET)),) 6 | MOD_NAME = mtprealloc 7 | else 8 | MOD_NAME = rtprealloc$(MODULE)sta 9 | endif 10 | endif 11 | #endif // CONFIG_STA_SUPPORT // 12 | 13 | #ifdef CONFIG_APSTA_SUPPORT 14 | ifeq ($(RT28xx_MODE), APSTA) 15 | MOD_NAME = rtprealloc$(MODULE)apsta 16 | endif 17 | #endif // CONFIG_APSTA_SUPPORT // 18 | 19 | obj-m := $(MOD_NAME).o 20 | 21 | 22 | #ifdef CONFIG_STA_SUPPORT 23 | ifeq ($(RT28xx_MODE), STA) 24 | $(MOD_NAME)-objs := prealloc.o 25 | endif 26 | #endif // CONFIG_STA_SUPPORT // 27 | 28 | 29 | #ifdef CONFIG_APSTA_SUPPORT 30 | ifeq ($(RT28xx_MODE), APSTA) 31 | $(MOD_NAME)-objs := \ 32 | ../../prealloc.o 33 | 34 | ifeq ($(PLATFORM),BL2348) 35 | $(MOD_NAME)-objs += \ 36 | ../../os/linux/vr_bdlt.o 37 | endif 38 | 39 | ifeq ($(PLATFORM),BLUBB) 40 | $(MOD_NAME)-objs += \ 41 | ../../os/linux/vr_bdlt.o 42 | endif 43 | 44 | ifeq ($(HAS_BGFP_SUPPORT),y) 45 | $(MOD_NAME)-objs += \ 46 | ../../os/linux/br_ftph.o 47 | endif 48 | endif 49 | #endif // CONFIG_APSTA_SUPPORT // 50 | 51 | clean: 52 | rm -f ../../prealloc.o 53 | 54 | install: 55 | install -d $(LINUX_SRC_MODULE) 56 | install -m 644 -c $(addsuffix .ko,$(MOD_NAME)) $(LINUX_SRC_MODULE) 57 | #/sbin/depmod -a ${shell uname -r} 58 | 59 | uninstall: 60 | rm -rf $(addprefix $(LINUX_SRC_MODULE),$(addsuffix .ko,$(MOD_NAME))) 61 | /sbin/depmod -a ${shell uname -r} 62 | -------------------------------------------------------------------------------- /include/vrut_ubm.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * Taiwan, R.O.C. 4 | * 5 | * (c) Copyright 2010, Ralink Technology, Inc. 6 | * 7 | * All rights reserved. Ralink's source code is an unpublished work and the 8 | * use of a copyright notice does not imply otherwise. This source code 9 | * contains confidential trade secret material of Ralink Tech. Any attemp 10 | * or participation in deciphering, decoding, reverse engineering or in any 11 | * way altering the source code is stricitly prohibited, unless the prior 12 | * written consent of Ralink Technology, Inc. is obtained. 13 | ***************************************************************************/ 14 | 15 | /**************************************************************************** 16 | 17 | Abstract: 18 | 19 | All Related Structure & Definition for UBICOM platform. 20 | 21 | Only used in UTIL module. 22 | 23 | ***************************************************************************/ 24 | 25 | #ifndef __VR_UBICOM_H__ 26 | #define __VR_UBICOM_H__ 27 | 28 | #ifdef PLATFORM_UBM_IPX8 29 | 30 | #include 31 | 32 | #undef RTMP_UTIL_DCACHE_FLUSH 33 | #define RTMP_UTIL_DCACHE_FLUSH(__AddrStart, __Size) \ 34 | flush_dcache_range((ULONG)(__AddrStart), \ 35 | (ULONG)(((UCHAR *)(__AddrStart)) + __Size - 1)) 36 | 37 | #endif /* PLATFORM_UBM_IPX8 */ 38 | 39 | #endif /* __VR_UBICOM_H__ */ 40 | 41 | /* End of vrut_ubm.h */ 42 | 43 | -------------------------------------------------------------------------------- /include/client_wds_cmm.h: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | client_wds_cmm.h 20 | 21 | Abstract: 22 | */ 23 | 24 | #ifndef __CLIENT_WDS_CMM_H__ 25 | #define __CLIENT_WDS_CMM_H__ 26 | 27 | #include "rtmp_def.h" 28 | 29 | #ifdef CLIENT_WDS 30 | 31 | 32 | #define CLI_WDS_ENTRY_AGEOUT 5000 /* seconds */ 33 | 34 | #define CLIWDS_POOL_SIZE 128 35 | #define CLIWDS_HASH_TAB_SIZE 64 /* the legth of hash table must be power of 2. */ 36 | typedef struct _CLIWDS_PROXY_ENTRY { 37 | struct _CLIWDS_PROXY_ENTRY * pNext; 38 | ULONG LastRefTime; 39 | SHORT Aid; 40 | UCHAR Addr[MAC_ADDR_LEN]; 41 | } CLIWDS_PROXY_ENTRY, *PCLIWDS_PROXY_ENTRY; 42 | 43 | #endif /* CLIENT_WDS */ 44 | 45 | #endif /* __CLIENT_WDS_CMM_H__ */ 46 | 47 | -------------------------------------------------------------------------------- /include/client_wds.h: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | client_wds.h 20 | 21 | Abstract: 22 | */ 23 | 24 | #ifndef __CLIENT_WDS_H__ 25 | #define __CLIENT_WDS_H__ 26 | 27 | #include "client_wds_cmm.h" 28 | 29 | VOID CliWds_ProxyTabInit( 30 | IN PRTMP_ADAPTER pAd); 31 | 32 | VOID CliWds_ProxyTabDestory( 33 | IN PRTMP_ADAPTER pAd); 34 | 35 | PCLIWDS_PROXY_ENTRY CliWdsEntyAlloc( 36 | IN PRTMP_ADAPTER pAd); 37 | 38 | 39 | VOID CliWdsEntyFree( 40 | IN PRTMP_ADAPTER pAd, 41 | IN PCLIWDS_PROXY_ENTRY pCliWdsEntry); 42 | 43 | 44 | PUCHAR CliWds_ProxyLookup( 45 | IN PRTMP_ADAPTER pAd, 46 | IN PUCHAR pMac); 47 | 48 | 49 | VOID CliWds_ProxyTabUpdate( 50 | IN PRTMP_ADAPTER pAd, 51 | IN SHORT Aid, 52 | IN PUCHAR pMac); 53 | 54 | 55 | VOID CliWds_ProxyTabMaintain( 56 | IN PRTMP_ADAPTER pAd); 57 | 58 | #endif /* __CLIENT_WDS_H__ */ 59 | 60 | -------------------------------------------------------------------------------- /include/rtmp_M51.h: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002-2004, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | rtmp_M51.h 20 | 21 | Abstract: 22 | Miniport header file for mcu related information 23 | 24 | Revision History: 25 | Who When What 26 | -------- ---------- ---------------------------------------------- 27 | */ 28 | 29 | #ifndef __RTMP_M51_H__ 30 | #define __RTMP_M51_H__ 31 | 32 | struct _RTMP_ADAPTER; 33 | 34 | INT RtmpAsicEraseFirmware( 35 | struct _RTMP_ADAPTER *pAd); 36 | 37 | NDIS_STATUS RtmpAsicLoadFirmware( 38 | struct _RTMP_ADAPTER *pAd); 39 | 40 | NDIS_STATUS isMCUnotReady( 41 | struct _RTMP_ADAPTER *pAd); 42 | 43 | #if 0 44 | NDIS_STATUS isMCUNeedToLoadFIrmware( 45 | struct _RTMP_ADAPTER *pAd); 46 | #endif 47 | 48 | INT RtmpAsicSendCommandToMcu( 49 | struct _RTMP_ADAPTER *pAd, 50 | UCHAR Command, 51 | UCHAR Token, 52 | UCHAR Arg0, 53 | UCHAR Arg1, 54 | BOOLEAN FlgIsNeedLocked); 55 | #endif 56 | -------------------------------------------------------------------------------- /common/rtusb_dev_id.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * 4F, No. 2 Technology 5th Rd. 4 | * Science-based Industrial Park 5 | * Hsin-chu, Taiwan, R.O.C. 6 | * (c) Copyright 2002, Ralink Technology, Inc. 7 | * 8 | * All rights reserved. Ralink's source code is an unpublished work and the 9 | * use of a copyright notice does not imply otherwise. This source code 10 | * contains confidential trade secret material of Ralink Tech. Any attemp 11 | * or participation in deciphering, decoding, reverse engineering or in any 12 | * way altering the source code is stricitly prohibited, unless the prior 13 | * written consent of Ralink Technology, Inc. is obtained. 14 | **************************************************************************** 15 | 16 | Module Name: 17 | rtusb_dev_id.c 18 | 19 | Abstract: 20 | 21 | Revision History: 22 | Who When What 23 | --------- ---------- ---------------------------------------------- 24 | */ 25 | 26 | #define RTMP_MODULE_OS 27 | 28 | /*#include "rt_config.h"*/ 29 | #include "rtmp_comm.h" 30 | #include "rt_os_util.h" 31 | #include "rt_os_net.h" 32 | 33 | 34 | /* module table */ 35 | USB_DEVICE_ID rtusb_dev_id[] = { 36 | #ifdef RT6570 37 | {USB_DEVICE(0x148f,0x6570)}, /* Ralink 6570 */ 38 | #endif /* RT6570 */ 39 | {USB_DEVICE(0x148f, 0x7650)}, /* MT7650 */ 40 | #ifdef MT7601U 41 | {USB_DEVICE(0x148f,0x6370)}, /* Ralink 6370 */ 42 | {USB_DEVICE(0x148f,0x7601)}, /* MT 6370 */ 43 | #endif /* MT7601U */ 44 | { }/* Terminating entry */ 45 | }; 46 | 47 | INT const rtusb_usb_id_len = sizeof(rtusb_dev_id) / sizeof(USB_DEVICE_ID); 48 | MODULE_DEVICE_TABLE(usb, rtusb_dev_id); 49 | -------------------------------------------------------------------------------- /include/action.h: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002-2004, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | aironet.h 20 | 21 | Abstract: 22 | 23 | Revision History: 24 | Who When What 25 | -------- ---------- ---------------------------------------------- 26 | Name Date Modification logs 27 | Paul Lin 04-06-15 Initial 28 | */ 29 | 30 | #ifndef __ACTION_H__ 31 | #define __ACTION_H__ 32 | 33 | typedef struct GNU_PACKED __HT_INFO_OCTET { 34 | #ifdef RT_BIG_ENDIAN 35 | UCHAR Reserved:5; 36 | UCHAR STA_Channel_Width:1; 37 | UCHAR Forty_MHz_Intolerant:1; 38 | UCHAR Request:1; 39 | #else 40 | UCHAR Request:1; 41 | UCHAR Forty_MHz_Intolerant:1; 42 | UCHAR STA_Channel_Width:1; 43 | UCHAR Reserved:5; 44 | #endif 45 | } HT_INFORMATION_OCTET; 46 | 47 | typedef struct GNU_PACKED __FRAME_HT_INFO { 48 | HEADER_802_11 Hdr; 49 | UCHAR Category; 50 | UCHAR Action; 51 | HT_INFORMATION_OCTET HT_Info; 52 | } FRAME_HT_INFO, *PFRAME_HT_INFO; 53 | 54 | #endif /* __ACTION_H__ */ 55 | -------------------------------------------------------------------------------- /os/linux/vr_bdlt.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | 3 | Module Name: 4 | vr_brlt.c 5 | 6 | Abstract: 7 | Only for BroadLight 2348 platform. 8 | 9 | Revision History: 10 | Who When What 11 | --------- ---------- ---------------------------------------------- 12 | Sample Lin 01-12-2010 Created 13 | 14 | ***************************************************************************/ 15 | 16 | #define RTMP_MODULE_OS 17 | #define RTMP_MODULE_OS_UTIL 18 | 19 | #define MODULE_BDLT 20 | 21 | /*#include "rt_config.h" */ 22 | #include "rtmp_comm.h" 23 | #include "rt_os_util.h" 24 | #include "rtmp_osabl.h" 25 | 26 | 27 | #if defined(PLATFORM_BL2348) || defined(PLATFORM_BL23570) 28 | 29 | /* global variables */ 30 | int (*pToUpperLayerPktSent)(struct sk_buff *pSkb) = netif_rx ; 31 | 32 | 33 | 34 | 35 | /* 36 | ======================================================================== 37 | Routine Description: 38 | Assign the briding function. 39 | 40 | Arguments: 41 | xi_destination_ptr - bridging function 42 | 43 | Return Value: 44 | None 45 | 46 | Note: 47 | The function name must be replace_upper_layer_packet_destination. 48 | ======================================================================== 49 | */ 50 | VOID replace_upper_layer_packet_destination(VOID *pXiDestination) 51 | { 52 | DBGPRINT(RT_DEBUG_TRACE, ("ralink broad light> replace_upper_layer_packet_destination\n")); 53 | pToUpperLayerPktSent = pXiDestination ; 54 | } /* End of replace_upper_layer_packet_destination */ 55 | 56 | 57 | EXPORT_SYMBOL(pToUpperLayerPktSent); 58 | EXPORT_SYMBOL(replace_upper_layer_packet_destination); 59 | 60 | #endif /* PLATFORM_BL2348 */ 61 | 62 | 63 | /* End of vr_bdlt.c */ 64 | -------------------------------------------------------------------------------- /RT2870STA.dat: -------------------------------------------------------------------------------- 1 | #The word of "Default" must not be removed 2 | Default 3 | CountryRegion=5 4 | CountryRegionABand=7 5 | CountryCode= 6 | ChannelGeography=1 7 | SSID=11n-AP 8 | NetworkType=Infra 9 | WirelessMode=9 10 | Channel=0 11 | BeaconPeriod=100 12 | TxPower=100 13 | BGProtection=0 14 | TxPreamble=0 15 | RTSThreshold=2347 16 | FragThreshold=2346 17 | TxBurst=1 18 | PktAggregate=0 19 | WmmCapable=1 20 | AckPolicy=0;0;0;0 21 | AuthMode=OPEN 22 | EncrypType=NONE 23 | WPAPSK= 24 | DefaultKeyID=1 25 | Key1Type=0 26 | Key1Str= 27 | Key2Type=0 28 | Key2Str= 29 | Key3Type=0 30 | Key3Str= 31 | Key4Type=0 32 | Key4Str= 33 | PSMode=CAM 34 | AutoRoaming=0 35 | RoamThreshold=70 36 | APSDCapable=0 37 | APSDAC=0;0;0;0 38 | HT_RDG=1 39 | HT_EXTCHA=0 40 | HT_OpMode=0 41 | HT_MpduDensity=4 42 | HT_BW=1 43 | HT_BADecline=0 44 | HT_AutoBA=1 45 | HT_AMSDU=0 46 | HT_BAWinSize=64 47 | HT_GI=1 48 | HT_MCS=33 49 | HT_MIMOPSMode=3 50 | HT_DisallowTKIP=1 51 | HT_STBC=0 52 | EthConvertMode= 53 | EthCloneMac= 54 | IEEE80211H=0 55 | TGnWifiTest=0 56 | WirelessEvent=0 57 | MeshId=MESH 58 | MeshAutoLink=1 59 | MeshAuthMode=OPEN 60 | MeshEncrypType=NONE 61 | MeshWPAKEY= 62 | MeshDefaultkey=1 63 | MeshWEPKEY= 64 | CarrierDetect=0 65 | AntDiversity=0 66 | BeaconLostTime=4 67 | FtSupport=0 68 | Wapiifname=ra0 69 | WapiPsk= 70 | WapiPskType= 71 | WapiUserCertPath= 72 | WapiAsCertPath= 73 | PSP_XLINK_MODE=0 74 | WscManufacturer= 75 | WscModelName= 76 | WscDeviceName= 77 | WscModelNumber= 78 | WscSerialNumber= 79 | RadioOn=1 80 | WIDIEnable=1 81 | P2P_L2SD_SCAN_TOGGLE=3 82 | Wsc4digitPinCode=0 83 | P2P_WIDIEnable=0 84 | PMFMFPC=0 85 | PMFMFPR=0 86 | PMFSHA256=0 87 | RSSI_THR1=-45 88 | RSSI_THR2=-60 89 | RSSI_THR3=-75 90 | NOISE_RSSI_THR1=-62 91 | NOISE_RSSI_THR2=-70 92 | NOISE_RSSI_THR3=-75 93 | FCCA_THR1=800 94 | FCCA_THR2=10 95 | DYPD_ENABLE=1 96 | -------------------------------------------------------------------------------- /include/mac_ral/fce.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | #ifndef __FCE_H__ 6 | #define __FCE_H__ 7 | 8 | #include "rt_config.h" 9 | 10 | #define FCE_PSE_CTRL 0x0800 11 | #define FCE_CSO 0x0808 12 | #define FCE_L2_STUFF 0x080c 13 | #define TX_CPU_PORT_FROM_FCE_BASE_PTR 0x09A0 14 | #define TX_CPU_PORT_FROM_FCE_MAX_COUNT 0x09A4 15 | #define FCE_PDMA_GLOBAL_CONF 0x09C4 16 | #define TX_CPU_PORT_FROM_FCE_CPU_DESC_INDEX 0x09A8 17 | #define FCE_SKIP_FS 0x0A6C 18 | #define PER_PORT_PAUSE_ENABLE_CONTROL1 0x0A38 19 | 20 | #ifdef BIG_ENDIAN 21 | typedef union _L2_STUFFING_STRUC 22 | { 23 | struct { 24 | UINT32 RSV:6; 25 | UINT32 OTHER_PORT:2; 26 | UINT32 TS_LENGTH_EN:8; 27 | UINT32 TS_CMD_QSEL_EN:8; 28 | UINT32 RSV2:2; 29 | UINT32 MVINF_BYTE_SWP:1; 30 | UINT32 FS_WR_MPDU_LEN_EN:1; 31 | UINT32 TX_L2_DE_STUFFING_EN:1; 32 | UINT32 RX_L2_STUFFING_EN:1; 33 | UINT32 QoS_L2_EN:1; 34 | UINT32 HT_L2_EN:1; 35 | } field; 36 | 37 | UINT32 word; 38 | } L2_STUFFING_STRUC, *PL2_STUFFING_STRUC; 39 | #else 40 | typedef union _L2_STUFFING_STRUC 41 | { 42 | struct { 43 | UINT32 HT_L2_EN:1; 44 | UINT32 QoS_L2_EN:1; 45 | UINT32 RX_L2_STUFFING_EN:1; 46 | UINT32 TX_L2_DE_STUFFING_EN:1; 47 | UINT32 FS_WR_MPDU_LEN_EN:1; 48 | UINT32 MVINF_BYTE_SWP:1; 49 | UINT32 RSV2:2; 50 | UINT32 TS_CMD_QSEL_EN:8; 51 | UINT32 TS_LENGTH_EN:8; 52 | UINT32 OTHER_PORT:2; 53 | UINT32 RSV:6; 54 | } field; 55 | 56 | UINT32 word; 57 | } L2_STUFFING_STRUC, *PL2_STUFFING_STRUC; 58 | #endif 59 | 60 | #define NORMAL_PKT 0x0 61 | #define CMD_PKT 0x1 62 | 63 | #define FCE_WLAN_PORT 0x0 64 | #define FCE_CPU_RX_PORT 0x1 65 | #define FCE_CPU_TX_PORT 0x2 66 | #define FCE_HOST_PORT 0x3 67 | #define FCE_VIRTUAL_CPU_RX_PORT 0x4 68 | #define FCE_VIRTUAL_CPU_TX_PORT 0x5 69 | #define FCE_DISCARD 0x6 70 | #endif /*__FCE_H__ */ 71 | -------------------------------------------------------------------------------- /os/linux/inf_ppa.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * 4F, No. 2 Technology 5th Rd. 4 | * Science-based Industrial Park 5 | * Hsin-chu, Taiwan, R.O.C. 6 | * (c) Copyright 2002, Ralink Technology, Inc. 7 | * 8 | * All rights reserved. Ralink's source code is an unpublished work and the 9 | * use of a copyright notice does not imply otherwise. This source code 10 | * contains confidential trade secret material of Ralink Tech. Any attemp 11 | * or participation in deciphering, decoding, reverse engineering or in any 12 | * way altering the source code is stricitly prohibited, unless the prior 13 | * written consent of Ralink Technology, Inc. is obtained. 14 | **************************************************************************** 15 | 16 | Module Name: 17 | inf_ppa.c 18 | 19 | Abstract: 20 | Only for Infineon PPA Direct path feature. 21 | 22 | 23 | 24 | Revision History: 25 | Who When What 26 | -------- ---------- ---------------------------------------------- 27 | carella 06-01-2010 Created 28 | 29 | */ 30 | 31 | #ifdef INF_PPA_SUPPORT 32 | 33 | #include "rt_config.h" 34 | #include 35 | #include 36 | 37 | extern INT rt28xx_send_packets( 38 | IN struct sk_buff *skb_p, 39 | IN struct net_device *net_dev); 40 | 41 | int ifx_ra_start_xmit( 42 | struct net_device *rx_dev, 43 | struct net_device *tx_dev, 44 | struct sk_buff *skb, int len) 45 | { 46 | if(tx_dev != NULL) 47 | { 48 | SET_OS_PKT_NETDEV(skb, tx_dev); 49 | rt28xx_send_packets(skb, tx_dev); 50 | } 51 | else if(rx_dev != NULL) 52 | { 53 | skb->protocol = eth_type_trans(skb, skb->dev); 54 | netif_rx(skb); 55 | } 56 | else 57 | { 58 | dev_kfree_skb_any(skb); 59 | } 60 | return 0; 61 | } 62 | #endif /* INF_PPA_SUPPORT */ 63 | -------------------------------------------------------------------------------- /elian/lib/sccb.c: -------------------------------------------------------------------------------- 1 | 2 | #include "sccb.h" 3 | #include "plat.h" 4 | #include "../os/linux/osal.h" 5 | 6 | #define MSC_ENABLE_RX_BIT ((unsigned int)0x1<<31) //BIT(31) 7 | 8 | #define sccb_rx_enabled() (ctrl_data.flag&(MSC_ENABLE_RX_BIT)) 9 | 10 | struct sccb_ctrl_data { 11 | unsigned int flag; 12 | sc_input_func input_func; 13 | sc_sw_filter filter_func; 14 | } ctrl_data; 15 | 16 | int sccb_enable_input() 17 | { 18 | ctrl_data.flag |= MSC_ENABLE_RX_BIT; 19 | return 0; 20 | } 21 | 22 | int sccb_disable_input() 23 | { 24 | ctrl_data.flag &= ~MSC_ENABLE_RX_BIT; 25 | return 0; 26 | } 27 | 28 | int sccb_init(sc_input_func input_func, sc_sw_filter filter_func) 29 | { 30 | ctrl_data.input_func = input_func; 31 | ctrl_data.filter_func = filter_func; 32 | ctrl_data.flag = 0x00000000; 33 | return 0; 34 | } 35 | 36 | int sccb_deinit() 37 | { 38 | ctrl_data.input_func = NULL; 39 | ctrl_data.filter_func = NULL; 40 | ctrl_data.flag = 0x00000000; 41 | return 0; 42 | } 43 | 44 | int sccb_set_monitor_chan(struct chan_info *chl_info, void *priv) 45 | { 46 | return sc_plt_set_monitor_chan(chl_info, priv); 47 | } 48 | 49 | int sccb_enter_monitor_mode(struct monitor_info *info, void *priv) 50 | { 51 | return sc_plt_enter_monitor_mode(info, priv); 52 | } 53 | 54 | int sccb_leave_monitor_mode(void *priv) 55 | { 56 | return sc_plt_leave_monitor_mode(priv); 57 | } 58 | 59 | int sccb_rx(char *data, unsigned int data_len) 60 | { 61 | char *p= NULL; 62 | int len; 63 | 64 | if (!sccb_rx_enabled()) { 65 | return -1; 66 | } 67 | 68 | if (ctrl_data.input_func == NULL) { 69 | return -2; 70 | } 71 | 72 | p = data; 73 | len = data_len; 74 | 75 | if (ctrl_data.filter_func != NULL) { 76 | if (ctrl_data.filter_func(p, len)) { 77 | return -3; 78 | } 79 | } 80 | 81 | if (ctrl_data.input_func != NULL) { 82 | return ctrl_data.input_func(p, len); 83 | } 84 | return -4; 85 | } 86 | 87 | -------------------------------------------------------------------------------- /include/crypt_arc4.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * Taiwan, R.O.C. 4 | * 5 | * (c) Copyright 2002, Ralink Technology, Inc. 6 | * 7 | * All rights reserved. Ralink's source code is an unpublished work and the 8 | * use of a copyright notice does not imply otherwise. This source code 9 | * contains confidential trade secret material of Ralink Tech. Any attemp 10 | * or participation in deciphering, decoding, reverse engineering or in any 11 | * way altering the source code is stricitly prohibited, unless the prior 12 | * written consent of Ralink Technology, Inc. is obtained. 13 | ***************************************************************************/ 14 | 15 | /**************************************************************************** 16 | Module Name: 17 | RC4 18 | 19 | Abstract: 20 | 21 | Revision History: 22 | Who When What 23 | -------- ---------- ------------------------------------------ 24 | Eddy 2009/05/13 ARC4 25 | ***************************************************************************/ 26 | 27 | #ifndef __CRYPT_ARC4_H__ 28 | #define __CRYPT_ARC4_H__ 29 | 30 | #include "rt_config.h" 31 | 32 | /* ARC4 definition & structure */ 33 | #define ARC4_KEY_BLOCK_SIZE 256 34 | 35 | typedef struct { 36 | UINT BlockIndex1; 37 | UINT BlockIndex2; 38 | UINT8 KeyBlock[256]; 39 | } ARC4_CTX_STRUC, *PARC4_CTX_STRUC; 40 | 41 | /* ARC4 operations */ 42 | VOID ARC4_INIT( 43 | IN ARC4_CTX_STRUC * pARC4_CTX, 44 | IN PUCHAR pKey, 45 | IN UINT KeyLength); 46 | 47 | VOID ARC4_Compute( 48 | IN ARC4_CTX_STRUC * pARC4_CTX, 49 | IN UINT8 InputBlock[], 50 | IN UINT InputBlockSize, 51 | OUT UINT8 OutputBlock[]); 52 | 53 | VOID ARC4_Discard_KeyLength( 54 | IN ARC4_CTX_STRUC * pARC4_CTX, 55 | IN UINT Length); 56 | 57 | #endif /* __CRYPT_ARC4_H__ */ 58 | -------------------------------------------------------------------------------- /include/ap_autoChSel_cmm.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * 4F, No. 2 Technology 5th Rd. 4 | * Science-based Industrial Park 5 | * Hsin-chu, Taiwan, R.O.C. 6 | * (c) Copyright 2002, Ralink Technology, Inc. 7 | * 8 | * All rights reserved. Ralink's source code is an unpublished work and the 9 | * use of a copyright notice does not imply otherwise. This source code 10 | * contains confidential trade secret material of Ralink Tech. Any attemp 11 | * or participation in deciphering, decoding, reverse engineering or in any 12 | * way altering the source code is stricitly prohibited, unless the prior 13 | * written consent of Ralink Technology, Inc. is obtained. 14 | **************************************************************************** 15 | 16 | Abstract: 17 | 18 | 19 | */ 20 | 21 | 22 | #ifndef __AUTOCHSELECT_CMM_H__ 23 | #define __AUTOCHSELECT_CMM_H__ 24 | 25 | #define RSSI_TO_DBM_OFFSET 120 /* RSSI-115 = dBm */ 26 | 27 | 28 | typedef struct { 29 | ULONG dirtyness[MAX_NUM_OF_CHANNELS+1]; 30 | ULONG ApCnt[MAX_NUM_OF_CHANNELS+1]; 31 | UINT32 FalseCCA[MAX_NUM_OF_CHANNELS+1]; 32 | BOOLEAN SkipList[MAX_NUM_OF_CHANNELS+1]; 33 | #ifdef AP_QLOAD_SUPPORT 34 | UINT32 chanbusytime[MAX_NUM_OF_CHANNELS+1]; /* QLOAD ALARM */ 35 | #endif /* AP_QLOAD_SUPPORT */ 36 | BOOLEAN IsABand; 37 | } CHANNELINFO, *PCHANNELINFO; 38 | 39 | typedef struct { 40 | UCHAR Bssid[MAC_ADDR_LEN]; 41 | UCHAR SsidLen; 42 | CHAR Ssid[MAX_LEN_OF_SSID]; 43 | UCHAR Channel; 44 | UCHAR ExtChOffset; 45 | CHAR Rssi; 46 | } BSSENTRY, *PBSSENTRY; 47 | 48 | typedef struct { 49 | UCHAR BssNr; 50 | BSSENTRY BssEntry[MAX_LEN_OF_BSS_TABLE]; 51 | } BSSINFO, *PBSSINFO; 52 | 53 | typedef enum ChannelSelAlg 54 | { 55 | ChannelAlgRandom, /*use by Dfs */ 56 | ChannelAlgApCnt, 57 | ChannelAlgCCA 58 | } ChannelSel_Alg; 59 | 60 | #endif /* __AUTOCHSELECT_CMM_H__ */ 61 | 62 | -------------------------------------------------------------------------------- /include/vr_ikans.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * 4F, No. 2 Technology 5th Rd. 4 | * Science-based Industrial Park 5 | * Hsin-chu, Taiwan, R.O.C. 6 | * (c) Copyright 2002, Ralink Technology, Inc. 7 | * 8 | * All rights reserved. Ralink's source code is an unpublished work and the 9 | * use of a copyright notice does not imply otherwise. This source code 10 | * contains confidential trade secret material of Ralink Tech. Any attemp 11 | * or participation in deciphering, decoding, reverse engineering or in any 12 | * way altering the source code is stricitly prohibited, unless the prior 13 | * written consent of Ralink Technology, Inc. is obtained. 14 | **************************************************************************** 15 | 16 | Module Name: 17 | vr_ikans.h 18 | 19 | Abstract: 20 | Only for IKANOS Vx160 or Vx180 platform. 21 | 22 | Revision History: 23 | Who When What 24 | -------- ---------- ---------------------------------------------- 25 | Sample Lin 01-28-2008 Created 26 | 27 | */ 28 | 29 | #ifndef __VR_IKANS_H__ 30 | #define __VR_IKANS_H__ 31 | 32 | #ifndef MODULE_IKANOS 33 | #define IKANOS_EXTERN extern 34 | #else 35 | #define IKANOS_EXTERN 36 | #endif /* MODULE_IKANOS */ 37 | 38 | #ifdef IKANOS_VX_1X0 39 | typedef void (*IkanosWlanTxCbFuncP)(void *, void *); 40 | 41 | struct IKANOS_TX_INFO 42 | { 43 | struct net_device *netdev; 44 | IkanosWlanTxCbFuncP *fp; 45 | }; 46 | #endif /* IKANOS_VX_1X0 */ 47 | 48 | 49 | IKANOS_EXTERN void VR_IKANOS_FP_Init(UINT8 BssNum, UINT8 *pApMac); 50 | 51 | IKANOS_EXTERN INT32 IKANOS_DataFramesTx(struct sk_buff *pSkb, 52 | struct net_device *pNetDev); 53 | 54 | IKANOS_EXTERN void IKANOS_DataFrameRx(PRTMP_ADAPTER pAd, 55 | struct sk_buff *pSkb); 56 | 57 | #endif /* __VR_IKANS_H__ */ 58 | 59 | /* End of vr_ikans.h */ 60 | -------------------------------------------------------------------------------- /include/rtmp_iface.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * 4F, No. 2 Technology 5th Rd. 4 | * Science-based Industrial Park 5 | * Hsin-chu, Taiwan, R.O.C. 6 | * (c) Copyright 2002, Ralink Technology, Inc. 7 | * 8 | * All rights reserved. Ralink's source code is an unpublished work and the 9 | * use of a copyright notice does not imply otherwise. This source code 10 | * contains confidential trade secret material of Ralink Tech. Any attemp 11 | * or participation in deciphering, decoding, reverse engineering or in any 12 | * way altering the source code is stricitly prohibited, unless the prior 13 | * written consent of Ralink Technology, Inc. is obtained. 14 | **************************************************************************** 15 | 16 | Module Name: 17 | rt_iface.h 18 | 19 | Abstract: 20 | 21 | Revision History: 22 | Who When What 23 | --------- ---------- ---------------------------------------------- 24 | */ 25 | 26 | #ifndef __RTMP_IFACE_H__ 27 | #define __RTMP_IFACE_H__ 28 | 29 | 30 | 31 | #ifdef RTMP_USB_SUPPORT 32 | #include "iface/rtmp_usb.h" 33 | #endif /* RTMP_USB_SUPPORT */ 34 | 35 | typedef struct _INF_PCI_CONFIG_ { 36 | unsigned long CSRBaseAddress; /* PCI MMIO Base Address, all access will use */ 37 | unsigned int irq_num; 38 | } INF_PCI_CONFIG; 39 | 40 | typedef struct _INF_USB_CONFIG_ { 41 | unsigned char BulkInEpAddr; /* bulk-in endpoint address */ 42 | unsigned char BulkOutEpAddr[6]; /* bulk-out endpoint address */ 43 | } INF_USB_CONFIG; 44 | 45 | typedef struct _INF_RBUS_CONFIG_ { 46 | unsigned long csr_addr; 47 | unsigned int irq; 48 | } INF_RBUS_CONFIG; 49 | 50 | 51 | typedef union _RTMP_INF_CONFIG_ { 52 | struct _INF_PCI_CONFIG_ pciConfig; 53 | struct _INF_USB_CONFIG_ usbConfig; 54 | struct _INF_RBUS_CONFIG_ rbusConfig; 55 | } RTMP_INF_CONFIG; 56 | 57 | #endif /* __RTMP_IFACE_H__ */ 58 | -------------------------------------------------------------------------------- /include/rtmp_osabl.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | 3 | Module Name: 4 | OS/rtmp_osabl.h 5 | 6 | Abstract: 7 | Some structure/definitions for OS ABL function. 8 | 9 | Revision History: 10 | Who When What 11 | --------- ---------- ---------------------------------------------- 12 | 13 | ***************************************************************************/ 14 | 15 | #ifndef __RTMP_OS_ABL_H__ 16 | #define __RTMP_OS_ABL_H__ 17 | 18 | #ifdef OS_ABL_FUNC_SUPPORT 19 | 20 | #ifdef OS_ABL_OS_PCI_SUPPORT 21 | #define RTMP_MAC_PCI 22 | #define RTMP_PCI_SUPPORT 23 | #endif /* OS_ABL_OS_PCI_SUPPORT */ 24 | 25 | #ifdef OS_ABL_OS_USB_SUPPORT 26 | #include 27 | 28 | #ifndef RTMP_MAC_USB 29 | #define RTMP_MAC_USB 30 | #endif /* RTMP_MAC_USB */ 31 | #ifndef RTMP_USB_SUPPORT 32 | #define RTMP_USB_SUPPORT 33 | #endif /* RTMP_USB_SUPPORT */ 34 | #endif /* OS_ABL_OS_USB_SUPPORT */ 35 | 36 | #ifdef OS_ABL_OS_RBUS_SUPPORT 37 | #define RTMP_RBUS_SUPPORT 38 | #endif /* OS_ABL_OS_RBUS_SUPPORT */ 39 | 40 | #ifdef OS_ABL_OS_AP_SUPPORT 41 | #ifndef CONFIG_AP_SUPPORT 42 | #define CONFIG_AP_SUPPORT 43 | #endif /* CONFIG_AP_SUPPORT */ 44 | #endif /* OS_ABL_OS_AP_SUPPORT */ 45 | 46 | #ifdef OS_ABL_OS_STA_SUPPORT 47 | #ifndef CONFIG_STA_SUPPORT 48 | #define CONFIG_STA_SUPPORT 49 | #endif /* CONFIG_STA_SUPPORT */ 50 | #endif /* OS_ABL_OS_STA_SUPPORT */ 51 | 52 | /* AP & STA con-current */ 53 | #undef RT_CONFIG_IF_OPMODE_ON_AP 54 | #undef RT_CONFIG_IF_OPMODE_ON_STA 55 | 56 | #if defined(CONFIG_AP_SUPPORT) && defined(CONFIG_STA_SUPPORT) 57 | #define RT_CONFIG_IF_OPMODE_ON_AP(__OpMode) if (__OpMode == OPMODE_AP) 58 | #define RT_CONFIG_IF_OPMODE_ON_STA(__OpMode) if (__OpMode == OPMODE_STA) 59 | #else 60 | #define RT_CONFIG_IF_OPMODE_ON_AP(__OpMode) 61 | #define RT_CONFIG_IF_OPMODE_ON_STA(__OpMode) 62 | #endif 63 | 64 | #endif /* OS_ABL_FUNC_SUPPORT */ 65 | 66 | #endif /* __RTMP_OS_ABL_H__ */ 67 | 68 | -------------------------------------------------------------------------------- /RT2870STA_7601.dat: -------------------------------------------------------------------------------- 1 | #The word of "Default" must not be removed 2 | Default 3 | CountryRegion=5 4 | CountryRegionABand=7 5 | CountryCode= 6 | ChannelGeography=1 7 | SSID=11n-AP 8 | NetworkType=Infra 9 | WirelessMode=9 10 | Channel=0 11 | BeaconPeriod=100 12 | TxPower=100 13 | BGProtection=0 14 | TxPreamble=0 15 | RTSThreshold=2347 16 | FragThreshold=2346 17 | TxBurst=1 18 | PktAggregate=0 19 | WmmCapable=1 20 | AckPolicy=0;0;0;0 21 | AuthMode=OPEN 22 | EncrypType=NONE 23 | WPAPSK= 24 | DefaultKeyID=1 25 | Key1Type=0 26 | Key1Str= 27 | Key2Type=0 28 | Key2Str= 29 | Key3Type=0 30 | Key3Str= 31 | Key4Type=0 32 | Key4Str= 33 | PSMode=CAM 34 | AutoRoaming=0 35 | RoamThreshold=70 36 | APSDCapable=0 37 | APSDAC=0;0;0;0 38 | HT_RDG=1 39 | HT_EXTCHA=0 40 | HT_OpMode=0 41 | HT_MpduDensity=4 42 | HT_BW=1 43 | HT_BADecline=0 44 | HT_AutoBA=1 45 | HT_AMSDU=0 46 | HT_BAWinSize=64 47 | HT_GI=1 48 | HT_MCS=33 49 | HT_MIMOPSMode=3 50 | HT_DisallowTKIP=1 51 | HT_STBC=1 52 | EthConvertMode= 53 | EthCloneMac= 54 | IEEE80211H=0 55 | TGnWifiTest=0 56 | WirelessEvent=0 57 | MeshId=MESH 58 | MeshAutoLink=1 59 | MeshAuthMode=OPEN 60 | MeshEncrypType=NONE 61 | MeshWPAKEY= 62 | MeshDefaultkey=1 63 | MeshWEPKEY= 64 | CarrierDetect=0 65 | AntDiversity=0 66 | BeaconLostTime=4 67 | FtSupport=0 68 | Wapiifname=ra0 69 | WapiPsk= 70 | WapiPskType= 71 | WapiUserCertPath= 72 | WapiAsCertPath= 73 | PSP_XLINK_MODE=0 74 | WscManufacturer= 75 | WscModelName= 76 | WscDeviceName= 77 | WscModelNumber= 78 | WscSerialNumber= 79 | RadioOn=1 80 | WIDIEnable=1 81 | P2P_L2SD_SCAN_TOGGLE=3 82 | Wsc4digitPinCode=0 83 | P2P_WIDIEnable=0 84 | PMFMFPC=0 85 | PMFMFPR=0 86 | PMFSHA256=0 87 | BW20_RSSI_THR0=-36 88 | BW20_RSSI_THR1=-50 89 | BW20_RSSI_THR2=-75 90 | BW20_RSSI_THR3=-80 91 | BW40_RSSI_THR0=-35 92 | BW40_RSSI_THR1=-49 93 | BW40_RSSI_THR2=-76 94 | BW40_RSSI_THR3=-80 95 | NOISE_RSSI_THR1=-62 96 | NOISE_RSSI_THR2=-70 97 | NOISE_RSSI_THR3=-75 98 | FCCA_THR1=1800 99 | FCCA_THR2=200 100 | DYPD_ENABLE=1 101 | -------------------------------------------------------------------------------- /MT7601USTA.dat: -------------------------------------------------------------------------------- 1 | #The word of "Default" must not be removed 2 | Default 3 | CountryRegion=5 4 | CountryRegionABand=7 5 | CountryCode= 6 | ChannelGeography=1 7 | SSID=11n-AP 8 | NetworkType=Infra 9 | WirelessMode=9 10 | Channel=0 11 | BeaconPeriod=100 12 | TxPower=100 13 | BGProtection=0 14 | TxPreamble=0 15 | RTSThreshold=2347 16 | FragThreshold=2346 17 | TxBurst=1 18 | PktAggregate=0 19 | WmmCapable=1 20 | AckPolicy=0;0;0;0 21 | AuthMode=OPEN 22 | EncrypType=NONE 23 | WPAPSK= 24 | DefaultKeyID=1 25 | Key1Type=0 26 | Key1Str= 27 | Key2Type=0 28 | Key2Str= 29 | Key3Type=0 30 | Key3Str= 31 | Key4Type=0 32 | Key4Str= 33 | PSMode=CAM 34 | AutoRoaming=0 35 | RoamThreshold=70 36 | APSDCapable=0 37 | APSDAC=0;0;0;0 38 | HT_RDG=1 39 | HT_EXTCHA=0 40 | HT_OpMode=0 41 | HT_MpduDensity=4 42 | HT_BW=0 43 | HT_BADecline=0 44 | HT_AutoBA=1 45 | HT_AMSDU=0 46 | HT_BAWinSize=64 47 | HT_GI=1 48 | HT_MCS=33 49 | HT_MIMOPSMode=3 50 | HT_DisallowTKIP=1 51 | HT_STBC=1 52 | EthConvertMode= 53 | EthCloneMac= 54 | IEEE80211H=0 55 | TGnWifiTest=0 56 | WirelessEvent=0 57 | MeshId=MESH 58 | MeshAutoLink=1 59 | MeshAuthMode=OPEN 60 | MeshEncrypType=NONE 61 | MeshWPAKEY= 62 | MeshDefaultkey=1 63 | MeshWEPKEY= 64 | CarrierDetect=0 65 | AntDiversity=0 66 | BeaconLostTime=20 67 | FtSupport=0 68 | Wapiifname=ra0 69 | WapiPsk= 70 | WapiPskType= 71 | WapiUserCertPath= 72 | WapiAsCertPath= 73 | PSP_XLINK_MODE=0 74 | WscManufacturer= 75 | WscModelName= 76 | WscDeviceName= 77 | WscModelNumber= 78 | WscSerialNumber= 79 | RadioOn=1 80 | WIDIEnable=1 81 | P2P_L2SD_SCAN_TOGGLE=3 82 | Wsc4digitPinCode=0 83 | P2P_WIDIEnable=0 84 | PMFMFPC=0 85 | PMFMFPR=0 86 | PMFSHA256=0 87 | BW20_RSSI_THR0=-36 88 | BW20_RSSI_THR1=-50 89 | BW20_RSSI_THR2=-75 90 | BW20_RSSI_THR3=-80 91 | BW40_RSSI_THR0=-35 92 | BW40_RSSI_THR1=-49 93 | BW40_RSSI_THR2=-76 94 | BW40_RSSI_THR3=-80 95 | NOISE_RSSI_THR1=-62 96 | NOISE_RSSI_THR2=-70 97 | NOISE_RSSI_THR3=-75 98 | FCCA_THR1=1800 99 | FCCA_THR2=200 100 | DYPD_ENABLE=1 101 | WOW_Enable=1 102 | WOW_InBand=0 103 | EDCCA_ED_TH=80 104 | EDCCA_BLOCK_CHECK_TH=2 105 | -------------------------------------------------------------------------------- /include/ap_autoChSel.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * 4F, No. 2 Technology 5th Rd. 4 | * Science-based Industrial Park 5 | * Hsin-chu, Taiwan, R.O.C. 6 | * (c) Copyright 2002, Ralink Technology, Inc. 7 | * 8 | * All rights reserved. Ralink's source code is an unpublished work and the 9 | * use of a copyright notice does not imply otherwise. This source code 10 | * contains confidential trade secret material of Ralink Tech. Any attemp 11 | * or participation in deciphering, decoding, reverse engineering or in any 12 | * way altering the source code is stricitly prohibited, unless the prior 13 | * written consent of Ralink Technology, Inc. is obtained. 14 | **************************************************************************** 15 | 16 | Abstract: 17 | 18 | 19 | */ 20 | 21 | #include "ap_autoChSel_cmm.h" 22 | 23 | #ifndef __AUTOCHSELECT_H__ 24 | #define __AUTOCHSELECT_H__ 25 | 26 | #define AP_AUTO_CH_SEL(__P, __O) APAutoSelectChannel((__P), (__O)) 27 | 28 | ULONG AutoChBssSearchWithSSID( 29 | IN PRTMP_ADAPTER pAd, 30 | IN PUCHAR Bssid, 31 | IN PUCHAR pSsid, 32 | IN UCHAR SsidLen, 33 | IN UCHAR Channel); 34 | 35 | VOID APAutoChannelInit( 36 | IN PRTMP_ADAPTER pAd); 37 | 38 | VOID UpdateChannelInfo( 39 | IN PRTMP_ADAPTER pAd, 40 | IN int ch, 41 | IN ChannelSel_Alg Alg); 42 | 43 | ULONG AutoChBssInsertEntry( 44 | IN PRTMP_ADAPTER pAd, 45 | IN PUCHAR pBssid, 46 | IN CHAR Ssid[], 47 | IN UCHAR SsidLen, 48 | IN UCHAR ChannelNo, 49 | IN UCHAR ExtChOffset, 50 | IN CHAR Rssi); 51 | 52 | VOID AutoChBssTableInit( 53 | IN PRTMP_ADAPTER pAd); 54 | 55 | VOID ChannelInfoInit( 56 | IN PRTMP_ADAPTER pAd); 57 | 58 | VOID AutoChBssTableDestroy( 59 | IN PRTMP_ADAPTER pAd); 60 | 61 | VOID ChannelInfoDestroy( 62 | IN PRTMP_ADAPTER pAd); 63 | 64 | VOID CheckPhyModeIsABand( 65 | IN PRTMP_ADAPTER pAd); 66 | 67 | UCHAR SelectBestChannel( 68 | IN PRTMP_ADAPTER pAd, 69 | IN ChannelSel_Alg Alg); 70 | 71 | UCHAR APAutoSelectChannel( 72 | IN PRTMP_ADAPTER pAd, 73 | IN ChannelSel_Alg Alg); 74 | 75 | #endif /* __AUTOCHSELECT_H__ */ 76 | 77 | -------------------------------------------------------------------------------- /include/crypt_md5.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * Taiwan, R.O.C. 4 | * 5 | * (c) Copyright 2002, Ralink Technology, Inc. 6 | * 7 | * All rights reserved. Ralink's source code is an unpublished work and the 8 | * use of a copyright notice does not imply otherwise. This source code 9 | * contains confidential trade secret material of Ralink Tech. Any attemp 10 | * or participation in deciphering, decoding, reverse engineering or in any 11 | * way altering the source code is stricitly prohibited, unless the prior 12 | * written consent of Ralink Technology, Inc. is obtained. 13 | ***************************************************************************/ 14 | 15 | /**************************************************************************** 16 | Module Name: 17 | MD5 18 | 19 | Abstract: 20 | RFC1321: The MD5 Message-Digest Algorithm 21 | 22 | Revision History: 23 | Who When What 24 | -------- ---------- ------------------------------------------ 25 | Eddy 2008/11/24 Create md5 26 | ***************************************************************************/ 27 | 28 | #ifndef __CRYPT_MD5_H__ 29 | #define __CRYPT_MD5_H__ 30 | 31 | 32 | /* Algorithm options */ 33 | #define MD5_SUPPORT 34 | 35 | #ifdef MD5_SUPPORT 36 | #define MD5_BLOCK_SIZE 64 /* 512 bits = 64 bytes */ 37 | #define MD5_DIGEST_SIZE 16 /* 128 bits = 16 bytes */ 38 | typedef struct { 39 | UINT32 HashValue[4]; 40 | UINT64 MessageLen; 41 | UINT8 Block[MD5_BLOCK_SIZE]; 42 | UINT BlockLen; 43 | } MD5_CTX_STRUC, *PMD5_CTX_STRUC; 44 | 45 | VOID RT_MD5_Init( 46 | IN MD5_CTX_STRUC * pMD5_CTX); 47 | VOID RT_MD5_Hash( 48 | IN MD5_CTX_STRUC * pMD5_CTX); 49 | VOID RT_MD5_Append( 50 | IN MD5_CTX_STRUC * pMD5_CTX, 51 | IN const UINT8 Message[], 52 | IN UINT MessageLen); 53 | VOID RT_MD5_End( 54 | IN MD5_CTX_STRUC * pMD5_CTX, 55 | OUT UINT8 DigestMessage[]); 56 | VOID RT_MD5( 57 | IN const UINT8 Message[], 58 | IN UINT MessageLen, 59 | OUT UINT8 DigestMessage[]); 60 | #endif /* MD5_SUPPORT */ 61 | 62 | 63 | #endif /* __CRYPT_MD5_H__ */ 64 | -------------------------------------------------------------------------------- /elian/os/linux/osal.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __MSC_OSAL_H__ 3 | #define __MSC_OSAL_H__ 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | 14 | 15 | #define MSC_WARN printk 16 | #define MSC_INFO printk 17 | #define MSC_DBG printk 18 | #define MAX_THREAD_NAME_LEN 16 19 | typedef void (*P_TIMEOUT_HANDLER)(unsigned long); 20 | typedef int (*thread_func)(unsigned long); 21 | 22 | typedef struct _osal_timer 23 | { 24 | struct timer_list timer; 25 | P_TIMEOUT_HANDLER timeoutHandler; 26 | unsigned long data; 27 | }osal_timer, *p_osal_timer; 28 | 29 | typedef struct _osal_thread 30 | { 31 | struct task_struct *thread; 32 | void *thread_func; 33 | void *data; 34 | char name[MAX_THREAD_NAME_LEN]; 35 | }osal_thread, *p_osal_thread; 36 | 37 | 38 | extern void* osal_memset(void *buf, int i, unsigned int len); 39 | extern void* osal_memcpy(void *dst, const void *src, unsigned int len); 40 | extern int osal_memcmp(const void *buf1, const void *buf2, unsigned int len); 41 | extern int osal_timer_modify(p_osal_timer ptimer, unsigned ms); 42 | extern int osal_timer_stop(p_osal_timer ptimer); 43 | extern int osal_timer_start(p_osal_timer ptimer, unsigned ms); 44 | extern int osal_timer_create(p_osal_timer ptimer); 45 | extern int osal_thread_create(p_osal_thread thread); 46 | extern int osal_thread_run (p_osal_thread thread); 47 | extern int osal_thread_stop (p_osal_thread thread); 48 | extern int osal_thread_should_stop (p_osal_thread thread); 49 | extern int osal_msleep(unsigned int ms); 50 | extern unsigned int osal_strlen(const char *str); 51 | extern int osal_strcmp(const char *dst, const char *src); 52 | extern int osal_strncmp(const char *dst, const char *src, unsigned int len); 53 | extern char * osal_strcpy(char *dst, const char *src); 54 | extern long int osal_strtol(const char *str, char **c, int adecimal); 55 | extern char *osal_strstr(const char *haystack, const char *needle); 56 | extern int osal_lock_init(spinlock_t *l); 57 | extern int osal_lock(spinlock_t *l); 58 | extern int osal_unlock(spinlock_t *l); 59 | #endif 60 | -------------------------------------------------------------------------------- /include/crypt_hmac.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * Taiwan, R.O.C. 4 | * 5 | * (c) Copyright 2002, Ralink Technology, Inc. 6 | * 7 | * All rights reserved. Ralink's source code is an unpublished work and the 8 | * use of a copyright notice does not imply otherwise. This source code 9 | * contains confidential trade secret material of Ralink Tech. Any attemp 10 | * or participation in deciphering, decoding, reverse engineering or in any 11 | * way altering the source code is stricitly prohibited, unless the prior 12 | * written consent of Ralink Technology, Inc. is obtained. 13 | ***************************************************************************/ 14 | 15 | /**************************************************************************** 16 | Module Name: 17 | HMAC 18 | 19 | Abstract: 20 | FIPS 198: The Keyed-Hash Message Authentication Code (HMAC) 21 | 22 | Revision History: 23 | Who When What 24 | -------- ---------- ------------------------------------------ 25 | Eddy 2008/11/24 Create HMAC-SHA1, HMAC-SHA256 26 | ***************************************************************************/ 27 | 28 | #ifndef __CRYPT_HMAC_H__ 29 | #define __CRYPT_HMAC_H__ 30 | 31 | #include "rt_config.h" 32 | 33 | 34 | #ifdef SHA1_SUPPORT 35 | #define HMAC_SHA1_SUPPORT 36 | VOID RT_HMAC_SHA1( 37 | IN const UINT8 Key[], 38 | IN UINT KeyLen, 39 | IN const UINT8 Message[], 40 | IN UINT MessageLen, 41 | OUT UINT8 MAC[], 42 | IN UINT MACLen); 43 | #endif /* SHA1_SUPPORT */ 44 | 45 | #ifdef SHA256_SUPPORT 46 | #define HMAC_SHA256_SUPPORT 47 | VOID RT_HMAC_SHA256( 48 | IN const UINT8 Key[], 49 | IN UINT KeyLen, 50 | IN const UINT8 Message[], 51 | IN UINT MessageLen, 52 | OUT UINT8 MAC[], 53 | IN UINT MACLen); 54 | #endif /* SHA256_SUPPORT */ 55 | 56 | #ifdef MD5_SUPPORT 57 | #define HMAC_MD5_SUPPORT 58 | VOID RT_HMAC_MD5( 59 | IN const UINT8 Key[], 60 | IN UINT KeyLen, 61 | IN const UINT8 Message[], 62 | IN UINT MessageLen, 63 | OUT UINT8 MAC[], 64 | IN UINT MACLen); 65 | #endif /* MD5_SUPPORT */ 66 | 67 | 68 | #endif /* __CRYPT_HMAC_H__ */ 69 | -------------------------------------------------------------------------------- /elian/lib/sccb.h: -------------------------------------------------------------------------------- 1 | #ifndef __MSC_LIB_H__ 2 | #define __MSC_LIB_H__ 3 | 4 | //#define BIT(n) (1UL << (n%(8*sizeof(unsigned long)))) 5 | 6 | #define ERR_NOTSUPPORT -1 7 | #define ERR_TIMEDOUT -2 8 | #define ERR_INVALIDPARAM -3 9 | 10 | //#define MSC_DROP_DATA BIT(0) 11 | //#define MSC_DROP_MGMT BIT(1) 12 | //#define MSC_DROP_MULTICAST BIT(2) 13 | //#define MSC_DROP_BROADCAST BIT(3) 14 | #if 0 15 | enum sc_ctrl_id { 16 | MSC_CTRLID_ENABLE_MONITOR_MODE = 0x00, 17 | MSC_CTRLID_DISABLE_MONITOR_MODE, 18 | MSC_CTRLID_GET_MODE, 19 | MSC_CTRLID_SET_CHANNEL, 20 | MSC_CTRLID_GET_CHANNEL, 21 | MSC_CTRLID_SET_FILTER, 22 | MSC_CTRLID_GET_FILTER, 23 | MSC_CTRLID_USE_ELIAN, 24 | MSC_CTRLID_MAX 25 | }; 26 | enum msc_band { 27 | MSC_BAND_2GHZ, 28 | MSC_BAND_5GHZ, 29 | MSC_BAND_60GHZ, 30 | MSC_BAND_NUM 31 | }; 32 | #endif 33 | 34 | enum msc_chan_width { 35 | MSC_CHAN_WIDTH_20_NOHT, 36 | MSC_CHAN_WIDTH_20, 37 | MSC_CHAN_WIDTH_40_PLUS, 38 | MSC_CHAN_WIDTH_80, 39 | MSC_CHAN_WIDTH_80P80, 40 | MSC_CHAN_WIDTH_160, 41 | MSC_CHAN_WIDTH_5, 42 | MSC_CHAN_WIDTH_10, 43 | MSC_CHAN_WIDTH_40_MINUS, 44 | }; 45 | 46 | enum msc_iftype { 47 | MSC_IFTYPE_UNSPECIFIED, 48 | MSC_IFTYPE_ADHOC, 49 | MSC_IFTYPE_STATION, 50 | MSC_IFTYPE_AP, 51 | MSC_IFTYPE_AP_VLAN, 52 | MSC_IFTYPE_WDS, 53 | MSC_IFTYPE_MONITOR, 54 | MSC_IFTYPE_MESH_POINT, 55 | MSC_IFTYPE_P2P_CLIENT, 56 | MSC_IFTYPE_P2P_GO, 57 | MSC_IFTYPE_P2P_DEVICE, 58 | 59 | MSC_IFTYPE_IFTYPES, 60 | }; 61 | 62 | struct chan_info { 63 | int chan_id; 64 | enum msc_chan_width width; 65 | unsigned int flags; 66 | }; 67 | 68 | struct monitor_info { 69 | //enum msc_iftype iftype; 70 | unsigned int filter; 71 | struct chan_info chl_info; 72 | void *priv; 73 | }; 74 | 75 | typedef int (*sc_input_func) (char *, int); 76 | typedef int (*sc_sw_filter) (char *, int); 77 | 78 | int sccb_init(sc_input_func input_func, sc_sw_filter filter_func); 79 | int sccb_deinit(void); 80 | int sccb_enter_monitor_mode(struct monitor_info *info, void *priv); 81 | int sccb_leave_monitor_mode(void *priv); 82 | int sccb_set_monitor_chan(struct chan_info *chl_info, void *priv); 83 | int sccb_rx(char *data, unsigned int data_len); 84 | int sccb_enable_input(void); 85 | int sccb_disable_input(void); 86 | #endif 87 | 88 | -------------------------------------------------------------------------------- /include/p2p_inf.h: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002-2005, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attempt 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | p2p_inf.h 20 | 21 | Abstract: 22 | 23 | Revision History: 24 | Who When What 25 | -------- ---------- ---------------------------------------------- 26 | 27 | */ 28 | 29 | #ifndef __P2P_INF_H__ 30 | #define __P2P_INF_H__ 31 | 32 | #define P2P_DISABLE 0x0 33 | #define P2P_GO_UP 0x1 34 | #define P2P_CLI_UP 0x2 35 | /*#define P2P_GO_ON(_p) (OPSTATUS_TEST_FLAG(_p, fOP_STATUS_P2P_GO)) */ 36 | /*#define P2P_CLI_ON(_p) (OPSTATUS_TEST_FLAG(_p, fOP_STATUS_P2P_CLI)) */ 37 | 38 | 39 | 40 | #define P2P_GO_ON(_pAd) \ 41 | (((_pAd)->flg_p2p_init) \ 42 | && ((_pAd)->flg_p2p_OpStatusFlags == P2P_GO_UP)) 43 | 44 | 45 | #define P2P_CLI_ON(_pAd) \ 46 | (((_pAd)->flg_p2p_init) \ 47 | && ((_pAd)->flg_p2p_OpStatusFlags == P2P_CLI_UP)) 48 | 49 | /* P2P interface hook function definition */ 50 | VOID RTMP_P2P_Init( 51 | IN PRTMP_ADAPTER ad_p, 52 | IN PNET_DEV main_dev_p); 53 | 54 | INT P2P_VirtualIF_Open( 55 | IN PNET_DEV dev_p); 56 | 57 | INT P2P_VirtualIF_Close( 58 | IN PNET_DEV dev_p); 59 | 60 | INT P2P_VirtualIF_PacketSend( 61 | IN PNDIS_PACKET skb_p, 62 | IN PNET_DEV dev_p); 63 | 64 | INT P2P_VirtualIF_Ioctl( 65 | IN PNET_DEV dev_p, 66 | IN OUT struct ifreq *rq_p, 67 | IN INT cmd); 68 | 69 | VOID RTMP_P2P_Remove( 70 | IN PRTMP_ADAPTER pAd); 71 | 72 | #endif /* __P2P_INF_H__ */ 73 | 74 | -------------------------------------------------------------------------------- /include/ap_ids.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * 4F, No. 2 Technology 5th Rd. 4 | * Science-based Industrial Park 5 | * Hsin-chu, Taiwan, R.O.C. 6 | * (c) Copyright 2002, Ralink Technology, Inc. 7 | * 8 | * All rights reserved. Ralink's source code is an unpublished work and the 9 | * use of a copyright notice does not imply otherwise. This source code 10 | * contains confidential trade secret material of Ralink Tech. Any attemp 11 | * or participation in deciphering, decoding, reverse engineering or in any 12 | * way altering the source code is stricitly prohibited, unless the prior 13 | * written consent of Ralink Technology, Inc. is obtained. 14 | **************************************************************************** 15 | 16 | Module Name: 17 | ap_ids.c 18 | 19 | Abstract: 20 | IDS definition 21 | 22 | Revision History: 23 | Who When What 24 | -------- ---------- ---------------------------------------------- 25 | */ 26 | 27 | VOID RTMPIdsPeriodicExec( 28 | IN PVOID SystemSpecific1, 29 | IN PVOID FunctionContext, 30 | IN PVOID SystemSpecific2, 31 | IN PVOID SystemSpecific3); 32 | 33 | BOOLEAN RTMPSpoofedMgmtDetection( 34 | IN PRTMP_ADAPTER pAd, 35 | IN PHEADER_802_11 pHeader, 36 | IN CHAR Rssi0, 37 | IN CHAR Rssi1, 38 | IN CHAR Rssi2, 39 | IN UCHAR AntSel); 40 | 41 | VOID RTMPConflictSsidDetection( 42 | IN PRTMP_ADAPTER pAd, 43 | IN PUCHAR pSsid, 44 | IN UCHAR SsidLen, 45 | IN CHAR Rssi0, 46 | IN CHAR Rssi1, 47 | IN CHAR Rssi2, 48 | IN UCHAR AntSel); 49 | 50 | BOOLEAN RTMPReplayAttackDetection( 51 | IN PRTMP_ADAPTER pAd, 52 | IN PUCHAR pAddr2, 53 | IN CHAR Rssi0, 54 | IN CHAR Rssi1, 55 | IN CHAR Rssi2, 56 | IN UCHAR AntSel, 57 | IN UCHAR BW); 58 | 59 | VOID RTMPUpdateStaMgmtCounter( 60 | IN PRTMP_ADAPTER pAd, 61 | IN USHORT type); 62 | 63 | VOID RTMPClearAllIdsCounter( 64 | IN PRTMP_ADAPTER pAd); 65 | 66 | VOID RTMPIdsStart( 67 | IN PRTMP_ADAPTER pAd); 68 | 69 | VOID RTMPIdsStop( 70 | IN PRTMP_ADAPTER pAd); 71 | 72 | VOID rtmp_read_ids_from_file( 73 | IN PRTMP_ADAPTER pAd, 74 | char *tmpbuf, 75 | char *buffer); 76 | 77 | -------------------------------------------------------------------------------- /os/linux/Makefile.clean: -------------------------------------------------------------------------------- 1 | include $(RT28xx_DIR)/os/linux/config.mk 2 | 3 | PHONY := clean install uninstall 4 | 5 | clean: 6 | rm -f ../../common/*.o 7 | rm -f ../../common/.*.cmd .*.flags .*.d 8 | rm -f ../../os/linux/*.o *.ko *.mod.o *.mod.c 9 | rm -f ../../os/linux/.*.cmd .*.flags .*.d 10 | rm -fr ../../os/linux/.tmp_versions 11 | #Must clean Module.symvers; or you will suffer symbol version not match 12 | #when OS_ABL = YES. 13 | rm -f ../../os/linux/Module.symvers 14 | rm -f ../../os/linux/Modules.symvers 15 | rm -f ../../os/linux/Module.markers 16 | rm -f ../../os/linux/modules.order 17 | rm -f ../../chips/*.o 18 | rm -f ../../chips/.*.cmd .*.flags .*.d 19 | rm -f ../../rate_ctrl/*.o 20 | rm -f ../../rate_ctrl/.*.cmd .*.flags .*.d 21 | rm -f ../../ate/common/*.o 22 | rm -f ../../ate/common/.*.cmd .*.flags .*.d 23 | rm -f ../../ate/chips/*.o 24 | rm -f ../../ate/chips/.*.cmd .*.flags .*.d 25 | rm -f ../../phy/*.o 26 | rm -f ../../phy/.*.cmd .*.flags .*.d 27 | rm -f ../../mac/*.o 28 | rm -f ../../mac/.*.cmd .*.flags .*.d 29 | rm -f ../../mcu/*.o 30 | rm -f ../../mcu/.*.cmd .*.flags .*.d 31 | rm -f ../../mgmt/*.o 32 | rm -f ../../mgmt/.*.cmd .*.flags .*.d 33 | rm -f ../../naf/*.o 34 | rm -f ../../naf/.*.cmd .*.flags .*.d 35 | rm -f ../../ap/*.o 36 | rm -f ../../ap/.*.cmd .*.flags .*.d 37 | ifeq ($(HAS_CONFIG_ELIAN_SUPPORT),y) 38 | rm -f ../../elian/lib/*.o 39 | rm -f ../../elian/lib/.*.cmd .*.flags .*.d 40 | rm -f ../../elian/msc/*.o 41 | rm -f ../../elian/msc/.*.cmd .*.flags .*.d 42 | rm -f ../../elian/os/linux/*.o 43 | rm -f ../../elian/os/linux/.*.cmd .*.flags .*.d 44 | endif 45 | ifeq ($(RT28xx_MODE),AP) 46 | rm -f ../../ap/*.o 47 | rm -f ../../ap/.*.cmd .*.flags .*.d 48 | else 49 | ifeq ($(RT28xx_MODE),STA) 50 | rm -f ../../sta/*.o 51 | rm -f ../../sta/.*.cmd .*.flags .*.d 52 | ifeq ($(HAS_P2P_SUPPORT),y) 53 | rm -f ../../ap/*.o 54 | rm -f ../../ap/.*.cmd .*.flags .*.d 55 | endif 56 | else 57 | ifeq ($(RT28xx_MODE),APSTA) 58 | rm -f ../../ap/*.o 59 | rm -f ../../ap/.*.cmd .*.flags .*.d 60 | rm -f ../../sta/*.o 61 | rm -f ../../sta/.*.cmd .*.flags .*.d 62 | endif 63 | endif 64 | endif 65 | 66 | # Declare the contents of the .PHONY variable as phony. We keep that 67 | # information in a variable so we can use it in if_changed and friends. 68 | .PHONY: $(PHONY) 69 | -------------------------------------------------------------------------------- /include/br_ftph.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * Taiwan, R.O.C. 4 | * 5 | * (c) Copyright 2002, Ralink Technology, Inc. 6 | * 7 | * All rights reserved. Ralink's source code is an unpublished work and the 8 | * use of a copyright notice does not imply otherwise. This source code 9 | * contains confidential trade secret material of Ralink Tech. Any attemp 10 | * or participation in deciphering, decoding, reverse engineering or in any 11 | * way altering the source code is stricitly prohibited, unless the prior 12 | * written consent of Ralink Technology, Inc. is obtained. 13 | ***************************************************************************/ 14 | 15 | /**************************************************************************** 16 | 17 | Abstract: 18 | 19 | All Bridge Fast Path Related Structure & Definition. 20 | 21 | ***************************************************************************/ 22 | 23 | #ifndef __BR_FTPH_H__ 24 | #define __BR_FTPH_H__ 25 | 26 | /* Public function prototype */ 27 | /* 28 | ======================================================================== 29 | Routine Description: 30 | Init bridge fast path module. 31 | 32 | Arguments: 33 | None 34 | 35 | Return Value: 36 | None 37 | 38 | Note: 39 | Used in module init. 40 | ======================================================================== 41 | */ 42 | VOID BG_FTPH_Init(VOID); 43 | 44 | /* 45 | ======================================================================== 46 | Routine Description: 47 | Remove bridge fast path module. 48 | 49 | Arguments: 50 | None 51 | 52 | Return Value: 53 | None 54 | 55 | Note: 56 | Used in module remove. 57 | ======================================================================== 58 | */ 59 | VOID BG_FTPH_Remove(VOID); 60 | 61 | /* 62 | ======================================================================== 63 | Routine Description: 64 | Forward the received packet. 65 | 66 | Arguments: 67 | pPacket - the received packet 68 | 69 | Return Value: 70 | None 71 | 72 | Note: 73 | ======================================================================== 74 | */ 75 | UINT32 BG_FTPH_PacketFromApHandle( 76 | IN PNDIS_PACKET pPacket); 77 | 78 | #endif /* __BR_FTPH_H__ */ 79 | 80 | /* End of br_ftph.h */ 81 | 82 | -------------------------------------------------------------------------------- /include/iface/iface_util.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * 4F, No. 2 Technology 5th Rd. 4 | * Science-based Industrial Park 5 | * Hsin-chu, Taiwan, R.O.C. 6 | * (c) Copyright 2002, Ralink Technology, Inc. 7 | * 8 | * All rights reserved. Ralink's source code is an unpublished work and the 9 | * use of a copyright notice does not imply otherwise. This source code 10 | * contains confidential trade secret material of Ralink Tech. Any attemp 11 | * or participation in deciphering, decoding, reverse engineering or in any 12 | * way altering the source code is stricitly prohibited, unless the prior 13 | * written consent of Ralink Technology, Inc. is obtained. 14 | **************************************************************************** 15 | 16 | Module Name: 17 | rtmp_util.h 18 | 19 | Abstract: 20 | Common for PCI/USB/RBUS. 21 | 22 | Revision History: 23 | Who When What 24 | --------- ---------- ---------------------------------------------- 25 | */ 26 | 27 | #ifndef __RTMP_UTIL_H__ 28 | #define __RTMP_UTIL_H__ 29 | 30 | /* maximum of PCI, USB, or RBUS, int PCI, it is 0 but in USB, it is 11 */ 31 | #define RTMP_PKT_TAIL_PADDING 11 /* 3(max 4 byte padding) + 4 (last packet padding) + 4 (MaxBulkOutsize align padding) */ 32 | 33 | #ifdef PCI_MSI_SUPPORT 34 | #define RTMP_MSI_ENABLE(_pAd) \ 35 | { POS_COOKIE _pObj = (POS_COOKIE)(_pAd->OS_Cookie); \ 36 | (_pAd)->HaveMsi = pci_enable_msi(_pObj->pci_dev) == 0 ? TRUE : FALSE; \ 37 | } 38 | 39 | #define RTMP_MSI_DISABLE(_pci_dev, _pHaveMsi) \ 40 | { \ 41 | if (*(_pHaveMsi) == TRUE) \ 42 | pci_disable_msi(_pci_dev); \ 43 | *(_pHaveMsi) = FALSE; \ 44 | } 45 | 46 | #else 47 | #define RTMP_MSI_ENABLE(_pAd) do{}while(0) 48 | #define RTMP_MSI_DISABLE(_pci_dev, _pHaveMsi) do{}while(0) 49 | #endif /* PCI_MSI_SUPPORT */ 50 | 51 | #define RTMP_PCI_DMA_TODEVICE 0xFF00 52 | #define RTMP_PCI_DMA_FROMDEVICE 0xFF01 53 | 54 | 55 | 56 | 57 | #define UNLINK_TIMEOUT_MS 3 58 | 59 | #define USBD_TRANSFER_DIRECTION_OUT 0 60 | #define USBD_TRANSFER_DIRECTION_IN 0 61 | #define USBD_SHORT_TRANSFER_OK 0 62 | #define PURB purbb_t 63 | 64 | #define OS_RTUSBMlmeUp RtmpOsMlmeUp 65 | 66 | 67 | 68 | 69 | #endif /* __RTMP_UTIL_H__ */ 70 | -------------------------------------------------------------------------------- /include/crypt_dh.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * Taiwan, R.O.C. 4 | * 5 | * (c) Copyright 2002, Ralink Technology, Inc. 6 | * 7 | * All rights reserved. Ralink's source code is an unpublished work and the 8 | * use of a copyright notice does not imply otherwise. This source code 9 | * contains confidential trade secret material of Ralink Tech. Any attemp 10 | * or participation in deciphering, decoding, reverse engineering or in any 11 | * way altering the source code is stricitly prohibited, unless the prior 12 | * written consent of Ralink Technology, Inc. is obtained. 13 | ***************************************************************************/ 14 | 15 | /**************************************************************************** 16 | Module Name: 17 | DH 18 | 19 | Abstract: 20 | RFC 2631: Diffie-Hellman Key Agreement Method 21 | 22 | Revision History: 23 | Who When What 24 | -------- ---------- ------------------------------------------ 25 | Eddy 2009/01/21 Create Diffie-Hellman, Montgomery Algorithm 26 | ***************************************************************************/ 27 | 28 | #ifndef __CRYPT_DH_H__ 29 | #define __CRYPT_DH_H__ 30 | 31 | #include "rt_config.h" 32 | 33 | 34 | /* DH operations */ 35 | void DH_PublicKey_Generate ( 36 | IN UINT8 GValue[], 37 | IN UINT GValueLength, 38 | IN UINT8 PValue[], 39 | IN UINT PValueLength, 40 | IN UINT8 PrivateKey[], 41 | IN UINT PrivateKeyLength, 42 | OUT UINT8 PublicKey[], 43 | INOUT UINT *PublicKeyLength); 44 | 45 | void DH_SecretKey_Generate ( 46 | IN UINT8 PublicKey[], 47 | IN UINT PublicKeyLength, 48 | IN UINT8 PValue[], 49 | IN UINT PValueLength, 50 | IN UINT8 PrivateKey[], 51 | IN UINT PrivateKeyLength, 52 | OUT UINT8 SecretKey[], 53 | INOUT UINT *SecretKeyLength); 54 | 55 | #define RT_DH_PublicKey_Generate(GK, GKL, PV, PVL, PriK, PriKL, PubK, PubKL) \ 56 | DH_PublicKey_Generate((GK), (GKL), (PV), (PVL), (PriK), (PriKL), (UINT8 *) (PubK), (UINT *) (PubKL)) 57 | 58 | #define RT_DH_SecretKey_Generate(PubK, PubKL, PV, PVL, PriK, PriKL, SecK, SecKL) \ 59 | DH_SecretKey_Generate((PubK), (PubKL), (PV), (PVL), (PriK), (PriKL), (UINT8 *) (SecK), (UINT *) (SecKL)) 60 | 61 | #define RT_DH_FREE_ALL() 62 | 63 | 64 | #endif /* __CRYPT_DH_H__ */ 65 | 66 | -------------------------------------------------------------------------------- /os/linux/Kconfig.sta.soc: -------------------------------------------------------------------------------- 1 | config RT2860V2_STA 2 | tristate "Ralink RT2860 802.11n STA support" 3 | depends on NET_RADIO 4 | 5 | config RT2860V2_STA_WPA_SUPPLICANT 6 | bool "WPA Supplicant" 7 | depends on RT2860V2_STA 8 | 9 | config RT2860V2_STA_ETH_CONVERT 10 | bool "Ethernet Convert Support" 11 | depends on RT2860V2_STA 12 | 13 | config RT2860V2_STA_DPB 14 | bool 15 | depends on RT2860V2_STA_ETH_CONVERT 16 | default y 17 | 18 | config RT2860V2_STA_WMM_ACM 19 | bool "WMM ACM Support" 20 | depends on RT2860V2_STA 21 | 22 | config RT2860V2_STA_LED 23 | bool "LED Support" 24 | depends on RT2860V2_STA 25 | 26 | config RT2860V2_STA_IDS 27 | bool "IDS (Intrusion Detection System) Support" 28 | depends on RT2860V2_STA 29 | 30 | config RT2860V2_STA_WSC 31 | bool "WSC (WiFi Simple Config)" 32 | depends on RT2860V2_STA 33 | 34 | config RT2860V2_STA_CARRIER 35 | bool "Carrier Sense Support" 36 | depends on RT2860V2_STA 37 | select RALINK_TIMER 38 | select RALINK_TIMER_DFS 39 | 40 | config RT2860V2_STA_DLS 41 | bool "DLS ((Direct-Link Setup) Support" 42 | depends on RT2860V2_STA 43 | 44 | config RT2860V2_STA_MESH 45 | bool "MESH Support" 46 | depends on RT2860V2_STA 47 | 48 | config RT2860V2_RT3XXX_STA_ANTENNA_DIVERSITY 49 | bool "Antenna Diversity Support" 50 | depends on RT2860V2_STA 51 | 52 | config RT2860V2_HW_STA_ANTENNA_DIVERSITY 53 | bool "Antenna Diversity Support" 54 | depends on RT2860V2_STA 55 | depends on RALINK_RT5350 56 | 57 | #config RT2860V2_STA_WAPI 58 | # bool "WAPI Support" 59 | # depends on RT2860V2_STA 60 | 61 | config RT2860V2_STA_VIDEO_TURBINE 62 | bool "Video Turbine support" 63 | depends on RT2860V2_STA 64 | 65 | config RT2860V2_STA_INTELLIGENT_RATE_ADAPTION 66 | bool "Intelligent Rate Adaption" 67 | depends on RT2860V2_STA 68 | 69 | config RT2860V2_STA_TXBF 70 | bool "Tx Bean Forming Support (Only 3883)" 71 | depends on RT2860V2_STA 72 | depends on RALINK_RT3883 73 | 74 | config RT2860V2_STA_RTMP_INTERNAL_TX_ALC 75 | bool "TSSI Compensation" 76 | depends on RT2860V2_STA 77 | depends on RALINK_RT3350 || RALINK_RT3352 || RALINK_RT5350 78 | 79 | config RT2860V2_STA_80211N_DRAFT3 80 | bool "802.11n Draft3" 81 | depends on RT2860V2_STA 82 | 83 | #config RT2860V2_EXT_CHANNEL_LIST 84 | # bool "Extension Channel List" 85 | # depends on RT2860V2_STA 86 | 87 | #config RT2860V2_SNMP 88 | # bool "Net-SNMP Support" 89 | # depends on RT2860V2_STA 90 | -------------------------------------------------------------------------------- /RT2870AP.dat: -------------------------------------------------------------------------------- 1 | #The word of "Default" must not be removed 2 | Default 3 | CountryRegion=5 4 | CountryRegionABand=7 5 | CountryCode=TW 6 | BssidNum=1 7 | SSID=RT2860AP 8 | WirelessMode=9 9 | TxRate=0 10 | Channel=11 11 | BasicRate=15 12 | BeaconPeriod=100 13 | DtimPeriod=1 14 | TxPower=100 15 | DisableOLBC=0 16 | BGProtection=0 17 | TxAntenna= 18 | RxAntenna= 19 | TxPreamble=0 20 | RTSThreshold=2347 21 | FragThreshold=2346 22 | TxBurst=1 23 | PktAggregate=0 24 | TurboRate=0 25 | WmmCapable=0 26 | APSDCapable=0 27 | DLSCapable=0 28 | APAifsn=3;7;1;1 29 | APCwmin=4;4;3;2 30 | APCwmax=6;10;4;3 31 | APTxop=0;0;94;47 32 | APACM=0;0;0;0 33 | BSSAifsn=3;7;2;2 34 | BSSCwmin=4;4;3;2 35 | BSSCwmax=10;10;4;3 36 | BSSTxop=0;0;94;47 37 | BSSACM=0;0;0;0 38 | AckPolicy=0;0;0;0 39 | NoForwarding=0 40 | NoForwardingBTNBSSID=0 41 | HideSSID=0 42 | StationKeepAlive=0 43 | ShortSlot=1 44 | AutoChannelSelect=0 45 | IEEE8021X=0 46 | IEEE80211H=0 47 | CSPeriod=10 48 | WirelessEvent=0 49 | IdsEnable=0 50 | AuthFloodThreshold=32 51 | AssocReqFloodThreshold=32 52 | ReassocReqFloodThreshold=32 53 | ProbeReqFloodThreshold=32 54 | DisassocFloodThreshold=32 55 | DeauthFloodThreshold=32 56 | EapReqFooldThreshold=32 57 | PreAuth=0 58 | AuthMode=OPEN 59 | EncrypType=NONE 60 | RekeyInterval=0 61 | RekeyMethod=DISABLE 62 | PMKCachePeriod=10 63 | WPAPSK= 64 | DefaultKeyID=1 65 | Key1Type=0 66 | Key1Str= 67 | Key2Type=0 68 | Key2Str= 69 | Key3Type=0 70 | Key3Str= 71 | Key4Type=0 72 | Key4Str= 73 | HSCounter=0 74 | AccessPolicy0=0 75 | AccessControlList0= 76 | AccessPolicy1=0 77 | AccessControlList1= 78 | AccessPolicy2=0 79 | AccessControlList2= 80 | AccessPolicy3=0 81 | AccessControlList3= 82 | WdsEnable=0 83 | WdsEncrypType=NONE 84 | WdsList= 85 | WdsKey= 86 | RADIUS_Server=192.168.2.3 87 | RADIUS_Port=1812 88 | RADIUS_Key=ralink 89 | own_ip_addr=192.168.5.234 90 | EAPifname=br0 91 | PreAuthifname=br0 92 | HT_HTC=0 93 | HT_RDG=0 94 | HT_EXTCHA=0 95 | HT_LinkAdapt=0 96 | HT_OpMode=0 97 | HT_MpduDensity=5 98 | HT_BW=1 99 | HT_AutoBA=1 100 | HT_AMSDU=0 101 | HT_BAWinSize=64 102 | HT_GI=1 103 | HT_MCS=33 104 | MeshId=MESH 105 | MeshAutoLink=1 106 | MeshAuthMode=OPEN 107 | MeshEncrypType=NONE 108 | MeshWPAKEY= 109 | MeshDefaultkey=1 110 | MeshWEPKEY= 111 | WscManufacturer= 112 | WscModelName= 113 | WscDeviceName= 114 | WscModelNumber= 115 | WscSerialNumber= 116 | RadioOn=1 117 | PMFMFPC=0 118 | PMFMFPR=0 119 | PMFSHA256=0 -------------------------------------------------------------------------------- /include/rtmp_mcu.h: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002-2004, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | rtmp_mcu.h 20 | 21 | Abstract: 22 | Miniport header file for mcu related information 23 | 24 | Revision History: 25 | Who When What 26 | -------- ---------- ---------------------------------------------- 27 | */ 28 | 29 | #ifndef __RTMP_MCU_H__ 30 | #define __RTMP_MCU_H__ 31 | 32 | enum MCU_TYPE { 33 | SWMCU, 34 | M8051, 35 | ANDES, 36 | }; 37 | 38 | 39 | struct _RTMP_ADAPTER; 40 | 41 | typedef void (*CMD_RSP_HANDLER)(struct _RTMP_ADAPTER *pAd, UCHAR *Data); 42 | 43 | /* 44 | * CMD Unit (8051, Andes, ...,and etc) 45 | */ 46 | struct CMD_UNIT { 47 | union { 48 | struct { 49 | UCHAR Command; 50 | UCHAR Token; 51 | UCHAR Arg0; 52 | UCHAR Arg1; 53 | } MCU51; 54 | struct { 55 | UINT8 Type; 56 | USHORT CmdPayloadLen; 57 | PUCHAR CmdPayload; 58 | USHORT RspPayloadLen; 59 | PUCHAR RspPayload; 60 | ULONG Timeout; 61 | BOOLEAN NeedRsp; 62 | BOOLEAN NeedWait; 63 | CMD_RSP_HANDLER CmdRspHdler; 64 | } ANDES; 65 | } u; 66 | }; 67 | 68 | 69 | struct MCU_CTRL { 70 | UCHAR CmdSeq; 71 | NDIS_SPIN_LOCK CmdRspEventListLock; 72 | DL_LIST CmdRspEventList; 73 | }; 74 | 75 | 76 | struct CMD_RSP_EVENT { 77 | DL_LIST List; 78 | UCHAR CmdSeq; 79 | UINT32 Timeout; 80 | BOOLEAN NeedWait; 81 | PVOID AckDone; 82 | UCHAR **RspPayload; 83 | USHORT *RspPayloadLen; 84 | }; 85 | 86 | VOID ChipOpsMCUHook(struct _RTMP_ADAPTER *pAd, enum MCU_TYPE MCUType); 87 | VOID MCUCtrlInit(struct _RTMP_ADAPTER *pAd); 88 | VOID MCUCtrlExit(struct _RTMP_ADAPTER *pAd); 89 | NDIS_STATUS isMCUNeedToLoadFIrmware( 90 | struct _RTMP_ADAPTER *pAd); 91 | 92 | 93 | #endif 94 | -------------------------------------------------------------------------------- /os/linux/Kconfig.ap.usb: -------------------------------------------------------------------------------- 1 | config RTUSB_AP 2 | tristate "Ralink WiFi USB combo driver AP module" 3 | depends on m 4 | default m 5 | 6 | config RTUSB_AP_WSC 7 | bool "WPS support including WPS2.0" 8 | depends on RTUSB_AP 9 | default y 10 | 11 | config RTUSB_AP_MBSS 12 | bool "MBSS support" 13 | depends on RTUSB_AP 14 | default y 15 | 16 | config RTUSB_AP_NEW_MBSS_MODE 17 | bool "New MBSS support" 18 | depends on RTUSB_AP_MBSS 19 | 20 | config RTUSB_WDS 21 | bool "WDS support" 22 | depends on RTUSB_AP 23 | 24 | config RTUSB_APCLI 25 | bool "APClient support" 26 | depends on RTUSB_AP 27 | 28 | config RTUSB_DFS 29 | bool "DFS support" 30 | depends on RTUSB_AP 31 | 32 | config RTUSB_CS 33 | bool "CS support" 34 | depends on RTUSB_AP 35 | 36 | config RTUSB_IGMP_SNOOP 37 | bool "IGMP snoop support" 38 | depends on RTUSB_AP 39 | 40 | config RTUSB_NETIF_BLOCK 41 | bool "NETIF block support" 42 | depends on RTUSB_AP 43 | 44 | config RTUSB_DLS 45 | bool "DLS support" 46 | depends on RTUSB_AP 47 | 48 | config RTUSB_IDS 49 | bool "IDS support" 50 | depends on RTUSB_AP 51 | 52 | config RTUSB_AP_FLASH_SUPPORT 53 | bool "FLASH support" 54 | depends on RTUSB_AP 55 | 56 | config RTUSB_AP_80211N_DRAFT3 57 | bool "802.11n Draft3 support" 58 | depends on RTUSB_AP 59 | default y 60 | 61 | # Chip related 62 | config RT2870_AP 63 | bool "RT2870 support" 64 | depends on RTUSB_AP 65 | 66 | config RT3572_AP 67 | bool "RT3572 support" 68 | depends on RTUSB_AP 69 | 70 | config RT3573_AP 71 | bool "RT3573 support" 72 | depends on RTUSB_AP 73 | 74 | config RT5572_AP 75 | bool "RT5572 support" 76 | depends on RTUSB_AP 77 | default y 78 | 79 | # ATE 80 | config RTUSB_AP_ATE 81 | bool "ATE support" 82 | depends on RTUSB_AP 83 | 84 | config RT2870_AP_ATE 85 | bool "RT2870 ATE support" 86 | depends on RTUSB_AP_ATE && RT2870_AP 87 | 88 | config RT3572_AP_ATE 89 | bool "RT3572 ATE support" 90 | depends on RTUSB_AP_ATE && RT3572_AP 91 | 92 | config RT5572_AP_ATE 93 | bool "RT5572 ATE support" 94 | depends on RTUSB_AP_ATE && RT5572_AP 95 | default y 96 | 97 | # QA 98 | config RTUSB_AP_QA 99 | bool "QA tool support" 100 | depends on RTUSB_AP_ATE 101 | default y 102 | 103 | config RTUSB_AP_WAPI 104 | bool "WAPI support" 105 | depends on RTUSB_AP 106 | 107 | # Platform specific 108 | config RT5572_AP_WDS 109 | bool 110 | depends on RTUSB_WDS 111 | default y 112 | -------------------------------------------------------------------------------- /include/ap_mbss.h: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | ap_mbss.h 20 | 21 | Abstract: 22 | Support multi-BSS function. 23 | 24 | Revision History: 25 | Who When What 26 | -------- ---------- ---------------------------------------------- 27 | Sample Lin 01-02-2007 created 28 | */ 29 | 30 | #ifndef MODULE_MBSS 31 | 32 | #define MBSS_EXTERN extern 33 | 34 | #else 35 | 36 | #define MBSS_EXTERN 37 | 38 | #endif /* MODULE_MBSS */ 39 | 40 | 41 | /* 42 | For MBSS, the phy mode is different; 43 | So MBSS_PHY_MODE_RESET() can help us to adjust the correct mode & 44 | maximum MCS for the BSS. 45 | */ 46 | #define MBSS_PHY_MODE_RESET(__BssId, __HtPhyMode) \ 47 | { \ 48 | UCHAR __PhyMode = pAd->ApCfg.MBSSID[__BssId].PhyMode; \ 49 | if ((__PhyMode == WMODE_B) && \ 50 | (__HtPhyMode.field.MODE != MODE_CCK)) \ 51 | { \ 52 | __HtPhyMode.field.MODE = MODE_CCK; \ 53 | __HtPhyMode.field.MCS = 3; \ 54 | } \ 55 | else if ((!WMODE_CAP_N(__PhyMode)) && \ 56 | (__PhyMode != WMODE_B) && \ 57 | (__HtPhyMode.field.MODE != MODE_OFDM)) \ 58 | { \ 59 | __HtPhyMode.field.MODE = MODE_OFDM; \ 60 | __HtPhyMode.field.MCS = 7; \ 61 | } \ 62 | } 63 | 64 | 65 | /* Public function list */ 66 | INT Show_MbssInfo_Display_Proc( 67 | IN PRTMP_ADAPTER pAd, 68 | IN PSTRING arg); 69 | 70 | VOID MBSS_Init( 71 | IN PRTMP_ADAPTER pAd, 72 | IN RTMP_OS_NETDEV_OP_HOOK *pNetDevOps); 73 | 74 | VOID MBSS_Remove( 75 | IN PRTMP_ADAPTER pAd); 76 | 77 | INT MBSS_Open( 78 | IN PNET_DEV pDev); 79 | 80 | INT MBSS_Close( 81 | IN PNET_DEV pDev); 82 | 83 | INT32 RT28xx_MBSS_IdxGet( 84 | IN PRTMP_ADAPTER pAd, 85 | IN PNET_DEV pDev); 86 | 87 | -------------------------------------------------------------------------------- /include/sta_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002-2009, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | sta_cfg.h 20 | 21 | Abstract: 22 | 23 | 24 | Revision History: 25 | Who When What 26 | -------- ---------- ---------------------------------------------- 27 | 28 | */ 29 | 30 | #ifndef __STA_CFG_H__ 31 | #define __STA_CFG_H__ 32 | 33 | INT RTMPSTAPrivIoctlSet( 34 | IN RTMP_ADAPTER *pAd, 35 | IN PSTRING SetProcName, 36 | IN PSTRING ProcArg); 37 | 38 | #if (defined(WOW_SUPPORT) && defined(RTMP_MAC_USB)) || defined(NEW_WOW_SUPPORT) 39 | /* set WOW enable */ 40 | INT Set_WOW_Enable( 41 | IN PRTMP_ADAPTER pAd, 42 | IN PSTRING arg); 43 | /* set GPIO pin for wake-up signal */ 44 | INT Set_WOW_GPIO( 45 | IN PRTMP_ADAPTER pAd, 46 | IN PSTRING arg); 47 | /* set delay time for WOW really enable */ 48 | INT Set_WOW_Delay( 49 | IN PRTMP_ADAPTER pAd, 50 | IN PSTRING arg); 51 | /* set wake up hold time */ 52 | INT Set_WOW_Hold( 53 | IN PRTMP_ADAPTER pAd, 54 | IN PSTRING arg); 55 | /* set wakeup signal type */ 56 | INT Set_WOW_InBand( 57 | IN PRTMP_ADAPTER pAd, 58 | IN PSTRING arg); 59 | #endif /* (defined(WOW_SUPPORT) && defined(RTMP_MAC_USB)) || defined(NEW_WOW_SUPPORT) */ 60 | #ifdef RTMP_MAC_USB 61 | /* Sets the FW into WOW Suspend mode */ 62 | INT Set_UsbWOWSuspend( 63 | IN PRTMP_ADAPTER pAd, 64 | IN PSTRING arg); 65 | /* Resume the FW to Normal mode */ 66 | INT Set_UsbWOWResume( 67 | IN PRTMP_ADAPTER pAd, 68 | IN PSTRING arg); 69 | /* Set chip into power-saving mode */ 70 | INT Set_UsbPowerSaving( 71 | IN PRTMP_ADAPTER pAd, 72 | IN PSTRING arg); 73 | INT Set_AdvPowerSavingDebug( 74 | IN PRTMP_ADAPTER pAd, 75 | IN PSTRING arg); 76 | #endif /* RTMP_MAC_USB */ 77 | #endif /* __STA_CFG_H__ */ 78 | -------------------------------------------------------------------------------- /include/chip/chip_id.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * 4F, No. 2 Technology 5th Rd. 4 | * Science-based Industrial Park 5 | * Hsin-chu, Taiwan, R.O.C. 6 | * (c) Copyright 2002, Ralink Technology, Inc. 7 | * 8 | * All rights reserved. Ralink's source code is an unpublished work and the 9 | * use of a copyright notice does not imply otherwise. This source code 10 | * contains confidential trade secret material of Ralink Tech. Any attemp 11 | * or participation in deciphering, decoding, reverse engineering or in any 12 | * way altering the source code is stricitly prohibited, unless the prior 13 | * written consent of Ralink Technology, Inc. is obtained. 14 | **************************************************************************** 15 | 16 | Module Name: 17 | chip_id.h 18 | 19 | Abstract: 20 | 21 | Revision History: 22 | Who When What 23 | --------- ---------- ---------------------------------------------- 24 | */ 25 | 26 | #ifndef __CHIP_ID_H__ 27 | #define __CHIP_ID_H__ 28 | 29 | 30 | #define NIC_PCI_VENDOR_ID 0x1814 31 | 32 | #define NIC2860_PCI_DEVICE_ID 0x0601 33 | #define NIC2860_PCIe_DEVICE_ID 0x0681 34 | #define NIC2760_PCI_DEVICE_ID 0x0701 /* 1T/2R Cardbus ??? */ 35 | #define NIC2790_PCIe_DEVICE_ID 0x0781 /* 1T/2R miniCard */ 36 | 37 | #define VEN_AWT_PCIe_DEVICE_ID 0x1059 38 | #define VEN_AWT_PCI_VENDOR_ID 0x1A3B 39 | 40 | #define EDIMAX_PCI_VENDOR_ID 0x1432 41 | 42 | #define NIC3090_PCIe_DEVICE_ID 0x3090 /* 1T/1R miniCard */ 43 | #define NIC3091_PCIe_DEVICE_ID 0x3091 /* 1T/2R miniCard */ 44 | #define NIC3092_PCIe_DEVICE_ID 0x3092 /* 2T/2R miniCard */ 45 | #define NIC3390_PCIe_DEVICE_ID 0x3390 /* 1T/1R miniCard */ 46 | 47 | #define NIC3062_PCI_DEVICE_ID 0x3062 /* 2T/2R miniCard */ 48 | #define NIC3562_PCI_DEVICE_ID 0x3562 /* 2T/2R miniCard */ 49 | #define NIC3060_PCI_DEVICE_ID 0x3060 /* 1T/1R miniCard */ 50 | 51 | #define NIC3592_PCIe_DEVICE_ID 0x3592 /* 2T/2R miniCard */ 52 | 53 | 54 | #define NIC3593_PCI_OR_PCIe_DEVICE_ID 0x3593 55 | #define NIC5390_PCIe_DEVICE_ID 0x5390 56 | #define NIC539F_PCIe_DEVICE_ID 0x539F 57 | #define NIC5392_PCIe_DEVICE_ID 0x5392 58 | #define NIC5360_PCI_DEVICE_ID 0x5360 59 | #define NIC5362_PCI_DEVICE_ID 0x5362 60 | 61 | #define NIC5592_PCIe_DEVICE_ID 0x5592 62 | 63 | #define NIC3290_PCIe_DEVICE_ID 0x3290 64 | 65 | #define NIC6590_PCIe_DEVICE_ID 0x6590 66 | #define NIC7601_PCIe_DEVICE_ID 0x7601 67 | 68 | #define NIC8592_5592_PCIe_DEVICE_ID 0x5592 69 | #define NIC8592_PCIe_DEVICE_ID 0x8592 70 | 71 | #define NIC6390_PCIe_DEVICE_ID 0x6390 72 | 73 | #endif /* __CHIP_ID_H__ */ 74 | -------------------------------------------------------------------------------- /common/eeprom.c: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002-2004, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | eeprom.c 20 | 21 | Abstract: 22 | 23 | Revision History: 24 | Who When What 25 | -------- ---------- ---------------------------------------------- 26 | Name Date Modification logs 27 | */ 28 | #include "rt_config.h" 29 | 30 | 31 | INT RtmpChipOpsEepromHook(RTMP_ADAPTER *pAd, INT infType) 32 | { 33 | RTMP_CHIP_OP *pChipOps = &pAd->chipOps; 34 | /*UINT32 e2p_csr;*/ 35 | 36 | #ifdef RTMP_FLASH_SUPPORT 37 | pChipOps->eeinit = rtmp_nv_init; 38 | pChipOps->eeread = rtmp_ee_flash_read; 39 | pChipOps->eewrite = rtmp_ee_flash_write; 40 | return 0; 41 | #endif /* RTMP_FLASH_SUPPORT */ 42 | 43 | #ifdef RTMP_EFUSE_SUPPORT 44 | efuse_probe(pAd); 45 | if(pAd->bUseEfuse) 46 | { 47 | pChipOps->eeinit = eFuse_init; 48 | pChipOps->eeread = rtmp_ee_efuse_read16; 49 | pChipOps->eewrite = rtmp_ee_efuse_write16; 50 | DBGPRINT(RT_DEBUG_OFF, ("NVM is EFUSE\n")); 51 | DBGPRINT(RT_DEBUG_TRACE, ("Efuse Size=0x%x [Range:%x-%x] \n", 52 | pAd->chipCap.EFUSE_USAGE_MAP_SIZE, 53 | pAd->chipCap.EFUSE_USAGE_MAP_START, 54 | pAd->chipCap.EFUSE_USAGE_MAP_END)); 55 | 56 | return 0 ; 57 | } 58 | else 59 | { 60 | pAd->bFroceEEPROMBuffer = FALSE; 61 | DBGPRINT(RT_DEBUG_OFF, ("NVM is EEPROM\n")); 62 | } 63 | #endif /* RTMP_EFUSE_SUPPORT */ 64 | 65 | switch(infType) 66 | { 67 | 68 | 69 | #ifdef RTMP_USB_SUPPORT 70 | case RTMP_DEV_INF_USB: 71 | pChipOps->eeinit = NULL; 72 | pChipOps->eeread = RTUSBReadEEPROM16; 73 | pChipOps->eewrite = RTUSBWriteEEPROM16; 74 | DBGPRINT(RT_DEBUG_OFF, ("pChipOps->eeread = RTUSBReadEEPROM16\n")); 75 | DBGPRINT(RT_DEBUG_OFF, ("pChipOps->eewrite = RTUSBWriteEEPROM16\n")); 76 | break; 77 | #endif /* RTMP_USB_SUPPORT */ 78 | default: 79 | DBGPRINT(RT_DEBUG_ERROR, ("RtmpChipOpsEepromHook() failed!\n")); 80 | break; 81 | } 82 | 83 | return 0; 84 | } 85 | 86 | -------------------------------------------------------------------------------- /os/linux/EEPROMDump.txt: -------------------------------------------------------------------------------- 1 | 00000000 = 7650 2 | 00000002 = 0100 3 | 00000004 = 0c00 4 | 00000006 = 7643 5 | 00000008 = 1750 6 | 0000000a = 7650 7 | 0000000c = 1814 8 | 0000000e = 6598 9 | 00000010 = 1814 10 | 00000012 = 7550 11 | 00000014 = 1814 12 | 00000016 = 6598 13 | 00000018 = 1814 14 | 0000001a = 0c00 15 | 0000001c = 4643 16 | 0000001e = 0100 17 | 00000020 = 000a 18 | 00000022 = f7c4 19 | 00000024 = ffff 20 | 00000026 = ffff 21 | 00000028 = ffff 22 | 0000002a = ffff 23 | 0000002c = ffff 24 | 0000002e = ffff 25 | 00000030 = 758e 26 | 00000032 = 4301 27 | 00000034 = ff11 28 | 00000036 = 2824 29 | 00000038 = ffff 30 | 0000003a = 0100 31 | 0000003c = ffff 32 | 0000003e = 9999 33 | 00000040 = 888c 34 | 00000042 = 0011 35 | 00000044 = 080a 36 | 00000046 = 0000 37 | 00000048 = 080a 38 | 0000004a = 0000 39 | 0000004c = 0800 40 | 0000004e = ffff 41 | 00000050 = 0000 42 | 00000052 = 0505 43 | 00000054 = 0505 44 | 00000056 = 0505 45 | 00000058 = 0505 46 | 0000005a = 0505 47 | 0000005c = 0505 48 | 0000005e = 0505 49 | 00000060 = ffff 50 | 00000062 = ffff 51 | 00000064 = ffff 52 | 00000066 = ffff 53 | 00000068 = ffff 54 | 55 | 0000006c = ffff 56 | 0000006e = ffff 57 | 00000070 = ffff 58 | 00000072 = ffff 59 | 00000074 = ffff 60 | 00000076 = ffff 61 | 00000078 = ffff 62 | 0000007a = 0606 63 | 0000007c = 0606 64 | 0000007e = 0606 65 | 00000080 = 0606 66 | 00000082 = 0606 67 | 00000084 = 0606 68 | 00000086 = 0606 69 | 00000088 = 0606 70 | 0000008a = 0606 71 | 0000008c = 0606 72 | 0000008e = 0606 73 | 00000090 = 0606 74 | 00000092 = 0606 75 | 00000094 = 0606 76 | 00000096 = 0606 77 | 00000098 = 0606 78 | 0000009a = ff06 79 | 0000009c = ffff 80 | 0000009e = ffff 81 | 000000a0 = ffff 82 | 000000a2 = ffff 83 | 000000a4 = ffff 84 | 000000a6 = ffff 85 | 000000a8 = ffff 86 | 000000aa = ffff 87 | 000000ac = ffff 88 | 000000ae = ffff 89 | 000000b0 = ffff 90 | 000000b2 = ffff 91 | 000000b4 = ffff 92 | 000000b6 = ffff 93 | 000000b8 = ffff 94 | 000000ba = ffff 95 | 000000bc = ffff 96 | 000000be = ffff 97 | 000000c0 = ffff 98 | 000000c2 = ffff 99 | 000000c4 = ffff 100 | 000000c6 = ffff 101 | 000000c8 = ffff 102 | 000000ca = ffff 103 | 000000cc = ffff 104 | 000000ce = efff 105 | 000000d0 = ffff 106 | 000000d2 = ffff 107 | 000000d4 = ffff 108 | 000000d6 = ffff 109 | 000000d8 = ffff 110 | 000000da = ffff 111 | 000000dc = ffff 112 | 000000de = 3030 113 | 000000e0 = 3030 114 | 000000e2 = 3030 115 | 000000e4 = 3030 116 | 000000e6 = 3030 117 | 000000e8 = 3030 118 | 000000ea = 3030 119 | 000000ec = 3030 120 | 000000ee = 3030 121 | 000000f0 = ffff 122 | 000000f2 = ffff 123 | 000000f4 = ffff 124 | 000000f6 = ffff 125 | 000000f8 = ffff 126 | 000000fa = ffff 127 | 000000fc = ffff 128 | 000000fe = ffff 129 | -------------------------------------------------------------------------------- /include/mac_ral/pbf.h: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002-2004, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | pbf.h 20 | 21 | Abstract: 22 | Ralink Wireless Chip MAC related definition & structures 23 | 24 | Revision History: 25 | Who When What 26 | -------- ---------- ---------------------------------------------- 27 | */ 28 | 29 | #ifndef __PBF_H__ 30 | #define __PBF_H__ 31 | 32 | 33 | #ifdef RLT_MAC 34 | #include "mac_ral/nmac/ral_nmac_pbf.h" 35 | #endif /* RLT_MAC */ 36 | 37 | #ifdef RTMP_MAC 38 | #include "mac_ral/omac/ral_omac_pbf.h" 39 | #endif /* RTMP_MAC */ 40 | 41 | 42 | /* ================================================================================= */ 43 | /* Register format for PBF */ 44 | /* ================================================================================= */ 45 | 46 | 47 | #define WPDMA_GLO_CFG 0x208 48 | #ifdef RT_BIG_ENDIAN 49 | typedef union _WPDMA_GLO_CFG_STRUC { 50 | struct { 51 | UINT32 rx_2b_offset:1; 52 | UINT32 clk_gate_dis:1; 53 | UINT32 rsv:14; 54 | UINT32 HDR_SEG_LEN:8; 55 | UINT32 BigEndian:1; 56 | UINT32 EnTXWriteBackDDONE:1; 57 | UINT32 WPDMABurstSIZE:2; 58 | UINT32 RxDMABusy:1; 59 | UINT32 EnableRxDMA:1; 60 | UINT32 TxDMABusy:1; 61 | UINT32 EnableTxDMA:1; 62 | } field; 63 | UINT32 word; 64 | }WPDMA_GLO_CFG_STRUC, *PWPDMA_GLO_CFG_STRUC; 65 | #else 66 | typedef union _WPDMA_GLO_CFG_STRUC { 67 | struct { 68 | UINT32 EnableTxDMA:1; 69 | UINT32 TxDMABusy:1; 70 | UINT32 EnableRxDMA:1; 71 | UINT32 RxDMABusy:1; 72 | UINT32 WPDMABurstSIZE:2; 73 | UINT32 EnTXWriteBackDDONE:1; 74 | UINT32 BigEndian:1; 75 | UINT32 HDR_SEG_LEN:8; 76 | UINT32 rsv:14; 77 | UINT32 clk_gate_dis:1; 78 | UINT32 rx_2b_offset:1; 79 | } field; 80 | UINT32 word; 81 | } WPDMA_GLO_CFG_STRUC, *PWPDMA_GLO_CFG_STRUC; 82 | #endif 83 | 84 | 85 | #define PBF_CTRL 0x0410 86 | #define MCU_INT_STA 0x0414 87 | #define MCU_INT_ENA 0x0418 88 | #define TXRXQ_PCNT 0x0438 89 | #define PBF_DBG 0x043c 90 | 91 | 92 | #endif /* __PBF_H__ */ 93 | 94 | -------------------------------------------------------------------------------- /include/mac_ral/omac/ral_omac_rf_ctrl.h: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002-2004, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | ral_omac_rf_ctrl.h 20 | 21 | Abstract: 22 | Ralink Wireless Chip MAC related definition & structures 23 | 24 | Revision History: 25 | Who When What 26 | -------- ---------- ---------------------------------------------- 27 | */ 28 | 29 | #ifndef __RAL_OMAC_RF_CTRL_H__ 30 | #define __RAL_OMAC_RF_CTRL_H__ 31 | 32 | 33 | 34 | /* ================================================================================= */ 35 | /* Register format for RFCTRL */ 36 | /* ================================================================================= */ 37 | 38 | #define OSC_CTRL 0x5a4 39 | #define PCIE_PHY_TX_ATTENUATION_CTRL 0x05C8 40 | #define INTERNAL_1 0x05C8 41 | 42 | #ifdef RT_BIG_ENDIAN 43 | typedef union _INTERNAL_1_STRUCT 44 | { 45 | struct 46 | { 47 | UINT32 Reserve1:10; 48 | UINT32 CSO_RX_IPV6_CHKSUM_EN:1; 49 | UINT32 CSO_TX_IPV6_CHKSUM_EN:1; 50 | UINT32 CSO_HW_PARSE_TCP:1; 51 | UINT32 CSO_HW_PARSE_IP:1; 52 | UINT32 CSO_RX_CHKSUM_EN:1; 53 | UINT32 CSO_TX_CHKSUM_EN:1; 54 | UINT32 CSO_TIMEOUT_VALUE:4; 55 | UINT32 PCIE_PHY_TX_ATTEN_EN:1; 56 | UINT32 PCIE_PHY_TX_ATTEN_VALUE:3; 57 | UINT32 Reserve2:7; 58 | UINT32 RF_ISOLATION_ENABLE:1; 59 | } field; 60 | 61 | UINT32 word; 62 | } INTERNAL_1_STRUCT, *PINTERNAL_1_STRUCT; 63 | #else 64 | typedef union _TX_ATTENUATION_CTRL_STRUC { 65 | struct 66 | { 67 | UINT32 RF_ISOLATION_ENABLE:1; 68 | UINT32 Reserve2:7; 69 | UINT32 PCIE_PHY_TX_ATTEN_VALUE:3; 70 | UINT32 PCIE_PHY_TX_ATTEN_EN:1; 71 | UINT32 CSO_TIMEOUT_VALUE:4; 72 | UINT32 CSO_TX_CHKSUM_EN:1; 73 | UINT32 CSO_RX_CHKSUM_EN:1; 74 | UINT32 CSO_HW_PARSE_IP:1; 75 | UINT32 CSO_HW_PARSE_TCP:1; 76 | UINT32 CSO_TX_IPV6_CHKSUM_EN:1; 77 | UINT32 CSO_RX_IPV6_CHKSUM_EN:1; 78 | UINT32 Reserve1:10; 79 | } field; 80 | 81 | UINT32 word; 82 | } INTERNAL_1_STRUCT, *PINTERNAL_1_STRUCT; 83 | #endif 84 | 85 | #define LDO_CFG0 0x05d4 86 | #define GPIO_SWITCH 0x05dc 87 | 88 | #define DEBUG_INDEX 0x05e8 89 | 90 | 91 | #endif /* __RAL_OMAC_RF_CTRL_H__ */ 92 | 93 | -------------------------------------------------------------------------------- /include/radar.h: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | radar.h 20 | 21 | Abstract: 22 | CS/DFS common functions. 23 | 24 | Revision History: 25 | Who When What 26 | -------- ---------- ---------------------------------------------- 27 | */ 28 | #ifndef __RADAR_H__ 29 | #define __RADAR_H__ 30 | 31 | /* RESTRICTION_BAND_1: 5600MHz ~ 5650MHz */ 32 | #define RESTRICTION_BAND_1(_pAd) \ 33 | _pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40 ? \ 34 | ((_pAd->CommonCfg.Channel >= 116) && (_pAd->CommonCfg.Channel <= 128)) : \ 35 | ((_pAd->CommonCfg.Channel >= 120) && (_pAd->CommonCfg.Channel <= 128)) 36 | 37 | /* 802.11H */ 38 | typedef struct _DOT11_H { 39 | /* 802.11H and DFS related params */ 40 | UCHAR CSCount; /*Channel switch counter */ 41 | UCHAR CSPeriod; /*Channel switch period (beacon count) */ 42 | USHORT RDCount; /*Radar detection counter, if RDCount > ChMovingTime, start to send beacons*/ 43 | UCHAR RDMode; /*Radar Detection mode */ 44 | USHORT ChMovingTime; 45 | BOOLEAN bDFSIndoor; 46 | ULONG InServiceMonitorCount; /* unit: sec */ 47 | } DOT11_H, *PDOT11_H; 48 | 49 | BOOLEAN RadarChannelCheck( 50 | IN PRTMP_ADAPTER pAd, 51 | IN UCHAR Ch); 52 | 53 | ULONG JapRadarType( 54 | IN PRTMP_ADAPTER pAd); 55 | 56 | #ifdef CONFIG_AP_SUPPORT 57 | VOID ChannelSwitchingCountDownProc( 58 | IN PRTMP_ADAPTER pAd); 59 | #endif /* CONFIG_AP_SUPPORT */ 60 | 61 | VOID RadarDetectPeriodic( 62 | IN PRTMP_ADAPTER pAd); 63 | 64 | INT Set_CSPeriod_Proc( 65 | IN PRTMP_ADAPTER pAdapter, 66 | IN PSTRING arg); 67 | 68 | INT Set_ChMovingTime_Proc( 69 | IN PRTMP_ADAPTER pAd, 70 | IN PSTRING arg); 71 | 72 | INT Set_BlockChReset_Proc( 73 | IN PRTMP_ADAPTER pAd, 74 | IN PSTRING arg); 75 | 76 | #if defined(DFS_SUPPORT) || defined(CARRIER_DETECTION_SUPPORT) 77 | INT Set_RadarShow_Proc( 78 | IN PRTMP_ADAPTER pAd, 79 | IN PSTRING arg); 80 | 81 | VOID CckMrcStatusCtrl( 82 | IN PRTMP_ADAPTER pAd); 83 | 84 | VOID RadarGLRTCompensate( 85 | IN PRTMP_ADAPTER pAd); 86 | 87 | #endif /*defined(DFS_SUPPORT) || defined(CARRIER_DETECTION_SUPPORT)*/ 88 | 89 | #endif /* __RADAR_H__ */ 90 | -------------------------------------------------------------------------------- /include/rtmp_dot11.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | */ 4 | 5 | #ifndef __DOT11_BASE_H__ 6 | #define __DOT11_BASE_H__ 7 | 8 | #include "rtmp_type.h" 9 | 10 | #ifdef DOT11_VHT_AC 11 | #include "dot11ac_vht.h" 12 | #endif /* DOT11_VHT_AC */ 13 | 14 | #ifdef TXBF_SUPPORT 15 | /* CSI/Steering values */ 16 | #define DOT11N_BF_FB_NONE 0 17 | #define DOT11N_BF_FB_CSI 1 18 | #define DOT11N_BF_FB_NOCOMP 2 19 | #define DOT11N_BF_FB_COMP 3 20 | #endif /* TXBF_SUPPORT */ 21 | 22 | /* 4-byte HTC field. maybe included in any frame except non-QOS data frame. The Order bit must set 1. */ 23 | typedef struct GNU_PACKED _HT_CONTROL{ 24 | #ifdef RT_BIG_ENDIAN 25 | UINT32 RDG:1; 26 | UINT32 ACConstraint:1; 27 | UINT32 rsv2:5; 28 | UINT32 NDPAnnounce:1; 29 | UINT32 CSISTEERING:2; 30 | UINT32 rsv1:2; 31 | UINT32 CalSeq:2; 32 | UINT32 CalPos:2; 33 | UINT32 MFBorASC:7; 34 | UINT32 MFSI:3; 35 | UINT32 MSI:3; 36 | UINT32 MRQ:1; 37 | UINT32 TRQ:1; 38 | UINT32 vht:1; 39 | #else 40 | UINT32 vht:1; /* indicate for VHT variant or HT variant */ 41 | UINT32 TRQ:1; /*sounding request */ 42 | UINT32 MRQ:1; /*MCS feedback. Request for a MCS feedback */ 43 | UINT32 MSI:3; /*MCS Request, MRQ Sequence identifier */ 44 | UINT32 MFSI:3; /*SET to the received value of MRS. 0x111 for unsolicited MFB. */ 45 | UINT32 MFBorASC:7; /*Link adaptation feedback containing recommended MCS. 0x7f for no feedback or not available */ 46 | UINT32 CalPos:2; /* calibration position */ 47 | UINT32 CalSeq:2; /*calibration sequence */ 48 | UINT32 rsv1:2; /* Reserved */ 49 | UINT32 CSISTEERING:2; /*CSI/ STEERING */ 50 | UINT32 NDPAnnounce:1; /* ZLF announcement */ 51 | UINT32 rsv2:5; /*calibration sequence */ 52 | UINT32 ACConstraint:1; /*feedback request */ 53 | UINT32 RDG:1; /*RDG / More PPDU */ 54 | #endif /* !RT_BIG_ENDIAN */ 55 | } HT_CONTROL, *PHT_CONTROL; 56 | 57 | /* 2-byte QOS CONTROL field */ 58 | typedef struct GNU_PACKED _QOS_CONTROL{ 59 | #ifdef RT_BIG_ENDIAN 60 | USHORT Txop_QueueSize:8; 61 | USHORT AMsduPresent:1; 62 | USHORT AckPolicy:2; /*0: normal ACK 1:No ACK 2:scheduled under MTBA/PSMP 3: BA */ 63 | USHORT EOSP:1; 64 | USHORT TID:4; 65 | #else 66 | USHORT TID:4; 67 | USHORT EOSP:1; 68 | USHORT AckPolicy:2; /*0: normal ACK 1:No ACK 2:scheduled under MTBA/PSMP 3: BA */ 69 | USHORT AMsduPresent:1; 70 | USHORT Txop_QueueSize:8; 71 | #endif /* !RT_BIG_ENDIAN */ 72 | } QOS_CONTROL, *PQOS_CONTROL; 73 | 74 | 75 | typedef struct GNU_PACKED _AC_PARAM_RECORD{ 76 | UINT8 aci_aifsn; 77 | UINT8 ecw_max:4; 78 | UINT8 ecw_min: 4; 79 | UINT16 txop_limit; 80 | }AC_PARAM_RECORD; 81 | 82 | 83 | typedef struct GNU_PACKED _PSPOLL_FRAME { 84 | FRAME_CONTROL FC; 85 | USHORT Aid; 86 | UCHAR Bssid[MAC_ADDR_LEN]; 87 | UCHAR Ta[MAC_ADDR_LEN]; 88 | } PSPOLL_FRAME, *PPSPOLL_FRAME; 89 | 90 | 91 | typedef struct GNU_PACKED _RTS_FRAME { 92 | FRAME_CONTROL FC; 93 | USHORT Duration; 94 | UCHAR Addr1[MAC_ADDR_LEN]; 95 | UCHAR Addr2[MAC_ADDR_LEN]; 96 | } RTS_FRAME, *PRTS_FRAME; 97 | 98 | #endif /* __DOT11_BASE_H__ */ 99 | -------------------------------------------------------------------------------- /include/mac_ral/omac/ral_omac_usb.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * 4F, No. 2 Technology 5th Rd. 4 | * Science-based Industrial Park 5 | * Hsin-chu, Taiwan, R.O.C. 6 | * (c) Copyright 2002, Ralink Technology, Inc. 7 | * 8 | * All rights reserved. Ralink's source code is an unpublished work and the 9 | * use of a copyright notice does not imply otherwise. This source code 10 | * contains confidential trade secret material of Ralink Tech. Any attemp 11 | * or participation in deciphering, decoding, reverse engineering or in any 12 | * way altering the source code is stricitly prohibited, unless the prior 13 | * written consent of Ralink Technology, Inc. is obtained. 14 | **************************************************************************** 15 | 16 | Module Name: 17 | ral_omac_usb.h 18 | 19 | Abstract: 20 | 21 | Revision History: 22 | Who When What 23 | --------- ---------- ---------------------------------------------- 24 | */ 25 | 26 | #ifndef __RAL_OMAC_USB_H__ 27 | #define __RAL_OMAC_USB_H__ 28 | 29 | 30 | #define USB_DMA_CFG 0x02a0 31 | #ifdef RT_BIG_ENDIAN 32 | typedef union _USB_DMA_CFG_STRUC { 33 | struct { 34 | UINT32 TxBusy:1; /*USB DMA TX FSM busy. debug only */ 35 | UINT32 RxBusy:1; /*USB DMA RX FSM busy. debug only */ 36 | UINT32 EpoutValid:6; /*OUT endpoint data valid. debug only */ 37 | UINT32 TxBulkEn:1; /*Enable USB DMA Tx */ 38 | UINT32 RxBulkEn:1; /*Enable USB DMA Rx */ 39 | UINT32 RxBulkAggEn:1; /*Enable Rx Bulk Aggregation */ 40 | UINT32 TxopHalt:1; /*Halt TXOP count down when TX buffer is full. */ 41 | UINT32 TxClear:1; /*Clear USB DMA TX path */ 42 | UINT32 rsv:2; 43 | UINT32 phyclear:1; /*phy watch dog enable. write 1 */ 44 | UINT32 RxBulkAggLmt:8; /*Rx Bulk Aggregation Limit in unit of 1024 bytes */ 45 | UINT32 RxBulkAggTOut:8; /*Rx Bulk Aggregation TimeOut in unit of 33ns */ 46 | } field; 47 | UINT32 word; 48 | } USB_DMA_CFG_STRUC, *PUSB_DMA_CFG_STRUC; 49 | #else 50 | typedef union _USB_DMA_CFG_STRUC { 51 | struct { 52 | UINT32 RxBulkAggTOut:8; /*Rx Bulk Aggregation TimeOut in unit of 33ns */ 53 | UINT32 RxBulkAggLmt:8; /*Rx Bulk Aggregation Limit in unit of 256 bytes */ 54 | UINT32 phyclear:1; /*phy watch dog enable. write 1 */ 55 | UINT32 rsv:2; 56 | UINT32 TxClear:1; /*Clear USB DMA TX path */ 57 | UINT32 TxopHalt:1; /*Halt TXOP count down when TX buffer is full. */ 58 | UINT32 RxBulkAggEn:1; /*Enable Rx Bulk Aggregation */ 59 | UINT32 RxBulkEn:1; /*Enable USB DMA Rx */ 60 | UINT32 TxBulkEn:1; /*Enable USB DMA Tx */ 61 | UINT32 EpoutValid:6; /*OUT endpoint data valid */ 62 | UINT32 RxBusy:1; /*USB DMA RX FSM busy */ 63 | UINT32 TxBusy:1; /*USB DMA TX FSM busy */ 64 | } field; 65 | UINT32 word; 66 | } USB_DMA_CFG_STRUC, *PUSB_DMA_CFG_STRUC; 67 | #endif 68 | 69 | #endif /*__RAL_OMAC_USB_H__ */ 70 | 71 | -------------------------------------------------------------------------------- /os/linux/Makefile.4.util: -------------------------------------------------------------------------------- 1 | include $(RT28xx_DIR)/os/linux/config.mk 2 | 3 | #ifdef CONFIG_AP_SUPPORT 4 | ifeq ($(RT28xx_MODE),AP) 5 | MOD_NAME = rtutil$(MODULE)ap 6 | endif 7 | #endif // CONFIG_AP_SUPPORT // 8 | 9 | #ifdef CONFIG_STA_SUPPORT 10 | ifeq ($(RT28xx_MODE), STA) 11 | MOD_NAME = rtutil$(MODULE)sta 12 | endif 13 | #endif // CONFIG_STA_SUPPORT // 14 | 15 | #ifdef CONFIG_APSTA_SUPPORT 16 | ifeq ($(RT28xx_MODE), APSTA) 17 | MOD_NAME = rtutil$(MODULE)apsta 18 | endif 19 | #endif // CONFIG_APSTA_SUPPORT // 20 | 21 | OBJ := $(MOD_NAME).o 22 | 23 | #ifdef CONFIG_AP_SUPPORT 24 | 25 | RT28XX_AP_OBJ := \ 26 | ../../common/rt_os_util.o\ 27 | ../../os/linux/rt_linux_symb.o\ 28 | ../../os/linux/rt_rbus_pci_util.o\ 29 | ../../os/linux/rt_usb_util.o\ 30 | ../../os/linux/rt_linux.o 31 | 32 | ifeq ($(HAS_BGFP_SUPPORT),y) 33 | RT28XX_AP_OBJ += \ 34 | $(RT28xx_DIR)/os/linux/br_ftph.o 35 | endif 36 | 37 | #endif // CONFIG_AP_SUPPORT // 38 | 39 | 40 | #ifdef CONFIG_STA_SUPPORT 41 | 42 | RT28XX_STA_OBJ := \ 43 | ../../common/rt_os_util.o\ 44 | ../../os/linux/rt_linux_symb.o\ 45 | ../../os/linux/rt_rbus_pci_util.o\ 46 | ../../os/linux/rt_usb_util.o\ 47 | ../../os/linux/rt_linux.o 48 | #endif // CONFIG_STA_SUPPORT // 49 | 50 | 51 | #ifdef CONFIG_APSTA_SUPPORT 52 | RT28XX_APSTA_OBJ := \ 53 | ../../common/rt_os_util.o\ 54 | ../../os/linux/rt_linux_symb.o\ 55 | ../../os/linux/rt_rbus_pci_util.o\ 56 | ../../os/linux/rt_usb_util.o\ 57 | ../../os/linux/rt_linux.o 58 | 59 | #endif // CONFIG_APSTA_SUPPORT // 60 | 61 | PHONY := all clean 62 | 63 | all:$(OBJ) 64 | 65 | rtutil$(MODULE)sta.o: $(RT28XX_STA_OBJ) 66 | $(LD) -r $^ -o $@ 67 | 68 | rtutil$(MODULE)ap.o: $(RT28XX_AP_OBJ) 69 | $(LD) -r $^ -o $@ 70 | 71 | rtutil$(MODULE)apsta.o: $(RT28XX_APSTA_OBJ) 72 | $(LD) -r $^ -o $@ 73 | 74 | clean: 75 | rm -f $(RT28xx_DIR)/common/*.o 76 | rm -f $(RT28xx_DIR)/common/.*.{cmd,flags,d} 77 | rm -f $(RT28xx_DIR)/os/linux/*.{o,ko,mod.{o,c}} 78 | rm -f $(RT28xx_DIR)/os/linux/.*.{cmd,flags,d} 79 | rm -fr $(RT28xx_DIR)/os/linux/.tmp_versions 80 | rm -f $(RT28xx_DIR)/chips/*.o 81 | rm -f $(RT28xx_DIR)/chips/.*.{cmd,flags,d} 82 | ifeq ($(RT28xx_MODE),AP) 83 | rm -f $(RT28xx_DIR)/ap/*.o 84 | rm -f $(RT28xx_DIR)/ap/.*.{cmd,flags,d} 85 | else 86 | ifeq ($(RT28xx_MODE),STA) 87 | rm -f $(RT28xx_DIR)/sta/*.o 88 | rm -f $(RT28xx_DIR)/sta/.*.{cmd,flags,d} 89 | else 90 | ifeq ($(RT28xx_MODE),APSTA) 91 | rm -f $(RT28xx_DIR)/ap/*.o 92 | rm -f $(RT28xx_DIR)/ap/.*.{cmd,flags,d} 93 | rm -f $(RT28xx_DIR)/sta/*.o 94 | rm -f $(RT28xx_DIR)/sta/.*.{cmd,flags,d} 95 | endif 96 | endif 97 | endif 98 | 99 | install: 100 | install -d $(LINUX_SRC_MODULE) 101 | install -m 644 -c $(addsuffix .o,$(MOD_NAME)) $(LINUX_SRC_MODULE) 102 | /sbin/depmod -a ${shell uname -r} 103 | 104 | uninstall: 105 | rm -rf $(addprefix $(LINUX_SRC_MODULE),$(addsuffix .o,$(MOD_NAME))) 106 | /sbin/depmod -a ${shell uname -r} 107 | 108 | # Declare the contents of the .PHONY variable as phony. We keep that 109 | # # information in a variable so we can use it in if_changed and friends. 110 | .PHONY: $(PHONY) 111 | -------------------------------------------------------------------------------- /include/iface/rtmp_usb.h: -------------------------------------------------------------------------------- 1 | #ifndef __RTMP_USB_H__ 2 | #define __RTMP_USB_H__ 3 | 4 | #include "rtusb_io.h" 5 | 6 | extern UCHAR EpToQueue[6]; 7 | 8 | #define RXBULKAGGRE_SIZE 12 9 | #define MAX_TXBULK_LIMIT (LOCAL_TXBUF_SIZE*(BULKAGGRE_SIZE-1)) 10 | #define MAX_TXBULK_SIZE (LOCAL_TXBUF_SIZE*BULKAGGRE_SIZE) 11 | #define MAX_RXBULK_SIZE (LOCAL_TXBUF_SIZE*RXBULKAGGRE_SIZE) 12 | #define MAX_MLME_HANDLER_MEMORY 20 13 | #define CMD_RSP_BULK_SIZE 1024 14 | #ifdef USB_BULK_BUF_ALIGMENT 15 | //#define ALIGMENT_BULKAGGRE_SIZE 16 16 | #ifndef ALIGMENT_BULKAGGRE_SIZE 17 | //#undef 18 | #define ALIGMENT_BULKAGGRE_SIZE 7/* must >= 4*/ 19 | #endif 20 | #define MAX_ALIGMENT_TXBULK_SIZE (LOCAL_TXBUF_SIZE*ALIGMENT_BULKAGGRE_SIZE) 21 | #define BULKOUT_SIZE (LOCAL_TXBUF_SIZE * (ALIGMENT_BULKAGGRE_SIZE -2)) 22 | 23 | #endif /* USB_BULK_BUF_ALIGMENT */ 24 | 25 | //#define BULKOUT_SIZE 0x00006000 26 | 27 | /*Power saving */ 28 | #define PowerWakeCID 3 29 | #define CID0MASK 0x000000ff 30 | #define CID1MASK 0x0000ff00 31 | #define CID2MASK 0x00ff0000 32 | #define CID3MASK 0xff000000 33 | 34 | 35 | /* Flags for Bulkflags control for bulk out data */ 36 | /* */ 37 | #define fRTUSB_BULK_OUT_DATA_NULL 0x00000001 38 | #define fRTUSB_BULK_OUT_RTS 0x00000002 39 | #define fRTUSB_BULK_OUT_MLME 0x00000004 40 | 41 | #define fRTUSB_BULK_OUT_PSPOLL 0x00000010 42 | #define fRTUSB_BULK_OUT_DATA_FRAG 0x00000020 43 | #define fRTUSB_BULK_OUT_DATA_FRAG_2 0x00000040 44 | #define fRTUSB_BULK_OUT_DATA_FRAG_3 0x00000080 45 | #define fRTUSB_BULK_OUT_DATA_FRAG_4 0x00000100 46 | 47 | #define fRTUSB_BULK_OUT_DATA_NORMAL 0x00010000 48 | #define fRTUSB_BULK_OUT_DATA_NORMAL_2 0x00020000 49 | #define fRTUSB_BULK_OUT_DATA_NORMAL_3 0x00040000 50 | #define fRTUSB_BULK_OUT_DATA_NORMAL_4 0x00080000 51 | 52 | /* TODO:move to ./ate/include/iface/ate_usb.h */ 53 | #ifdef RALINK_ATE 54 | #define fRTUSB_BULK_OUT_DATA_ATE 0x00100000 55 | #endif /* RALINK_ATE */ 56 | 57 | 58 | #define FREE_HTTX_RING(_pCookie, _pipeId, _txContext) \ 59 | { \ 60 | if ((_txContext)->ENextBulkOutPosition == (_txContext)->CurWritePosition) \ 61 | { \ 62 | (_txContext)->bRingEmpty = TRUE; \ 63 | } \ 64 | /*NdisInterlockedDecrement(&(_p)->TxCount); */\ 65 | } 66 | 67 | #define NT_SUCCESS(status) (((status) >=0) ? (TRUE):(FALSE)) 68 | 69 | 70 | 71 | 72 | #define PIRP PVOID 73 | /*#define NDIS_OID UINT */ 74 | #ifndef USB_ST_NOERROR 75 | #define USB_ST_NOERROR 0 76 | #endif 77 | 78 | 79 | /* vendor-specific control operations */ 80 | #define CONTROL_TIMEOUT_JIFFIES ( (300 * OS_HZ) / 1000) 81 | /*#define UNLINK_TIMEOUT_MS 3 // os abl move */ 82 | 83 | 84 | #define DEVICE_VENDOR_REQUEST_OUT 0x40 85 | #define DEVICE_VENDOR_REQUEST_IN 0xc0 86 | /*#define INTERFACE_VENDOR_REQUEST_OUT 0x41 */ 87 | /*#define INTERFACE_VENDOR_REQUEST_IN 0xc1 */ 88 | #define BULKOUT_MGMT_RESET_FLAG 0x80 89 | 90 | #define RTUSB_SET_BULK_FLAG(_M, _F) ((_M)->BulkFlags |= (_F)) 91 | #define RTUSB_CLEAR_BULK_FLAG(_M, _F) ((_M)->BulkFlags &= ~(_F)) 92 | #define RTUSB_TEST_BULK_FLAG(_M, _F) (((_M)->BulkFlags & (_F)) != 0) 93 | 94 | #endif /* __RTMP_USB_H__ */ 95 | -------------------------------------------------------------------------------- /include/crypt_sha2.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * Taiwan, R.O.C. 4 | * 5 | * (c) Copyright 2002, Ralink Technology, Inc. 6 | * 7 | * All rights reserved. Ralink's source code is an unpublished work and the 8 | * use of a copyright notice does not imply otherwise. This source code 9 | * contains confidential trade secret material of Ralink Tech. Any attemp 10 | * or participation in deciphering, decoding, reverse engineering or in any 11 | * way altering the source code is stricitly prohibited, unless the prior 12 | * written consent of Ralink Technology, Inc. is obtained. 13 | ***************************************************************************/ 14 | 15 | /**************************************************************************** 16 | Module Name: 17 | SHA2 18 | 19 | Abstract: 20 | FIPS 180-2: Secure Hash Standard (SHS) 21 | 22 | Revision History: 23 | Who When What 24 | -------- ---------- ------------------------------------------ 25 | Eddy 2008/11/24 Create SHA1 26 | Eddy 2008/07/23 Create SHA256 27 | ***************************************************************************/ 28 | 29 | #ifndef __CRYPT_SHA2_H__ 30 | #define __CRYPT_SHA2_H__ 31 | 32 | 33 | /* Algorithm options */ 34 | #define SHA1_SUPPORT 35 | #define SHA256_SUPPORT 36 | 37 | #ifdef SHA1_SUPPORT 38 | #define SHA1_BLOCK_SIZE 64 /* 512 bits = 64 bytes */ 39 | #define SHA1_DIGEST_SIZE 20 /* 160 bits = 20 bytes */ 40 | typedef struct _SHA1_CTX_STRUC { 41 | UINT32 HashValue[5]; /* 5 = (SHA1_DIGEST_SIZE / 32) */ 42 | UINT64 MessageLen; /* total size */ 43 | UINT8 Block[SHA1_BLOCK_SIZE]; 44 | UINT BlockLen; 45 | } SHA1_CTX_STRUC, *PSHA1_CTX_STRUC; 46 | 47 | VOID RT_SHA1_Init( 48 | IN SHA1_CTX_STRUC * pSHA_CTX); 49 | VOID RT_SHA1_Hash( 50 | IN SHA1_CTX_STRUC * pSHA_CTX); 51 | VOID RT_SHA1_Append( 52 | IN SHA1_CTX_STRUC * pSHA_CTX, 53 | IN const UINT8 Message[], 54 | IN UINT MessageLen); 55 | VOID RT_SHA1_End( 56 | IN SHA1_CTX_STRUC * pSHA_CTX, 57 | OUT UINT8 DigestMessage[]); 58 | VOID RT_SHA1( 59 | IN const UINT8 Message[], 60 | IN UINT MessageLen, 61 | OUT UINT8 DigestMessage[]); 62 | #endif /* SHA1_SUPPORT */ 63 | 64 | #ifdef SHA256_SUPPORT 65 | #define SHA256_BLOCK_SIZE 64 /* 512 bits = 64 bytes */ 66 | #define SHA256_DIGEST_SIZE 32 /* 256 bits = 32 bytes */ 67 | typedef struct _SHA256_CTX_STRUC { 68 | UINT32 HashValue[8]; /* 8 = (SHA256_DIGEST_SIZE / 32) */ 69 | UINT64 MessageLen; /* total size */ 70 | UINT8 Block[SHA256_BLOCK_SIZE]; 71 | UINT BlockLen; 72 | } SHA256_CTX_STRUC, *PSHA256_CTX_STRUC; 73 | 74 | VOID RT_SHA256_Init( 75 | IN SHA256_CTX_STRUC * pSHA_CTX); 76 | VOID RT_SHA256_Hash( 77 | IN SHA256_CTX_STRUC * pSHA_CTX); 78 | VOID RT_SHA256_Append( 79 | IN SHA256_CTX_STRUC * pSHA_CTX, 80 | IN const UINT8 Message[], 81 | IN UINT MessageLen); 82 | VOID RT_SHA256_End( 83 | IN SHA256_CTX_STRUC * pSHA_CTX, 84 | OUT UINT8 DigestMessage[]); 85 | VOID RT_SHA256( 86 | IN const UINT8 Message[], 87 | IN UINT MessageLen, 88 | OUT UINT8 DigestMessage[]); 89 | #endif /* SHA256_SUPPORT */ 90 | 91 | 92 | #endif /* __CRYPT_SHA2_H__ */ 93 | -------------------------------------------------------------------------------- /include/mac_ral/nmac/ral_nmac_rxwi.h: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002-2004, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | ral_nmac_rxwi.h 20 | 21 | Abstract: 22 | Ralink Wireless Chip MAC related definition & structures 23 | 24 | Revision History: 25 | Who When What 26 | -------- ---------- ---------------------------------------------- 27 | */ 28 | 29 | #ifndef __RAL_NMAC_RXWI_H__ 30 | #define __RAL_NMAC_RXWI_H__ 31 | 32 | #include "rtmp_type.h" 33 | 34 | /* 35 | RXWI wireless information format. 36 | */ 37 | #ifdef RT_BIG_ENDIAN 38 | typedef struct GNU_PACKED _RXWI_NMAC{ 39 | /* Word 0 */ 40 | UINT32 eof:1; 41 | UINT32 rsv:1; 42 | UINT32 MPDUtotalByteCnt:14; 43 | UINT32 udf:3; 44 | UINT32 bss_idx:3; 45 | UINT32 key_idx:2; 46 | UINT32 wcid:8; 47 | 48 | /* Word 1 */ 49 | UINT32 phy_mode:3; 50 | UINT32 i_txbf:1; 51 | UINT32 e_txbf:1; 52 | UINT32 stbc:1; 53 | UINT32 sgi:1; 54 | UINT32 bw:2; 55 | UINT32 mcs:7; 56 | UINT32 sn:12; 57 | UINT32 tid:4; 58 | 59 | /* Word 2 */ 60 | UINT8 rssi[4]; 61 | 62 | /* Word 3~6 */ 63 | UINT8 bbp_rxinfo[16]; 64 | } RXWI_NMAC; 65 | #else 66 | typedef struct GNU_PACKED _RXWI_NMAC { 67 | /* Word 0 */ 68 | UINT32 wcid:8; 69 | UINT32 key_idx:2; 70 | UINT32 bss_idx:3; 71 | UINT32 udf:3; 72 | UINT32 MPDUtotalByteCnt:14; 73 | UINT32 rsv:1; 74 | UINT32 eof:1; 75 | 76 | /* Word 1 */ 77 | UINT32 tid:4; 78 | UINT32 sn:12; 79 | UINT32 mcs:7; 80 | UINT32 bw:2; 81 | UINT32 sgi:1; 82 | UINT32 stbc:1; 83 | UINT32 e_txbf:1; 84 | UINT32 i_txbf:1; 85 | UINT32 phy_mode:3; 86 | 87 | /* Word 2 */ 88 | UINT8 rssi[4]; 89 | 90 | /* Word 3~6 */ 91 | UINT8 bbp_rxinfo[16]; 92 | } RXWI_NMAC; 93 | #endif /* RT_BIG_ENDIAN */ 94 | 95 | 96 | #define RxWIMPDUByteCnt RXWI_N.MPDUtotalByteCnt 97 | #define RxWIWirelessCliID RXWI_N.wcid 98 | #define RxWIKeyIndex RXWI_N.key_idx 99 | #define RxWIMCS RXWI_N.mcs 100 | #define RxWIBW RXWI_N.bw 101 | #define RxWIBSSID RXWI_N.bss_idx 102 | #define RxWISGI RXWI_N.sgi 103 | #define RxWIPhyMode RXWI_N.phy_mode 104 | #define RxWISTBC RXWI_N.stbc 105 | #define RxWITID RXWI_N.tid 106 | #define RxWIRSSI0 RXWI_N.rssi[0] 107 | #define RxWIRSSI1 RXWI_N.rssi[1] 108 | #define RxWIRSSI2 RXWI_N.rssi[2] 109 | #define RxWISNR0 RXWI_N.bbp_rxinfo[0] 110 | #define RxWISNR1 RXWI_N.bbp_rxinfo[1] 111 | #define RxWISNR2 RXWI_N.bbp_rxinfo[2] 112 | #define RxWIFOFFSET RXWI_N.bbp_rxinfo[3] 113 | 114 | 115 | 116 | #endif /* __RAL_NMAC_RXWI_H__ */ 117 | 118 | -------------------------------------------------------------------------------- /os/linux/Makefile.6.util: -------------------------------------------------------------------------------- 1 | include $(RT28xx_DIR)/os/linux/config.mk 2 | 3 | #ifdef CONFIG_AP_SUPPORT 4 | ifeq ($(RT28xx_MODE),AP) 5 | MOD_NAME = rtutil$(MODULE)ap 6 | endif 7 | #endif // CONFIG_AP_SUPPORT // 8 | 9 | #ifdef CONFIG_STA_SUPPORT 10 | ifeq ($(RT28xx_MODE), STA) 11 | ifneq ($(findstring 7601,$(CHIPSET)),) 12 | MOD_NAME = mtutil$(MODULE)sta 13 | else 14 | MOD_NAME = rtutil$(MODULE)sta 15 | endif 16 | endif 17 | #endif // CONFIG_STA_SUPPORT // 18 | 19 | #ifdef CONFIG_APSTA_SUPPORT 20 | ifeq ($(RT28xx_MODE), APSTA) 21 | MOD_NAME = rtutil$(MODULE)apsta 22 | endif 23 | #endif // CONFIG_APSTA_SUPPORT // 24 | 25 | obj-m := $(MOD_NAME).o 26 | 27 | #ifdef CONFIG_AP_SUPPORT 28 | ifeq ($(RT28xx_MODE),AP) 29 | $(MOD_NAME)-objs := \ 30 | ../../common/rt_os_util.o\ 31 | ../../os/linux/rt_linux_symb.o\ 32 | ../../os/linux/rt_rbus_pci_util.o\ 33 | ../../os/linux/rt_usb_util.o\ 34 | ../../os/linux/rt_linux.o 35 | 36 | ifeq ($(PLATFORM),BL2348) 37 | $(MOD_NAME)-objs += \ 38 | ../../os/linux/vr_bdlt.o 39 | endif 40 | 41 | ifeq ($(PLATFORM),BLUBB) 42 | $(MOD_NAME)-objs += \ 43 | ../../os/linux/vr_bdlt.o 44 | endif 45 | 46 | ifeq ($(HAS_BGFP_SUPPORT),y) 47 | $(MOD_NAME)-objs += \ 48 | ../../os/linux/br_ftph.o 49 | endif 50 | endif 51 | #endif // CONFIG_AP_SUPPORT // 52 | 53 | 54 | #ifdef CONFIG_STA_SUPPORT 55 | ifeq ($(RT28xx_MODE), STA) 56 | $(MOD_NAME)-objs := \ 57 | ../../common/rt_os_util.o\ 58 | ../../os/linux/rt_linux_symb.o\ 59 | ../../os/linux/rt_rbus_pci_util.o\ 60 | ../../os/linux/rt_usb_util.o\ 61 | ../../os/linux/rt_linux.o 62 | endif 63 | #endif // CONFIG_STA_SUPPORT // 64 | 65 | 66 | #ifdef CONFIG_APSTA_SUPPORT 67 | ifeq ($(RT28xx_MODE), APSTA) 68 | $(MOD_NAME)-objs := \ 69 | ../../common/rt_os_util.o\ 70 | ../../os/linux/rt_linux_symb.o\ 71 | ../../os/linux/rt_rbus_pci_util.o\ 72 | ../../os/linux/rt_usb_util.o\ 73 | ../../os/linux/rt_linux.o 74 | 75 | ifeq ($(PLATFORM),BL2348) 76 | $(MOD_NAME)-objs += \ 77 | ../../os/linux/vr_bdlt.o 78 | endif 79 | 80 | ifeq ($(PLATFORM),BLUBB) 81 | $(MOD_NAME)-objs += \ 82 | ../../os/linux/vr_bdlt.o 83 | endif 84 | 85 | ifeq ($(HAS_BGFP_SUPPORT),y) 86 | $(MOD_NAME)-objs += \ 87 | ../../os/linux/br_ftph.o 88 | endif 89 | endif 90 | #endif // CONFIG_APSTA_SUPPORT // 91 | 92 | clean: 93 | rm -f ../../common/*.o 94 | rm -f ../../common/.*.{cmd,flags,d} 95 | rm -f ../../os/linux/*.{o,ko,mod.{o,c}} 96 | rm -f ../../os/linux/.*.{cmd,flags,d} 97 | rm -fr ../../os/linux/.tmp_versions 98 | rm -f ../../os/linux/Module.symvers 99 | rm -f ../../os/linux/Modules.symvers 100 | rm -f ../../os/linux/Module.markers 101 | rm -f ../../os/linux/modules.order 102 | rm -f ../../chips/*.o 103 | rm -f ../../chips/.*.{cmd,flags,d} 104 | ifeq ($(RT28xx_MODE),AP) 105 | rm -f ../../ap/*.o 106 | rm -f ../../ap/.*.{cmd,flags,d} 107 | else 108 | ifeq ($(RT28xx_MODE),STA) 109 | rm -f ../../sta/*.o 110 | rm -f ../../sta/.*.{cmd,flags,d} 111 | endif 112 | endif 113 | 114 | install: 115 | install -d $(LINUX_SRC_MODULE) 116 | install -m 644 -c $(addsuffix .ko,$(MOD_NAME)) $(LINUX_SRC_MODULE) 117 | /sbin/depmod -a ${shell uname -r} 118 | 119 | uninstall: 120 | rm -rf $(addprefix $(LINUX_SRC_MODULE),$(addsuffix .ko,$(MOD_NAME))) 121 | /sbin/depmod -a ${shell uname -r} 122 | -------------------------------------------------------------------------------- /include/ags.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * Taiwan, R.O.C. 4 | * 5 | * (c) Copyright 2002, Ralink Technology, Inc. 6 | * 7 | * All rights reserved. Ralink's source code is an unpublished work and the 8 | * use of a copyright notice does not imply otherwise. This source code 9 | * contains confidential trade secret material of Ralink Tech. Any attemp 10 | * or participation in deciphering, decoding, reverse engineering or in any 11 | * way altering the source code is stricitly prohibited, unless the prior 12 | * written consent of Ralink Technology, Inc. is obtained. 13 | ***************************************************************************/ 14 | 15 | /**************************************************************************** 16 | 17 | Abstract: 18 | 19 | All AGS (Adaptive Group Switching) Related Structure & Definition 20 | 21 | ***************************************************************************/ 22 | 23 | #ifndef __AGS_H__ 24 | #define __AGS_H__ 25 | 26 | 27 | extern UCHAR AGS1x1HTRateTable[]; 28 | extern UCHAR AGS2x2HTRateTable[]; 29 | extern UCHAR AGS3x3HTRateTable[]; 30 | #ifdef DOT11_VHT_AC 31 | extern UCHAR Ags1x1VhtRateTable[]; 32 | extern UCHAR Ags2x2VhtRateTable[]; 33 | #endif /* DOT11_VHT_AC */ 34 | 35 | #define AGS_TX_QUALITY_WORST_BOUND 8 36 | #define AGS_QUICK_RA_TIME_INTERVAL 50 /* 50ms */ 37 | 38 | /* The size, in bytes, of an AGS entry in the rate switch table */ 39 | #define SIZE_OF_AGS_RATE_TABLE_ENTRY 9 40 | 41 | typedef struct _RTMP_RA_AGS_TB { 42 | UCHAR ItemNo; 43 | 44 | UCHAR STBC:1; 45 | UCHAR ShortGI:1; 46 | UCHAR BW:2; 47 | UCHAR Mode:3; 48 | UCHAR Rsv1:1; 49 | 50 | UCHAR Nss:2; // NSS_XXX (VHT only) 51 | UCHAR rsv2:6; // Reserved 52 | 53 | UCHAR CurrMCS; 54 | UCHAR TrainUp; 55 | UCHAR TrainDown; 56 | UCHAR downMcs; 57 | UCHAR upMcs3; 58 | UCHAR upMcs2; 59 | UCHAR upMcs1; 60 | }RTMP_RA_AGS_TB; 61 | 62 | 63 | /* AGS control */ 64 | typedef struct _AGS_CONTROL { 65 | UCHAR MCSGroup; /* The MCS group under testing */ 66 | UCHAR lastRateIdx; 67 | } AGS_CONTROL,*PAGS_CONTROL; 68 | 69 | 70 | /* The statistics information for AGS */ 71 | typedef struct _AGS_STATISTICS_INFO { 72 | CHAR RSSI; 73 | ULONG TxErrorRatio; 74 | ULONG AccuTxTotalCnt; 75 | ULONG TxTotalCnt; 76 | ULONG TxSuccess; 77 | ULONG TxRetransmit; 78 | ULONG TxFailCount; 79 | } AGS_STATISTICS_INFO, *PAGS_STATISTICS_INFO; 80 | 81 | 82 | /* Support AGS (Adaptive Group Switching) */ 83 | #define SUPPORT_AGS(__pAd) ((__pAd)->rateAlg == RATE_ALG_AGS) 84 | 85 | #ifdef DOT11_VHT_AC 86 | #define AGS_IS_USING(__pAd, __pRateTable) \ 87 | (SUPPORT_AGS(__pAd) && \ 88 | ((__pRateTable == AGS1x1HTRateTable) ||\ 89 | (__pRateTable == AGS2x2HTRateTable) ||\ 90 | (__pRateTable == AGS3x3HTRateTable) ||\ 91 | (__pRateTable == Ags1x1VhtRateTable) ||\ 92 | (__pRateTable == Ags2x2VhtRateTable))) 93 | #else 94 | #define AGS_IS_USING(__pAd, __pRateTable) \ 95 | (SUPPORT_AGS(__pAd) && \ 96 | ((__pRateTable == AGS1x1HTRateTable) || \ 97 | (__pRateTable == AGS2x2HTRateTable) || \ 98 | (__pRateTable == AGS3x3HTRateTable))) 99 | #endif /* DOT11_VHT_AC */ 100 | 101 | #endif /* __AGS_H__ */ 102 | 103 | -------------------------------------------------------------------------------- /ap/ap_ftkd.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * Taiwan, R.O.C. 4 | * 5 | * (c) Copyright 2002, Ralink Technology, Inc. 6 | * 7 | * All rights reserved. Ralink's source code is an unpublished work and the 8 | * use of a copyright notice does not imply otherwise. This source code 9 | * contains confidential trade secret material of Ralink Tech. Any attemp 10 | * or participation in deciphering, decoding, reverse engineering or in any 11 | * way altering the source code is stricitly prohibited, unless the prior 12 | * written consent of Ralink Technology, Inc. is obtained. 13 | ***************************************************************************/ 14 | 15 | /**************************************************************************** 16 | 17 | Abstract: 18 | 19 | All related IEEE802.11r Key Distribution Protocol (FT KDP) body. 20 | 21 | Overview: 22 | 23 | 1. A station associates to us, send out a broadcast ADD-Notify packet. 24 | 25 | ASSOC --> 26 | FT_KDP_EVENT_INFORM(FT_KDP_SIG_FT_ASSOCIATION) --> 27 | FT_KDP_EventInform(FT_KDP_SIG_FT_ASSOCIATION) --> 28 | Notify IAPP daemon, IAPP_RcvHandlerRawDrv(), IAPP_SIG_Process() --> 29 | Send ADD-Notify packet, IAPP_UDP_PacketSend(), IAPP_L2UpdateFrameSend() 30 | 31 | 2. When receiving a ADD-Notify packet, send a unicast SSB packet to 32 | request PMK-R1 key for the station with our R0KH. 33 | 34 | IAPP daemon, IAPP_RcvHandlerUdp() --> 35 | Notify driver, IAPP_MsgProcess() --> 36 | IOCTL, RTMPAPSetInformation() --> 37 | FT_KDP_StationInform() --> 38 | Notify IAPP daemon, FT_KDP_EventInform(FT_KDP_SIG_KEY_REQ_AUTO) --> 39 | Notify IAPP daemon, IAPP_RcvHandlerRawDrv(), IAPP_SIG_Process() --> 40 | Send SSB packet with R0KHID = 0, by using TCP or UDP based on peerIP 41 | 42 | 3. A station reassociates to us, send out a MOVE-Request packet. 43 | 44 | REASSOC --> 45 | FT_KDP_EVENT_INFORM(FT_KDP_SIG_FT_REASSOCIATION) --> 46 | FT_KDP_EventInform(FT_KDP_SIG_FT_REASSOCIATION) --> 47 | Notify IAPP daemon, IAPP_RcvHandlerRawDrv(), IAPP_SIG_Process() --> 48 | Send MOVE-Request packet by using TCP or UDP, IAPP_L2UpdateFrameSend() 49 | 50 | 4. When receiving a MOVE-Request packet, delete the STA MAC entry. 51 | 52 | IAPP daemon, IAPP_RcvHandlerUdp()/ IAPP_RcvHandlerTcp() --> 53 | Notify driver, IAPP_MsgProcess() --> 54 | IOCTL, RTMPAPSetInformation() --> 55 | RT_SET_DEL_MAC_ENTRY --> 56 | Send MOVE-Response packet by using TCP, FT_KDP_MoveFrameSend() 57 | 58 | 5. When receiving a MOVE-Response packet, nothing to do. 59 | 60 | 6. When receiving a SSB packet (i.e. key request), send a unicast SAB 61 | packet to response the key to the R1KH. 62 | 63 | IAPP daemon --> 64 | Notify driver, IAPP_MsgProcess() --> 65 | IOCTL, RTMPAPSetInformation() --> 66 | FT_KDP_IOCTL_KEY_REQ() --> 67 | Notify IAPP daemon, FT_KDP_EventInform(FT_KDP_SIG_KEY_RSP_AUTO) --> 68 | Send SAB packet with my R0KHID, FT_KDP_SecurityBlockSend() by using TCP 69 | 70 | 7. When receiving a SAB packet (i.e. key response), set the PMK-R1 key. 71 | 72 | IAPP daemon --> 73 | Notify driver, IAPP_MsgProcess() --> 74 | IOCTL, RTMPAPSetInformation() --> 75 | FT_KDP_KeyResponseToUs() 76 | 77 | 8. Send a information broadcast to the LAN periodically. 78 | 79 | ***************************************************************************/ 80 | 81 | -------------------------------------------------------------------------------- /include/chip/rt3290.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * 4F, No. 2 Technology 5th Rd. 4 | * Science-based Industrial Park 5 | * Hsin-chu, Taiwan, R.O.C. 6 | * (c) Copyright 2002, Ralink Technology, Inc. 7 | * 8 | * All rights reserved. Ralink's source code is an unpublished work and the 9 | * use of a copyright notice does not imply otherwise. This source code 10 | * contains confidential trade secret material of Ralink Tech. Any attemp 11 | * or participation in deciphering, decoding, reverse engineering or in any 12 | * way altering the source code is stricitly prohibited, unless the prior 13 | * written consent of Ralink Technology, Inc. is obtained. 14 | **************************************************************************** 15 | 16 | Module Name: 17 | rt3290.h 18 | 19 | Abstract: 20 | 21 | Revision History: 22 | Who When What 23 | --------- ---------- ---------------------------------------------- 24 | */ 25 | 26 | #ifndef __RT3290_H__ 27 | #define __RT3290_H__ 28 | 29 | #ifdef RT3290 30 | 31 | #error "For RT3290, you should define the compile flag -DRTMP_PCI_SUPPORT" 32 | 33 | #error "For RT3290, you should define the compile flag -DRTMP_MAC_PCI" 34 | 35 | #error "For RT3290, you should define the compile flag -DRTMP_RF_RW_SUPPORT" 36 | 37 | #error "For RT3290, you should define the compile flag -DRT30xx" 38 | 39 | #include "chip/mac_pci.h" 40 | #include "chip/rt30xx.h" 41 | 42 | struct _RTMP_ADAPTER; 43 | 44 | 45 | #define NIC3290_PCIe_DEVICE_ID 0x3290 46 | 47 | 48 | #define RT3290_CHECK_SW_EEP_BUSY(pAd) \ 49 | { \ 50 | UINT32 _val, _cnt = 0; \ 51 | do { \ 52 | RTMP_IO_FORCE_READ32(pAd, WLAN_FUN_INFO, &_val); \ 53 | if ((_val & 0x80000000) == 0 || (_val == 0xffffffff)) \ 54 | break; \ 55 | _cnt++; \ 56 | DBGPRINT_ERR(("RT3290: EEP is busy!!!! BusyCnt%d : fail\n", _cnt)); \ 57 | RTMPusecDelay(500); \ 58 | } while (_cnt<300); \ 59 | } \ 60 | 61 | #define RT3290_CURRENT_LEAKAGE(_pAd,_A,_e) \ 62 | { \ 63 | if (IS_RT3290(_pAd)) \ 64 | { \ 65 | UINT32 btFunInfo, _val = 0; \ 66 | RTMP_IO_FORCE_READ32(_pAd, _A, &_val); \ 67 | if (_e) \ 68 | _val &= ~(EESK|EEDI); \ 69 | else \ 70 | { \ 71 | _val &= ~(EESK); \ 72 | _val |= EEDI; \ 73 | } \ 74 | RT3290_CHECK_SW_EEP_BUSY(_pAd); \ 75 | RTMP_IO_FORCE_READ32(_pAd, BT_FUN_INFO, &btFunInfo); \ 76 | btFunInfo |= 0x80000000; \ 77 | RTMP_IO_FORCE_WRITE32(_pAd, BT_FUN_INFO, btFunInfo); \ 78 | \ 79 | RTMP_IO_FORCE_WRITE32(_pAd, _A, _V); \ 80 | \ 81 | btFunInfo &= ~(0x80000000); \ 82 | RTMP_IO_FORCE_WRITE32(_pAd, BT_FUN_INFO, btFunInfo); \ 83 | } \ 84 | } 85 | 86 | 87 | VOID MlmeAntSelection( 88 | IN struct _RTMP_ADAPTER *pAd, 89 | IN ULONG AccuTxTotalCnt, 90 | IN ULONG TxErrorRatio, 91 | IN ULONG TxSuccess, 92 | IN CHAR Rssi); 93 | 94 | INT RT3290_eeprom_access_grant( 95 | IN struct _RTMP_ADAPTER *pAd, 96 | IN BOOLEAN bGetCtrl); 97 | 98 | VOID RTMP_MAC_PWRSV_EN( 99 | IN struct _RTMP_ADAPTER *pAd, 100 | IN BOOLEAN EnterIdle, 101 | IN BOOLEAN use40M); 102 | 103 | VOID RTMPEnableWlan( 104 | IN struct _RTMP_ADAPTER *pAd, 105 | IN BOOLEAN bOn, 106 | IN BOOLEAN bResetWLAN); 107 | 108 | VOID RT3290_Init( 109 | IN struct _RTMP_ADAPTER *pAd); 110 | 111 | #endif /* RT3290 */ 112 | 113 | #endif /* __RT5390_H__ */ 114 | 115 | -------------------------------------------------------------------------------- /include/dot11r_ft.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * 4F, No. 2 Technology 5th Rd. 4 | * Science-based Industrial Park 5 | * Hsin-chu, Taiwan, R.O.C. 6 | * (c) Copyright 2002, Ralink Technology, Inc. 7 | * 8 | * All rights reserved. Ralink's source code is an unpublished work and the 9 | * use of a copyright notice does not imply otherwise. This source code 10 | * contains confidential trade secret material of Ralink Tech. Any attemp 11 | * or participation in deciphering, decoding, reverse engineering or in any 12 | * way altering the source code is stricitly prohibited, unless the prior 13 | * written consent of Ralink Technology, Inc. is obtained. 14 | **************************************************************************** 15 | 16 | Module Name: 17 | dot11r_ft.h 18 | 19 | Abstract: 20 | Defined status code, IE and frame structures that FT (802.11rD9.0) needed. 21 | 22 | Revision History: 23 | Who When What 24 | --------- ---------- ---------------------------------------------- 25 | Fonchi Wu 12-02-2008 created for 11r soft-AP 26 | */ 27 | 28 | 29 | #ifndef __DOT11R_FT_H 30 | #define __DOT11R_FT_H 31 | 32 | #include "rtmp_type.h" 33 | 34 | 35 | 36 | #if defined(DOT11R_FT_SUPPORT) || defined(DOT11Z_TDLS_SUPPORT) 37 | #define FT_MIC_LEN 16 38 | #define FT_NONCE_LEN 32 39 | #endif 40 | 41 | 42 | #if defined(DOT11R_FT_SUPPORT) || defined(DOT11Z_TDLS_SUPPORT) 43 | /* Information element ID defined in 802.11rD9.0 specification. */ 44 | #define IE_FT_MDIE 54 45 | #define IE_FT_FTIE 55 46 | #define IE_FT_TIMEOUT_INTERVAL 56 47 | #define IE_FT_RIC_DATA 57 48 | #define IE_FT_RIC_DESCRIPTOR 75 49 | 50 | 51 | /* RIC Type */ 52 | #define FT_RIC_TYPE_BA 1 53 | 54 | /* AKM SUITE */ 55 | #define FT_AKM_SUITE_1X 3 56 | #define FT_AKM_SUITE_PSK 4 57 | #endif 58 | 59 | 60 | #if defined(DOT11R_FT_SUPPORT) || defined(DOT11Z_TDLS_SUPPORT) 61 | typedef union GNU_PACKED _FT_MIC_CTR_FIELD 62 | { 63 | /* 64 | IECnt: contains the number of IEs 65 | that are included int eht MIC calculation. 66 | */ 67 | struct GNU_PACKED 68 | { 69 | #ifdef RT_BIG_ENDIAN 70 | UINT16 IECnt:8; 71 | UINT16 :8; 72 | #else 73 | UINT16 :8; 74 | UINT16 IECnt:8; 75 | #endif 76 | } field; 77 | UINT16 word; 78 | } FT_MIC_CTR_FIELD, *PFT_MIC_CTR_FIELD; 79 | 80 | /* 81 | ** FTIE: Fast Transition IE. 82 | */ 83 | typedef struct GNU_PACKED _FT_FTIE 84 | { 85 | FT_MIC_CTR_FIELD MICCtr; /* 2 Octects. */ 86 | UINT8 MIC[FT_MIC_LEN]; /* 16 Octects. */ 87 | UINT8 ANonce[FT_NONCE_LEN]; /* 32 Octects. */ 88 | UINT8 SNonce[FT_NONCE_LEN]; /* 32 Octects. */ 89 | UINT8 Option[0]; /* 1:R1KHID, 2:GTK, 3:ROKHId, else:Res */ 90 | } FT_FTIE, *PFT_FTIE; 91 | #endif 92 | 93 | 94 | #if defined(DOT11R_FT_SUPPORT) || defined(DOT11Z_TDLS_SUPPORT) 95 | /* 96 | ** Timeout Interval IE. 97 | */ 98 | typedef enum _FT_TIMEOUT_INTERVAL_TYPE 99 | { 100 | REASSOC_DEADLINE_INTERVAL = 1, /* TUs */ 101 | KEY_LIFETIME_INTERVAL, /* seconds. */ 102 | RESERVED_INTERVAL 103 | } FT_TIMEOUT_INTERVAL_TYPE, *PFT_TIMEOUT_INTERVAL_TYPE; 104 | 105 | typedef struct GNU_PACKED _FT_TIMEOUT_INTERVAL_IE 106 | { 107 | UINT8 TimeoutIntervalType; 108 | UINT32 TimeoutIntervalValue; 109 | } FT_TIMEOUT_INTERVAL_IE, *PFT_TIMEOUT_INTERVAL_IE; 110 | #endif 111 | 112 | 113 | #endif /* __DOT11R_FT_H */ 114 | 115 | -------------------------------------------------------------------------------- /elian/os/linux/osal.c: -------------------------------------------------------------------------------- 1 | 2 | #include "osal.h" 3 | 4 | inline void* osal_memset(void *buf, int i, unsigned int len) 5 | { 6 | return memset(buf, i, len); 7 | } 8 | 9 | inline void* osal_memcpy(void *dst, const void *src, unsigned int len) 10 | { 11 | return memcpy(dst, src, len); 12 | } 13 | 14 | inline int osal_memcmp(const void *buf1, const void *buf2, unsigned int len) 15 | { 16 | return memcmp(buf1, buf2, len); 17 | } 18 | 19 | inline int osal_timer_create(p_osal_timer ptimer) 20 | { 21 | struct timer_list *timer = &ptimer->timer; 22 | init_timer(timer); 23 | timer->function = ptimer->timeoutHandler; 24 | timer->data = (unsigned long)ptimer->data; 25 | return 0; 26 | } 27 | 28 | inline int osal_timer_start(p_osal_timer ptimer, unsigned ms) 29 | { 30 | struct timer_list *timer = &ptimer->timer; 31 | timer->expires = jiffies + (ms/(1000/HZ)); 32 | add_timer(timer); 33 | return 0; 34 | } 35 | 36 | inline int osal_timer_stop(p_osal_timer ptimer) 37 | { 38 | struct timer_list *timer = &ptimer->timer; 39 | del_timer(timer); 40 | return 0; 41 | } 42 | 43 | inline int osal_timer_modify(p_osal_timer ptimer, unsigned int ms) 44 | { 45 | 46 | mod_timer(&ptimer->timer, jiffies + (ms)/(1000/HZ)); 47 | return 0; 48 | } 49 | 50 | inline int osal_thread_create(p_osal_thread thread) 51 | { 52 | thread->thread = kthread_create(thread->thread_func, 53 | thread->data, 54 | thread->name); 55 | if (NULL == thread->thread) { 56 | return -1; 57 | } 58 | return 0; 59 | } 60 | 61 | inline int osal_thread_run (p_osal_thread thread) 62 | { 63 | if (thread->thread) { 64 | wake_up_process(thread->thread); 65 | return 0; 66 | } 67 | else { 68 | return -1; 69 | } 70 | } 71 | inline int osal_thread_stop (p_osal_thread thread) 72 | { 73 | int ret; 74 | if ( (thread) && (thread->thread) ) { 75 | ret = kthread_stop(thread->thread); 76 | return ret; 77 | } 78 | return -1; 79 | } 80 | 81 | 82 | inline int osal_thread_should_stop (p_osal_thread thread) 83 | { 84 | if ( (thread) && (thread->thread) ) { 85 | return kthread_should_stop(); 86 | } 87 | else { 88 | return 1; 89 | } 90 | } 91 | 92 | inline int osal_msleep(unsigned int ms) 93 | { 94 | msleep(ms); 95 | return 0; 96 | } 97 | 98 | inline unsigned int osal_strlen(const char *str) 99 | { 100 | return strlen(str); 101 | } 102 | 103 | inline int osal_strcmp(const char *dst, const char *src) 104 | { 105 | return strcmp(dst, src); 106 | } 107 | 108 | inline int osal_strncmp(const char *dst, const char *src, unsigned int len) 109 | { 110 | return strncmp(dst, src, len); 111 | } 112 | 113 | inline char * osal_strcpy(char *dst, const char *src) 114 | { 115 | return strcpy(dst, src); 116 | } 117 | inline long int osal_strtol(const char *str, char **c, int adecimal) 118 | { 119 | return simple_strtol(str, c, adecimal); 120 | } 121 | inline char *osal_strstr(const char *haystack, const char *needle) 122 | { 123 | return strstr(haystack, needle); 124 | } 125 | inline int osal_lock_init(spinlock_t *l) 126 | { 127 | //TODO:lock implenment depend on requirment. 128 | //spin_lock_init(l); 129 | return 0; 130 | } 131 | inline int osal_lock(spinlock_t *l) 132 | { 133 | //TODO:lock implenment depend on requirment. 134 | //spin_lock(l); 135 | return 0; 136 | } 137 | inline int osal_unlock(spinlock_t *l) 138 | { 139 | //TODO:lock implenment depend on requirment. 140 | //spin_unlock(l); 141 | return 0; 142 | } 143 | 144 | -------------------------------------------------------------------------------- /include/mac_ral/omac/ral_omac_pbf.h: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002-2004, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | ral_omac_pbf.h 20 | 21 | Abstract: 22 | Ralink Wireless Chip MAC related definition & structures 23 | 24 | Revision History: 25 | Who When What 26 | -------- ---------- ---------------------------------------------- 27 | */ 28 | 29 | #ifndef __RAL_OMAC_PBF_H__ 30 | #define __RAL_OMAC_PBF_H__ 31 | 32 | 33 | #include "rtmp_type.h" 34 | 35 | /* ================================================================================= */ 36 | /* Register format for PBF */ 37 | /* ================================================================================= */ 38 | 39 | 40 | /* Most are for debug. Driver doesn't touch PBF register. */ 41 | #define PBF_SYS_CTRL 0x0400 42 | 43 | #ifdef RT_BIG_ENDIAN 44 | typedef union _PBF_SYS_CTRL_STRUC { 45 | struct { 46 | UINT32 Reserved5:12; /* Reserved */ 47 | UINT32 SHR_MSEL:1; /* Shared memory access selection */ 48 | UINT32 PBF_MSEL:2; /* Packet buffer memory access selection */ 49 | UINT32 HST_PM_SEL:1; /* The write selection of the host program RAM */ 50 | UINT32 Reserved4:1; /* Reserved */ 51 | UINT32 CAP_MODE:1; /* Packet buffer capture mode */ 52 | UINT32 Reserved3:1; /* Reserved */ 53 | UINT32 CLK_SEL:1; /* MAC/PBF clock source selection */ 54 | UINT32 PBF_CLK_EN:1; /* PBF clock enable */ 55 | UINT32 MAC_CLK_EN:1; /* MAC clock enable */ 56 | UINT32 DMA_CLK_EN:1; /* DMA clock enable */ 57 | UINT32 Reserved2:1; /* Reserved */ 58 | UINT32 MCU_READY:1; /* MCU ready */ 59 | UINT32 Reserved1:2; /* Reserved */ 60 | UINT32 ASY_RESET:1; /* ASYNC interface reset */ 61 | UINT32 PBF_RESET:1; /* PBF hardware reset */ 62 | UINT32 MAC_RESET:1; /* MAC hardware reset */ 63 | UINT32 DMA_RESET:1; /* DMA hardware reset */ 64 | UINT32 MCU_RESET:1; /* MCU hardware reset */ 65 | } field; 66 | UINT32 word; 67 | } PBF_SYS_CTRL_STRUC; 68 | #else 69 | typedef union _PBF_SYS_CTRL_STRUC { 70 | struct { 71 | UINT32 MCU_RESET:1; 72 | UINT32 DMA_RESET:1; 73 | UINT32 MAC_RESET:1; 74 | UINT32 PBF_RESET:1; 75 | UINT32 ASY_RESET:1; 76 | UINT32 Reserved1:2; 77 | UINT32 MCU_READY:1; 78 | UINT32 Reserved2:1; 79 | UINT32 DMA_CLK_EN:1; 80 | UINT32 MAC_CLK_EN:1; 81 | UINT32 PBF_CLK_EN:1; 82 | UINT32 CLK_SEL:1; 83 | UINT32 Reserved3:1; 84 | UINT32 CAP_MODE:1; 85 | UINT32 Reserved4:1; 86 | UINT32 HST_PM_SEL:1; 87 | UINT32 PBF_MSEL:2; 88 | UINT32 SHR_MSEL:1; 89 | UINT32 Reserved5:12; 90 | }field; 91 | UINT32 word; 92 | } PBF_SYS_CTRL_STRUC; 93 | #endif 94 | 95 | 96 | #define PBF_CFG 0x0408 97 | #define PBF_MAX_PCNT 0x040C 98 | #define PBF_CAP_CTRL 0x0440 99 | 100 | #define BCN_OFFSET0 0x042C 101 | #define BCN_OFFSET1 0x0430 102 | 103 | #endif /* __RAL_OMAC_PBF_H__ */ 104 | 105 | -------------------------------------------------------------------------------- /elian/lib/plat_mt7601.c: -------------------------------------------------------------------------------- 1 | 2 | #include "plat.h" 3 | #include "../os/linux/osal.h" 4 | 5 | #include "rtmp_comm.h" 6 | #include "rt_os_util.h" 7 | #include "rt_os_net.h" 8 | #include "rt_config.h" 9 | static unsigned int g_iftype = 0; 10 | static struct timer_list rst_timer; 11 | 12 | int sc_plt_set_monitor_chan(struct chan_info *info, void *priv) 13 | { 14 | CFG80211_CB *p80211CB = NULL; 15 | CMD_RTPRIV_IOCTL_80211_CHAN ChanInfo; 16 | PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)priv; 17 | 18 | MSC_DBG("[MSC] set chl, chan_id:%d, width:%d, chan_flags:0x%x\n", 19 | info->chan_id, info->width, info->flags ); 20 | 21 | memset(&ChanInfo, 0, sizeof(ChanInfo)); 22 | ChanInfo.ChanId = info->chan_id; 23 | 24 | RTMP_DRIVER_80211_CB_GET(pAd, &p80211CB); 25 | if (p80211CB == NULL) { 26 | return -1; 27 | } 28 | 29 | ChanInfo.MonFilterFlag = 0x17f93;//0x17f93 is a RX filter 30 | ChanInfo.IfType = RT_CMD_80211_IFTYPE_MONITOR; 31 | 32 | if(info->width == MSC_CHAN_WIDTH_20_NOHT) { 33 | ChanInfo.ChanType = RT_CMD_80211_CHANTYPE_NOHT; 34 | } else if (info->width == MSC_CHAN_WIDTH_20) { 35 | ChanInfo.ChanType = RT_CMD_80211_CHANTYPE_HT20; 36 | } else if (info->width == MSC_CHAN_WIDTH_40_PLUS) { 37 | ChanInfo.ChanType = RT_CMD_80211_CHANTYPE_HT40PLUS; 38 | } else if (info->width == MSC_CHAN_WIDTH_40_MINUS) { 39 | ChanInfo.ChanType = RT_CMD_80211_CHANTYPE_HT40MINUS; 40 | } else { 41 | ChanInfo.ChanType = RT_CMD_80211_CHANTYPE_NOHT; 42 | } 43 | 44 | /* set channel */ 45 | RTMP_DRIVER_80211_CHAN_SET(pAd, &ChanInfo); 46 | //PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)priv; 47 | //AsicSwitchChannel(pAd, info->chan_id, FALSE); 48 | 49 | return 0; 50 | } 51 | 52 | int sc_plt_enter_monitor_mode(struct monitor_info *info, void *priv) 53 | { 54 | PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)priv; 55 | unsigned int filter = 0; 56 | 57 | MSC_DBG("[MSC] enter monitor mode: filter:0x%x, chan_id:%d, width:%d, chan_flags:0x%x, monitor_priv=%p, priv=%p\n", 58 | info->filter, info->chl_info.chan_id, info->chl_info.width, 59 | info->chl_info.flags, info->priv, priv); 60 | 61 | filter |= 0x07; 62 | 63 | /* 1.Save current state info. */ 64 | g_iftype = pAd->net_dev->ieee80211_ptr->iftype; 65 | MSC_DBG("[MSC] old iftype: 0x%x\n", g_iftype); 66 | 67 | /* 2.Switch to monitor mode. */ 68 | CFG80211DRV_OpsChgVirtualInf(pAd, &filter, RT_CMD_80211_IFTYPE_MONITOR); 69 | 70 | sc_plt_set_monitor_chan(&info->chl_info, priv); 71 | 72 | return 0; 73 | } 74 | 75 | int sc_plt_leave_monitor_mode(void *priv) 76 | { 77 | PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)priv; 78 | unsigned int filter = 0; 79 | 80 | MSC_DBG("[MSC] leave monitor mode.\n"); 81 | CFG80211DRV_OpsChgVirtualInf(pAd, &filter, g_iftype); 82 | return 0; 83 | } 84 | 85 | char *sc_plt_get_la(void *priv) 86 | { 87 | PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)priv; 88 | MSC_DBG("[MSC] get local address %p : %x:%x:%x:%x:%x:%x\n", 89 | priv, pAd->CurrentAddress[0]&0xff, pAd->CurrentAddress[1]&0xff, pAd->CurrentAddress[2]&0xff, 90 | pAd->CurrentAddress[3]&0xff, pAd->CurrentAddress[4]&0xff, pAd->CurrentAddress[5]&0xff); 91 | return (char*)pAd->CurrentAddress; 92 | } 93 | 94 | void sc_plt_aes128_decrypt(unsigned char *cipher_blk, unsigned int cipher_blk_size, 95 | unsigned char *key, unsigned int key_len, 96 | unsigned char *plain_blk, unsigned int *plain_blk_size) 97 | { 98 | return RT_AES_Decrypt(cipher_blk, cipher_blk_size, key, key_len, plain_blk, plain_blk_size); 99 | } 100 | 101 | void sc_plt_add_timer(struct etimer *p) 102 | { 103 | init_timer(&rst_timer); 104 | rst_timer.expires = jiffies + p->expires * HZ; 105 | rst_timer.data = p->data; 106 | rst_timer.function = p->func; 107 | return add_timer(&rst_timer); 108 | } 109 | 110 | int sc_plt_del_timer(struct etimer *p) 111 | { 112 | return del_timer(&rst_timer); 113 | } 114 | 115 | -------------------------------------------------------------------------------- /os/linux/Makefile.4.netif: -------------------------------------------------------------------------------- 1 | include $(RT28xx_DIR)/os/linux/config.mk 2 | 3 | #ifdef CONFIG_AP_SUPPORT 4 | ifeq ($(RT28xx_MODE),AP) 5 | MOD_NAME = rtnet$(MODULE)ap 6 | endif 7 | #endif // CONFIG_AP_SUPPORT // 8 | 9 | #ifdef CONFIG_STA_SUPPORT 10 | ifeq ($(RT28xx_MODE), STA) 11 | MOD_NAME = rtnet$(MODULE)sta 12 | endif 13 | #endif // CONFIG_STA_SUPPORT // 14 | 15 | #ifdef CONFIG_APSTA_SUPPORT 16 | ifeq ($(RT28xx_MODE), APSTA) 17 | MOD_NAME = rtnet$(MODULE)apsta 18 | endif 19 | #endif // CONFIG_APSTA_SUPPORT // 20 | 21 | OBJ := $(MOD_NAME).o 22 | 23 | #ifdef CONFIG_AP_SUPPORT 24 | 25 | RT28XX_AP_OBJ := \ 26 | ../../ap/ap_mbss_inf.o\ 27 | ../../os/linux/ap_ioctl.o\ 28 | ../../os/linux/rt_main_dev.o 29 | 30 | ifeq ($(HAS_WDS),y) 31 | RT28XX_AP_OBJ += \ 32 | ../../ap/ap_wds_inf.o 33 | endif 34 | 35 | ifeq ($(HAS_APCLI),y) 36 | RT28XX_AP_OBJ += \ 37 | ../../ap/ap_apcli_inf.o 38 | endif 39 | 40 | ifeq ($(HAS_MESH_SUPPORT),y) 41 | RT28XX_AP_OBJ += \ 42 | ../../common/mesh_inf.o 43 | endif 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | #endif // CONFIG_AP_SUPPORT // 61 | 62 | #ifdef CONFIG_STA_SUPPORT 63 | RT28XX_STA_OBJ := \ 64 | ../../os/linux/sta_ioctl.o\ 65 | ../../os/linux/rt_main_dev.o 66 | 67 | ifeq ($(HAS_MESH_SUPPORT),y) 68 | RT28XX_STA_OBJ += \ 69 | ../../common/mesh_inf.o 70 | endif 71 | 72 | ifeq ($(HAS_P2P_SUPPORT), y) 73 | RT28XX_STA_OBJ += \ 74 | ../../common/p2p_inf.o\ 75 | ../../os/linux/ap_ioctl.o 76 | endif 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | #endif // CONFIG_STA_SUPPORT // 95 | 96 | #ifdef CONFIG_APSTA_SUPPORT 97 | RT28XX_APSTA_OBJ := \ 98 | ../../ap/ap_mbss_inf.o\ 99 | ../../common/p2p_inf.o\ 100 | ../../os/linux/ap_ioctl.o\ 101 | ../../os/linux/sta_ioctl.o\ 102 | ../../os/linux/rt_main_dev.o 103 | 104 | ifeq ($(HAS_WDS),y) 105 | RT28XX_APSTA_OBJ += \ 106 | ../../ap/ap_wds_inf.o 107 | endif 108 | 109 | ifeq ($(HAS_APCLI),y) 110 | RT28XX_APSTA_OBJ += \ 111 | ../../ap/ap_apcli_inf.o 112 | endif 113 | 114 | ifeq ($(HAS_MESH_SUPPORT),y) 115 | RT28XX_APSTA_OBJ += \ 116 | ../../common/mesh_inf.o 117 | endif 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | #endif // CONFIG_APSTA_SUPPORT // 132 | 133 | PHONY := all clean 134 | 135 | all:$(OBJ) 136 | 137 | rtnet$(MODULE)sta.o: $(RT28XX_STA_OBJ) 138 | $(LD) -r $^ -o $@ 139 | 140 | rtnet$(MODULE)ap.o: $(RT28XX_AP_OBJ) 141 | $(LD) -r $^ -o $@ 142 | 143 | rtnet$(MODULE)apsta.o: $(RT28XX_APSTA_OBJ) 144 | $(LD) -r $^ -o $@ 145 | 146 | clean: 147 | rm -f $(RT28xx_DIR)/common/*.o 148 | rm -f $(RT28xx_DIR)/common/.*.{cmd,flags,d} 149 | rm -f $(RT28xx_DIR)/os/linux/*.{o,ko,mod.{o,c}} 150 | rm -f $(RT28xx_DIR)/os/linux/.*.{cmd,flags,d} 151 | rm -fr $(RT28xx_DIR)/os/linux/.tmp_versions 152 | rm -f $(RT28xx_DIR)/chips/*.o 153 | rm -f $(RT28xx_DIR)/chips/.*.{cmd,flags,d} 154 | ifeq ($(RT28xx_MODE),AP) 155 | rm -f $(RT28xx_DIR)/ap/*.o 156 | rm -f $(RT28xx_DIR)/ap/.*.{cmd,flags,d} 157 | else 158 | ifeq ($(RT28xx_MODE),STA) 159 | rm -f $(RT28xx_DIR)/sta/*.o 160 | rm -f $(RT28xx_DIR)/sta/.*.{cmd,flags,d} 161 | else 162 | ifeq ($(RT28xx_MODE),APSTA) 163 | rm -f $(RT28xx_DIR)/ap/*.o 164 | rm -f $(RT28xx_DIR)/ap/.*.{cmd,flags,d} 165 | rm -f $(RT28xx_DIR)/sta/*.o 166 | rm -f $(RT28xx_DIR)/sta/.*.{cmd,flags,d} 167 | endif 168 | endif 169 | endif 170 | 171 | install: 172 | install -d $(LINUX_SRC_MODULE) 173 | install -m 644 -c $(addsuffix .o,$(MOD_NAME)) $(LINUX_SRC_MODULE) 174 | /sbin/depmod -a ${shell uname -r} 175 | 176 | uninstall: 177 | rm -rf $(addprefix $(LINUX_SRC_MODULE),$(addsuffix .o,$(MOD_NAME))) 178 | /sbin/depmod -a ${shell uname -r} 179 | 180 | # Declare the contents of the .PHONY variable as phony. We keep that 181 | # # information in a variable so we can use it in if_changed and friends. 182 | .PHONY: $(PHONY) 183 | -------------------------------------------------------------------------------- /os/linux/Makefile.6.netif: -------------------------------------------------------------------------------- 1 | include $(RT28xx_DIR)/os/linux/config.mk 2 | 3 | #ifdef CONFIG_AP_SUPPORT 4 | ifeq ($(RT28xx_MODE),AP) 5 | MOD_NAME = rtnet$(MODULE)ap 6 | endif 7 | #endif // CONFIG_AP_SUPPORT // 8 | 9 | #ifdef CONFIG_STA_SUPPORT 10 | ifeq ($(RT28xx_MODE), STA) 11 | ifneq ($(findstring 7601,$(CHIPSET)),) 12 | MOD_NAME = mtnet$(MODULE)sta 13 | else 14 | MOD_NAME = rtnet$(MODULE)sta 15 | endif 16 | endif 17 | #endif // CONFIG_STA_SUPPORT // 18 | 19 | #ifdef CONFIG_APSTA_SUPPORT 20 | ifeq ($(RT28xx_MODE), APSTA) 21 | MOD_NAME = rtnet$(MODULE)apsta 22 | endif 23 | #endif // CONFIG_APSTA_SUPPORT // 24 | 25 | obj-m := $(MOD_NAME).o 26 | 27 | #ifdef CONFIG_AP_SUPPORT 28 | ifeq ($(RT28xx_MODE),AP) 29 | $(MOD_NAME)-objs := \ 30 | ../../ap/ap_mbss_inf.o\ 31 | ../../os/linux/ap_ioctl.o\ 32 | ../../os/linux/rt_main_dev.o 33 | 34 | ifeq ($(HAS_CFG80211_SUPPORT),y) 35 | $(MOD_NAME)-objs += \ 36 | ../../os/linux/cfg80211.o 37 | endif 38 | 39 | ifeq ($(HAS_WDS),y) 40 | $(MOD_NAME)-objs += \ 41 | ../../ap/ap_wds_inf.o 42 | endif 43 | 44 | ifeq ($(HAS_APCLI),y) 45 | $(MOD_NAME)-objs += \ 46 | ../../ap/ap_apcli_inf.o 47 | endif 48 | 49 | ifeq ($(HAS_MESH_SUPPORT),y) 50 | $(MOD_NAME)-objs += \ 51 | ../../common/mesh_inf.o 52 | endif 53 | 54 | endif 55 | #endif // CONFIG_AP_SUPPORT // 56 | 57 | #ifdef CONFIG_STA_SUPPORT 58 | ifeq ($(RT28xx_MODE), STA) 59 | $(MOD_NAME)-objs := \ 60 | ../../os/linux/sta_ioctl.o\ 61 | ../../os/linux/rt_main_dev.o 62 | 63 | ifeq ($(HAS_CFG80211_SUPPORT),y) 64 | $(MOD_NAME)-objs += \ 65 | ../../os/linux/cfg80211.o 66 | endif 67 | 68 | ifeq ($(HAS_MESH_SUPPORT),y) 69 | $(MOD_NAME)-objs += \ 70 | ../../common/mesh_inf.o 71 | endif 72 | 73 | ifeq ($(HAS_P2P_SUPPORT), y) 74 | $(MOD_NAME)-objs += \ 75 | ../../common/p2p_inf.o\ 76 | ../../os/linux/ap_ioctl.o 77 | endif 78 | 79 | endif 80 | #endif // CONFIG_STA_SUPPORT // 81 | 82 | #ifdef CONFIG_APSTA_SUPPORT 83 | ifeq ($(RT28xx_MODE), APSTA) 84 | $(MOD_NAME)-objs := \ 85 | ../../ap/ap_mbss_inf.o\ 86 | ../../common/p2p_inf.o\ 87 | ../../os/linux/ap_ioctl.o\ 88 | ../../os/linux/sta_ioctl.o\ 89 | ../../os/linux/rt_main_dev.o 90 | 91 | ifeq ($(HAS_CFG80211_SUPPORT),y) 92 | $(MOD_NAME)-objs += \ 93 | ../../os/linux/cfg80211.o 94 | endif 95 | 96 | ifeq ($(HAS_WDS),y) 97 | $(MOD_NAME)-objs += \ 98 | ../../ap/ap_wds_inf.o 99 | endif 100 | 101 | ifeq ($(HAS_APCLI),y) 102 | $(MOD_NAME)-objs += \ 103 | ../../ap/ap_apcli_inf.o 104 | endif 105 | 106 | ifeq ($(HAS_MESH_SUPPORT),y) 107 | $(MOD_NAME)-objs += \ 108 | ../../common/mesh_inf.o 109 | endif 110 | 111 | 112 | endif 113 | #endif // CONFIG_APSTA_SUPPORT // 114 | 115 | #chip related 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | #ifdef MT7601 133 | ifneq ($(findstring 7601,$(CHIPSET)),) 134 | $(MOD_NAME)-objs += \ 135 | ../../common/rtusb_dev_id.o\ 136 | ../../os/linux/usb_main_dev.o 137 | endif 138 | #endif // MT7601 // 139 | 140 | clean: 141 | rm -f ../../common/*.o 142 | rm -f ../../common/.*.{cmd,flags,d} 143 | rm -f ../../os/linux/*.{o,ko,mod.{o,c}} 144 | rm -f ../../os/linux/.*.{cmd,flags,d} 145 | rm -fr ../../os/linux/.tmp_versions 146 | rm -f ../../os/linux/Module.symvers 147 | rm -f ../../os/linux/Modules.symvers 148 | rm -f ../../os/linux/Module.markers 149 | rm -f ../../os/linux/modules.order 150 | rm -f ../../chips/*.o 151 | rm -f ../../chips/.*.{cmd,flags,d} 152 | ifeq ($(RT28xx_MODE),AP) 153 | rm -f ../../ap/*.o 154 | rm -f ../../ap/.*.{cmd,flags,d} 155 | else 156 | ifeq ($(RT28xx_MODE),STA) 157 | rm -f ../../sta/*.o 158 | rm -f ../../sta/.*.{cmd,flags,d} 159 | endif 160 | endif 161 | 162 | install: 163 | install -d $(LINUX_SRC_MODULE) 164 | install -m 644 -c $(addsuffix .ko,$(MOD_NAME)) $(LINUX_SRC_MODULE) 165 | /sbin/depmod -a ${shell uname -r} 166 | 167 | uninstall: 168 | rm -rf $(addprefix $(LINUX_SRC_MODULE),$(addsuffix .ko,$(MOD_NAME))) 169 | /sbin/depmod -a ${shell uname -r} 170 | -------------------------------------------------------------------------------- /include/frq_cal.h: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002-2004, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | eeprom.h 20 | 21 | Abstract: 22 | Miniport header file for eeprom related information 23 | 24 | Revision History: 25 | Who When What 26 | -------- ---------- ---------------------------------------------- 27 | */ 28 | #ifndef __FRQCAL_H__ 29 | #define __FRQCAL_H__ 30 | 31 | /* */ 32 | /* The frequency calibration control */ 33 | /* */ 34 | typedef struct _FREQUENCY_CALIBRATION_CONTROL 35 | { 36 | BOOLEAN bEnableFrequencyCalibration; /* Enable the frequency calibration algorithm */ 37 | 38 | BOOLEAN bSkipFirstFrequencyCalibration; /* Avoid calibrating frequency at the time the STA is just link-up */ 39 | BOOLEAN bApproachFrequency; /* Approach the frequency */ 40 | UCHAR AdaptiveFreqOffset; /* Adaptive frequency offset */ 41 | CHAR LatestFreqOffsetOverBeacon; /* Latest frequency offset from the beacon */ 42 | CHAR BeaconPhyMode; /* Latest frequency offset from the beacon */ 43 | 44 | } FREQUENCY_CALIBRATION_CONTROL, *PFREQUENCY_CALIBRATION_CONTROL; 45 | 46 | #define RTMP_FREQ_CAL_DISABLE(__pAd) \ 47 | __pAd->FreqCalibrationCtrl.bEnableFrequencyCalibration = FALSE; 48 | 49 | /* */ 50 | /* Invalid frequency offset */ 51 | /* */ 52 | #define INVALID_FREQUENCY_OFFSET -128 53 | 54 | /* */ 55 | /* The upperbound/lowerbound of the frequency offset */ 56 | /* */ 57 | #define UPPERBOUND_OF_FREQUENCY_OFFSET 127 58 | #define LOWERBOUND_OF_FREQUENCY_OFFSET -127 59 | 60 | 61 | /*#ifdef RT5390 */ 62 | /* */ 63 | /* The trigger point of the high/low frequency */ 64 | /* */ 65 | #define HIGH_FREQUENCY_TRIGGER_POINT_OFDM 20 66 | #define LOW_FREQUENCY_TRIGGER_POINT_OFDM -20 67 | #define HIGH_FREQUENCY_TRIGGER_POINT_CCK 4 68 | #define LOW_FREQUENCY_TRIGGER_POINT_CCK -4 69 | 70 | #ifdef MT7601 71 | #define MT7601_HIGH_FREQUENCY_TRIGGER_POINT_CCK 19 72 | #define MT7601_LOW_FREQUENCY_TRIGGER_POINT_CCK -19 73 | #define MT7601_DECREASE_FREQUENCY_OFFSET_CCK 5 74 | #define MT7601_INCREASE_FREQUENCY_OFFSET_CCK -5 75 | 76 | #define MT7601_HIGH_FREQUENCY_TRIGGER_POINT_OFDM20 102 77 | #define MT7601_LOW_FREQUENCY_TRIGGER_POINT_OFDM20 -102 78 | #define MT7601_DECREASE_FREQUENCY_OFFSET_OFDM20 32 79 | #define MT7601_INCREASE_FREQUENCY_OFFSET_OFDM20 -32 80 | 81 | #define MT7601_HIGH_FREQUENCY_TRIGGER_POINT_OFDM40 82 82 | #define MT7601_LOW_FREQUENCY_TRIGGER_POINT_OFDM40 -82 83 | #define MT7601_DECREASE_FREQUENCY_OFFSET_OFDM40 20 84 | #define MT7601_INCREASE_FREQUENCY_OFFSET_OFDM40 -20 85 | #endif /* MT7601 */ 86 | 87 | /* */ 88 | /* The trigger point of decreasng/increasing the frequency offset */ 89 | /* */ 90 | #define DECREASE_FREQUENCY_OFFSET_OFDM 10 91 | #define INCREASE_FREQUENCY_OFFSET_OFDM -10 92 | #define DECREASE_FREQUENCY_OFFSET_CCK 2 93 | #define INCREASE_FREQUENCY_OFFSET_CCK -2 94 | /*#endif // RT5390 */ 95 | /* */ 96 | /* The trigger point of decreasng/increasing the frequency offset */ 97 | /* */ 98 | #define DECREASE_FREQUENCY_OFFSET 3 99 | #define INCREASE_FREQUENCY_OFFSET -3 100 | 101 | /* */ 102 | /* Frequency calibration period */ 103 | /* */ 104 | 105 | #define FREQUENCY_CALIBRATION_PERIOD 100 106 | 107 | #endif /* __FRQCAL_H__ */ 108 | -------------------------------------------------------------------------------- /common/netif_block.c: -------------------------------------------------------------------------------- 1 | #ifdef BLOCK_NET_IF 2 | 3 | #include "rt_config.h" 4 | #include "netif_block.h" 5 | 6 | static NETIF_ENTRY freeNetIfEntryPool[FREE_NETIF_POOL_SIZE]; 7 | static LIST_HEADER freeNetIfEntryList; 8 | 9 | void initblockQueueTab( 10 | IN PRTMP_ADAPTER pAd) 11 | { 12 | int i; 13 | 14 | initList(&freeNetIfEntryList); 15 | for (i = 0; i < FREE_NETIF_POOL_SIZE; i++) 16 | insertTailList(&freeNetIfEntryList, (PLIST_ENTRY)&freeNetIfEntryPool[i]); 17 | 18 | for (i=0; i < NUM_OF_TX_RING; i++) 19 | initList(&pAd->blockQueueTab[i].NetIfList); 20 | 21 | return; 22 | } 23 | 24 | BOOLEAN blockNetIf( 25 | IN PBLOCK_QUEUE_ENTRY pBlockQueueEntry, 26 | IN PNET_DEV pNetDev) 27 | { 28 | PNETIF_ENTRY pNetIfEntry = NULL; 29 | 30 | if ((pNetIfEntry = (PNETIF_ENTRY)removeHeadList(&freeNetIfEntryList)) != NULL) 31 | { 32 | RTMP_OS_NETDEV_STOP_QUEUE(pNetDev); 33 | pNetIfEntry->pNetDev = pNetDev; 34 | insertTailList(&pBlockQueueEntry->NetIfList, (PLIST_ENTRY)pNetIfEntry); 35 | 36 | pBlockQueueEntry->SwTxQueueBlockFlag = TRUE; 37 | DBGPRINT(RT_DEBUG_TRACE, ("RTMP_OS_NETDEV_STOP_QUEUE(%s)\n", RTMP_OS_NETDEV_GET_DEVNAME(pNetDev))); 38 | } 39 | else 40 | return FALSE; 41 | 42 | return TRUE; 43 | } 44 | 45 | VOID releaseNetIf( 46 | IN PBLOCK_QUEUE_ENTRY pBlockQueueEntry) 47 | { 48 | PNETIF_ENTRY pNetIfEntry = NULL; 49 | PLIST_HEADER pNetIfList = &pBlockQueueEntry->NetIfList; 50 | 51 | while((pNetIfEntry = (PNETIF_ENTRY)removeHeadList(pNetIfList)) != NULL) 52 | { 53 | PNET_DEV pNetDev = pNetIfEntry->pNetDev; 54 | RTMP_OS_NETDEV_WAKE_QUEUE(pNetDev); 55 | insertTailList(&freeNetIfEntryList, (PLIST_ENTRY)pNetIfEntry); 56 | 57 | DBGPRINT(RT_DEBUG_TRACE, ("RTMP_OS_NETDEV_WAKE_QUEUE(%s)\n", RTMP_OS_NETDEV_GET_DEVNAME(pNetDev))); 58 | } 59 | pBlockQueueEntry->SwTxQueueBlockFlag = FALSE; 60 | return; 61 | } 62 | 63 | 64 | VOID StopNetIfQueue( 65 | IN PRTMP_ADAPTER pAd, 66 | IN UCHAR QueIdx, 67 | IN PNDIS_PACKET pPacket) 68 | { 69 | PNET_DEV NetDev = NULL; 70 | UCHAR IfIdx = 0; 71 | BOOLEAN valid = FALSE; 72 | 73 | 74 | #ifdef P2P_SUPPORT 75 | if (RTMP_GET_PACKET_NET_DEVICE(pPacket) >= MIN_NET_DEVICE_FOR_P2P_GO) 76 | { 77 | IfIdx = (RTMP_GET_PACKET_NET_DEVICE(pPacket) - MIN_NET_DEVICE_FOR_P2P_GO) % MAX_P2P_NUM; 78 | NetDev = pAd->ApCfg.MBSSID[IfIdx].MSSIDDev; 79 | } 80 | else 81 | #endif /* P2P_SUPPORT */ 82 | #ifdef APCLI_SUPPORT 83 | if (RTMP_GET_PACKET_NET_DEVICE(pPacket) >= MIN_NET_DEVICE_FOR_APCLI) 84 | { 85 | IfIdx = (RTMP_GET_PACKET_NET_DEVICE(pPacket) - MIN_NET_DEVICE_FOR_APCLI) % MAX_APCLI_NUM; 86 | NetDev = pAd->ApCfg.ApCliTab[IfIdx].dev; 87 | } 88 | else 89 | #endif /* APCLI_SUPPORT */ 90 | { 91 | #ifdef MBSS_SUPPORT 92 | if (pAd->OpMode == OPMODE_AP) 93 | { 94 | IfIdx = (RTMP_GET_PACKET_NET_DEVICE(pPacket) - MIN_NET_DEVICE_FOR_MBSSID) % MAX_MBSSID_NUM(pAd); 95 | NetDev = pAd->ApCfg.MBSSID[IfIdx].MSSIDDev; 96 | } 97 | else 98 | { 99 | IfIdx = MAIN_MBSSID; 100 | NetDev = pAd->net_dev; 101 | } 102 | #else 103 | IfIdx = MAIN_MBSSID; 104 | NetDev = pAd->net_dev; 105 | #endif 106 | } 107 | 108 | /* WMM support 4 software queues.*/ 109 | /* One software queue full doesn't mean device have no capbility to transmit packet.*/ 110 | /* So disable block Net-If queue function while WMM enable.*/ 111 | #ifdef CONFIG_AP_SUPPORT 112 | IF_DEV_CONFIG_OPMODE_ON_AP(pAd) 113 | valid = (pAd->ApCfg.MBSSID[IfIdx].bWmmCapable == TRUE) ? FALSE : TRUE; 114 | #endif /* CONFIG_AP_SUPPORT */ 115 | #ifdef CONFIG_STA_SUPPORT 116 | { 117 | #ifdef P2P_SUPPORT 118 | if (RTMP_GET_PACKET_NET_DEVICE(pPacket) >= MIN_NET_DEVICE_FOR_P2P_GO) 119 | valid = (pAd->ApCfg.MBSSID[IfIdx].bWmmCapable == TRUE) ? FALSE : TRUE; 120 | else 121 | #endif /* P2P_SUPPORT */ 122 | IF_DEV_CONFIG_OPMODE_ON_STA(pAd) 123 | valid = (pAd->CommonCfg.bWmmCapable == TRUE) ? FALSE : TRUE; 124 | } 125 | #endif /* CONFIG_STA_SUPPORT */ 126 | 127 | if (valid) 128 | blockNetIf(&pAd->blockQueueTab[QueIdx], NetDev); 129 | return; 130 | } 131 | 132 | #endif /* BLOCK_NET_IF */ 133 | -------------------------------------------------------------------------------- /include/crypt_biginteger.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * Taiwan, R.O.C. 4 | * 5 | * (c) Copyright 2002, Ralink Technology, Inc. 6 | * 7 | * All rights reserved. Ralink's source code is an unpublished work and the 8 | * use of a copyright notice does not imply otherwise. This source code 9 | * contains confidential trade secret material of Ralink Tech. Any attemp 10 | * or participation in deciphering, decoding, reverse engineering or in any 11 | * way altering the source code is stricitly prohibited, unless the prior 12 | * written consent of Ralink Technology, Inc. is obtained. 13 | ***************************************************************************/ 14 | 15 | /**************************************************************************** 16 | Module Name: 17 | BigInteger 18 | 19 | 20 | Revision History: 21 | Who When What 22 | -------- ---------- ------------------------------------------ 23 | Eddy 2009/01/12 Create 24 | ***************************************************************************/ 25 | 26 | #ifndef __CRYPT_BIGINTEGER_H__ 27 | #define __CRYPT_BIGINTEGER_H__ 28 | 29 | #include "rt_config.h" 30 | 31 | 32 | /* BigInteger definition & structure */ 33 | #define SLIDING_WINDOW 16 34 | typedef struct _BIG_INTEGER_STRUC 35 | { 36 | STRING Name[10]; 37 | UINT32 *pIntegerArray; 38 | UINT AllocSize; 39 | UINT ArrayLength; 40 | UINT IntegerLength; 41 | INT Signed; 42 | } BIG_INTEGER, *PBIG_INTEGER; 43 | 44 | 45 | /* BigInteger operations */ 46 | VOID BigInteger_Print ( 47 | IN PBIG_INTEGER pBI); 48 | 49 | VOID BigInteger_Init ( 50 | INOUT PBIG_INTEGER *pBI); 51 | 52 | VOID BigInteger_Free_AllocSize ( 53 | IN PBIG_INTEGER *pBI); 54 | 55 | VOID BigInteger_Free ( 56 | IN PBIG_INTEGER *pBI); 57 | 58 | VOID BigInteger_AllocSize ( 59 | IN PBIG_INTEGER *pBI, 60 | IN INT Length); 61 | 62 | VOID BigInteger_ClearHighBits ( 63 | IN PBIG_INTEGER pBI); 64 | 65 | VOID BigInteger_BI2Bin ( 66 | IN PBIG_INTEGER pBI, 67 | OUT UINT8 *pValue, 68 | OUT UINT *Length); 69 | 70 | VOID BigInteger_Bin2BI ( 71 | IN UINT8 *pValue, 72 | IN UINT Length, 73 | OUT PBIG_INTEGER *pBI); 74 | 75 | VOID BigInteger_BitsOfBI ( 76 | IN PBIG_INTEGER pBI, 77 | OUT UINT *Bits_Of_P); 78 | 79 | INT BigInteger_GetBitValue ( 80 | IN PBIG_INTEGER pBI, 81 | IN UINT Index); 82 | 83 | UINT8 BigInteger_GetByteValue ( 84 | IN PBIG_INTEGER pBI, 85 | IN UINT Index); 86 | 87 | VOID BigInteger_Copy ( 88 | IN PBIG_INTEGER pBI_Copied, 89 | OUT PBIG_INTEGER *pBI_Result); 90 | 91 | INT BigInteger_UnsignedCompare ( 92 | IN PBIG_INTEGER pFirstOperand, 93 | IN PBIG_INTEGER pSecondOperand); 94 | 95 | VOID BigInteger_Add ( 96 | IN PBIG_INTEGER pFirstOperand, 97 | IN PBIG_INTEGER pSecondOperand, 98 | OUT PBIG_INTEGER *pBI_Result); 99 | 100 | VOID BigInteger_Sub ( 101 | IN PBIG_INTEGER pFirstOperand, 102 | IN PBIG_INTEGER pSecondOperand, 103 | OUT PBIG_INTEGER *pBI_Result); 104 | 105 | VOID BigInteger_Mul ( 106 | IN PBIG_INTEGER pFirstOperand, 107 | IN PBIG_INTEGER pSecondOperand, 108 | OUT PBIG_INTEGER *pBI_Result); 109 | 110 | VOID BigInteger_Square ( 111 | IN PBIG_INTEGER pBI, 112 | OUT PBIG_INTEGER *pBI_Result); 113 | 114 | VOID BigInteger_Div ( 115 | IN PBIG_INTEGER pFirstOperand, 116 | IN PBIG_INTEGER pSecondOperand, 117 | OUT PBIG_INTEGER *pBI_Result, 118 | OUT PBIG_INTEGER *pBI_Remainder); 119 | 120 | VOID BigInteger_Montgomery_Reduction ( 121 | IN PBIG_INTEGER pBI_A, 122 | IN PBIG_INTEGER pBI_P, 123 | IN PBIG_INTEGER pBI_R, 124 | OUT PBIG_INTEGER *pBI_Result); 125 | 126 | VOID BigInteger_Montgomery_ExpMod ( 127 | IN PBIG_INTEGER pBI_G, 128 | IN PBIG_INTEGER pBI_E, 129 | IN PBIG_INTEGER pBI_P, 130 | OUT PBIG_INTEGER *pBI_Result); 131 | 132 | 133 | #endif /* __CRYPT_BIGINTEGER_H__ */ 134 | 135 | -------------------------------------------------------------------------------- /include/mac_ral/omac/ral_omac_rxwi.h: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002-2004, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | ral_omac_rxwi.h 20 | 21 | Abstract: 22 | Ralink Wireless Chip MAC related definition & structures 23 | 24 | Revision History: 25 | Who When What 26 | -------- ---------- ---------------------------------------------- 27 | */ 28 | 29 | #ifndef __RAL_OMAC_RXWI_H__ 30 | #define __RAL_OMAC_RXWI_H__ 31 | 32 | #include "rtmp_type.h" 33 | 34 | /* 35 | RXWI wireless information format, in PBF. invisible in driver. 36 | */ 37 | #ifdef RT_BIG_ENDIAN 38 | typedef struct GNU_PACKED _RXWI_OMAC{ 39 | /* Word 0 */ 40 | UINT32 tid:4; 41 | UINT32 MPDUtotalByteCnt:12; 42 | UINT32 UDF:3; 43 | UINT32 bss_idx:3; 44 | UINT32 key_idx:2; 45 | UINT32 wcid:8; 46 | 47 | /* Word 1 */ 48 | UINT32 phy_mode:2; /* 1: this RX frame is unicast to me */ 49 | UINT32 iTxBF:1; /* iTxBF enable */ 50 | UINT32 Sounding:1; /* Sounding enable */ 51 | UINT32 eTxBF:1; /* eTxBF enable */ 52 | UINT32 stbc:2; 53 | UINT32 sgi:1; 54 | UINT32 bw:1; 55 | UINT32 mcs:7; 56 | UINT32 SEQUENCE:12; 57 | UINT32 FRAG:4; 58 | 59 | /* Word 2 */ 60 | UINT32 rsv1:8; 61 | UINT32 RSSI2:8; 62 | UINT32 RSSI1:8; 63 | UINT32 RSSI0:8; 64 | 65 | /* Word 3 */ 66 | UINT32 FOFFSET:8; 67 | UINT32 SNR2:8; 68 | UINT32 SNR1:8; 69 | UINT32 SNR0:8; 70 | 71 | UINT32 rsv3; 72 | 73 | #if defined(RT5592) || defined(MT7601) 74 | /* Word 5 */ 75 | /* For Exper Antenna */ 76 | UINT32 rsv4:24; 77 | UINT32 EANT_ID:8; 78 | #endif /* RT5592 */ 79 | } RXWI_OMAC, *PRXWI_OMAC; 80 | #else 81 | typedef struct GNU_PACKED _RXWI_OMAC{ 82 | /* Word 0 */ 83 | UINT32 wcid:8; 84 | UINT32 key_idx:2; 85 | UINT32 bss_idx:3; 86 | UINT32 UDF:3; 87 | UINT32 MPDUtotalByteCnt:12; 88 | UINT32 tid:4; 89 | 90 | /* Word 1 */ 91 | UINT32 FRAG:4; 92 | UINT32 SEQUENCE:12; 93 | UINT32 mcs:7; 94 | UINT32 bw:1; 95 | UINT32 sgi:1; 96 | UINT32 stbc:2; 97 | UINT32 eTxBF:1; /* eTxBF enable */ 98 | UINT32 Sounding:1; /* Sounding enable */ 99 | UINT32 iTxBF:1; /* iTxBF enable */ 100 | UINT32 phy_mode:2; /* 1: this RX frame is unicast to me */ 101 | 102 | /*Word2 */ 103 | UINT32 RSSI0:8; 104 | UINT32 RSSI1:8; 105 | UINT32 RSSI2:8; 106 | UINT32 rsv1:8; 107 | 108 | /*Word3 */ 109 | UINT32 SNR0:8; 110 | UINT32 SNR1:8; 111 | UINT32 SNR2:8; 112 | UINT32 FOFFSET:8; 113 | 114 | UINT32 rsv3; 115 | 116 | #if defined(RT5592) || defined(MT7601) 117 | /* Word 5 */ 118 | /* For Exper Antenna */ 119 | UINT32 EANT_ID:8; 120 | UINT32 rsv4:24; 121 | #endif /* RT5592 */ 122 | } RXWI_OMAC, *PRXWI_OMAC; 123 | #endif 124 | 125 | 126 | #define RxWIMPDUByteCnt RXWI_O.MPDUtotalByteCnt 127 | #define RxWIWirelessCliID RXWI_O.wcid 128 | #define RxWIKeyIndex RXWI_O.key_idx 129 | #define RxWIMCS RXWI_O.mcs 130 | #define RxWIBW RXWI_O.bw 131 | #define RxWISGI RXWI_O.sgi 132 | #define RxWIBSSID RXWI_O.bss_idx 133 | #define RxWIPhyMode RXWI_O.phy_mode 134 | #define RxWISTBC RXWI_O.stbc 135 | #define RxWITID RXWI_O.tid 136 | #define RxWIRSSI0 RXWI_O.RSSI0 137 | #define RxWIRSSI1 RXWI_O.RSSI1 138 | #define RxWIRSSI2 RXWI_O.RSSI2 139 | #define RxWISNR0 RXWI_O.SNR0 140 | #define RxWISNR1 RXWI_O.SNR1 141 | #define RxWISNR2 RXWI_O.SNR2 142 | #define RxWIFOFFSET RXWI_O.FOFFSET 143 | 144 | 145 | 146 | #endif /* __RAL_OMAC_RXWI_H__ */ 147 | 148 | -------------------------------------------------------------------------------- /include/chip/rt6590.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Ralink Tech Inc. 3 | * 4F, No. 2 Technology 5th Rd. 4 | * Science-based Industrial Park 5 | * Hsin-chu, Taiwan, R.O.C. 6 | * (c) Copyright 2002, Ralink Technology, Inc. 7 | * 8 | * All rights reserved. Ralink's source code is an unpublished work and the 9 | * use of a copyright notice does not imply otherwise. This source code 10 | * contains confidential trade secret material of Ralink Tech. Any attemp 11 | * or participation in deciphering, decoding, reverse engineering or in any 12 | * way altering the source code is stricitly prohibited, unless the prior 13 | * written consent of Ralink Technology, Inc. is obtained. 14 | **************************************************************************** 15 | 16 | Module Name: 17 | rt6590.h 18 | 19 | Abstract: 20 | 21 | Revision History: 22 | Who When What 23 | --------- ---------- ---------------------------------------------- 24 | */ 25 | 26 | #ifndef __RT6590_H__ 27 | #define __RT6590_H__ 28 | 29 | struct _RTMP_ADAPTER; 30 | 31 | #define NIC6590_PCIe_DEVICE_ID 0x6590 32 | #define MAX_RF_ID 127 33 | #define MAC_RF_BANK 7 34 | 35 | /* 36 | rsv: Reserved 37 | tcp: packet type, tcp : 1, udp:0 38 | tups: TCP/UDP header start offset (in unit of DWORD) 39 | ips: IP start offset (in unit of byte), base address of ips is the beginning of TXWI 40 | mss: Max Segment size (in unit of byte) 41 | */ 42 | #ifdef RT_BIG_ENDIAN 43 | typedef struct _TSO_INFO_{ 44 | UINT32 mss:16; 45 | UINT32 ips:8; 46 | UINT32 tups:6; 47 | UINT32 tcp:1; 48 | UINT32 rsv:1; 49 | }TSO_INFO; 50 | #else 51 | typedef struct _TSO_INFO_{ 52 | UINT32 rsv:1; 53 | UINT32 tcp:1; 54 | UINT32 tups:6; 55 | UINT32 ips:8; 56 | UINT32 mss:16; 57 | }TSO_INFO; 58 | #endif /* RT_BIG_ENDIAN */ 59 | 60 | 61 | /* 62 | * Frequency plan item for RT85592 63 | * N: R9[4], R8[7:0] 64 | * K: R7[7], R9[3:0] 65 | * mod: R9[7:5], R11[3:2] (eg. mod=8 => 0x0, mod=10 => 0x2) 66 | * R: R11[1:0] (eg. R=1 => 0x0, R=3 => 0x2) 67 | */ 68 | typedef struct _RT8592_FREQ_ITEM { 69 | UINT8 Channel; 70 | UINT16 N; 71 | UINT8 K; 72 | UINT8 mod; 73 | UINT8 R; 74 | } RT8592_FREQ_ITEM; 75 | 76 | #define RT6590_RF_VER "MT7650_WiFi_RF_Register_20120516.xls" 77 | //#define RT6590_BBP_VER "TC6008_BBP_CR_20120518.xls" 78 | #define RT6590_BBP_VER "TC6008_BBP_CR_20120522.xls" 79 | 80 | /* 81 | Rdiv: R24[1:0] (2-bits) 82 | PLL_N: R29[7:0], R30[0] (9-bits) 83 | PLL_K(Nominator): R31[4:0] (5-bits) 84 | Non-Sigma: !SDM R31[7:5] (3-bits) 85 | Den: (Denomina - 8) R32[4:0] (5-bits) 86 | Loop Filter Config: R33, R34 87 | Pll_idiv: frac comp R35[6:0] (7-bits) 88 | 89 | 5G only 90 | Pll_LDO: R16 [6:4] = <010> 91 | */ 92 | typedef struct _RT6590_FREQ_ITEM { 93 | UINT8 Channel; 94 | UINT8 Band; 95 | UINT16 PLL_N; 96 | UINT8 PLL_K; 97 | UINT8 Rdiv; 98 | UINT8 NonSigma; 99 | UINT8 Den; 100 | UINT8 LFC_R33; 101 | UINT8 LFC_R34; 102 | UINT32 Pll_idiv; 103 | UINT8 Pll_LDO; // 5G only 104 | } RT6590_FREQ_ITEM; 105 | 106 | #define RF_G_BAND 0x01 107 | #define RF_A_BAND 0x02 108 | #define RF_A_BAND_LB 0x04 109 | #define RF_A_BAND_MB 0x08 110 | #define RF_A_BAND_HB 0x10 111 | typedef struct _RT6590_RF_SWITCH_ITEM { 112 | UCHAR Bank; 113 | UCHAR Register; 114 | UCHAR Band; /* G_Band, A_Band_LB, A_Band_MB, A_Band_HB */ 115 | UCHAR BW; 116 | UCHAR Value; 117 | } RT6590_RF_SWITCH_ITEM, *PRT6590_RF_SWITCH_ITEM; 118 | 119 | typedef struct _RT6590_DCOC_Table { 120 | UCHAR Band; /* G_Band, A_Band_LB, A_Band_MB, A_Band_HB */ 121 | RTMP_REG_PAIR RegDate; 122 | } RT6590_DOCO_Table, *PRT6590_DOCO_Table; 123 | 124 | VOID RT6590_Init(struct _RTMP_ADAPTER *pAd); 125 | INT RT6590_ReadChannelPwr(struct _RTMP_ADAPTER *pAd); 126 | 127 | #ifdef RT8592 128 | VOID RT85592_Init(struct _RTMP_ADAPTER *pAd); 129 | INT RT85592_ReadChannelPwr(struct _RTMP_ADAPTER *pAd); 130 | VOID RT85592ReadTxPwrPerRate(struct _RTMP_ADAPTER *pAd); 131 | #endif /* RT8592 */ 132 | VOID RT6590ReadTxPwrPerRate(struct _RTMP_ADAPTER *pAd); 133 | 134 | VOID dump_bw_info(struct _RTMP_ADAPTER *pAd); 135 | 136 | #endif /* __RT6590_H__ */ 137 | 138 | -------------------------------------------------------------------------------- /os/linux/Kconfig.ap.soc: -------------------------------------------------------------------------------- 1 | config RT2860V2_AP 2 | tristate "Ralink RT2860 802.11n AP support" 3 | depends on NET_RADIO 4 | 5 | config RT2860V2_AP_V24_DATA_STRUCTURE 6 | bool 7 | depends on RT2860V2_AP 8 | default y 9 | 10 | config RT2860V2_AP_LED 11 | bool "LED Support" 12 | depends on RT2860V2_AP 13 | 14 | config RT2860V2_AP_WSC 15 | bool "WSC (WiFi Simple Config)" 16 | depends on RT2860V2_AP 17 | 18 | config RT2860V2_AP_LLTD 19 | bool "LLTD (Link Layer Topology Discovery Protocol)" 20 | depends on RT2860V2_AP 21 | 22 | config RT2860V2_AP_WDS 23 | bool "WDS" 24 | depends on RT2860V2_AP 25 | 26 | config RT2860V2_AP_NINTENDO 27 | bool "Nintendo" 28 | depends on RT2860V2_AP 29 | 30 | config RT2860V2_AP_WMM_ACM 31 | bool "WMM ACM" 32 | depends on RT2860V2_AP 33 | 34 | config RT2860V2_AP_MBSS 35 | bool "MBSSID" 36 | depends on RT2860V2_AP 37 | 38 | config NEW_MBSSID_MODE 39 | bool "New MBSSID MODE" 40 | depends on RT2860V2_AP 41 | depends on RT2860V2_AP_MBSS 42 | depends on RALINK_RT3883 || RALINK_RT3352 || RALINK_RT5350 43 | default n 44 | 45 | config RT2860V2_AP_APCLI 46 | bool "AP-CLient Support" 47 | depends on RT2860V2_AP 48 | 49 | config RT2860V2_AP_IGMP_SNOOP 50 | bool "IGMP snooping" 51 | depends on RT2860V2_AP 52 | 53 | config RT2860V2_AP_NETIF_BLOCK 54 | bool "NETIF Block" 55 | depends on RT2860V2_AP 56 | help 57 | Support Net interface block while Tx-Sw queue full 58 | 59 | config RT2860V2_AP_DFS 60 | bool "DFS" 61 | depends on RT2860V2_AP 62 | select RALINK_TIMER_DFS 63 | 64 | config RT2860V2_AP_CARRIER 65 | bool "Carrier Detect" 66 | depends on RT2860V2_AP 67 | select RALINK_TIMER_DFS 68 | 69 | config RT2860V2_AP_DLS 70 | bool "DLS ((Direct-Link Setup) Support" 71 | depends on RT2860V2_AP 72 | 73 | config RT2860V2_AP_IDS 74 | bool "IDS (Intrusion Detection System) Support" 75 | depends on RT2860V2_AP 76 | 77 | config RT2860V2_AP_MESH 78 | bool "MESH Support" 79 | depends on RT2860V2_AP 80 | 81 | config RT2860V2_HW_ANTENNA_DIVERSITY 82 | bool "Antenna Diversity Support" 83 | depends on RT2860V2_AP 84 | depends on RALINK_RT5350 85 | 86 | config RT2860V2_RT3XXX_AP_ANTENNA_DIVERSITY 87 | bool "Antenna Diversity Support" 88 | depends on RT2860V2_AP 89 | 90 | config RT2860V2_AP_WAPI 91 | bool "WAPI Support" 92 | depends on RT2860V2_AP 93 | 94 | config RT2860V2_AP_COC 95 | bool "CoC Support" 96 | depends on RT2860V2_AP 97 | 98 | config RT2860V2_AP_MEMORY_OPTIMIZATION 99 | bool "Memory Optimization" 100 | depends on RT2860V2_AP 101 | 102 | config RT2860V2_AP_VIDEO_TURBINE 103 | bool "Video Turbine support" 104 | depends on RT2860V2_AP 105 | 106 | config RA_CLASSIFIER 107 | tristate "Ralink Flow Classifier" 108 | depends on RT2860V2_AP_VIDEO_TURBINE 109 | default n 110 | 111 | config RT2860V2_80211N_DRAFT3 112 | bool "802.11n Draft3" 113 | depends on RT2860V2_AP 114 | 115 | config RT2860V2_AP_INTELLIGENT_RATE_ADAPTION 116 | bool "Intelligent Rate Adaption" 117 | depends on RT2860V2_AP 118 | 119 | config RT2860V2_AP_TXBF 120 | bool "Tx Beam Forming" 121 | depends on RT2860V2_AP 122 | depends on RALINK_RT3883 123 | 124 | config RT2860V2_AP_RTMP_INTERNAL_TX_ALC 125 | bool "TSSI Compensation" 126 | depends on RT2860V2_AP 127 | depends on RALINK_RT3350 || RALINK_RT3352 || RALINK_RT5350 128 | 129 | #config RT2860V2_EXT_CHANNEL_LIST 130 | # bool "Extension Channel List" 131 | # depends on RT2860V2_AP 132 | 133 | #config RT2860V2_KTHREAD 134 | # bool "Kernel Thread" 135 | # depends on RT2860V2_AP 136 | 137 | #config RT2860V2_AUTO_CH_SELECT_ENHANCE 138 | # bool "Auto Channel Selection Enhancement" 139 | # depends on RT2860V2_AP 140 | 141 | #config RT2860V2_80211R_FT 142 | # bool "802.11r Fast BSS Transition" 143 | # depends on RT2860V2_AP 144 | 145 | #config RT2860V2_80211R_RR 146 | # bool "802.11k Radio Resource Management" 147 | # depends on RT2860V2_AP 148 | 149 | #config RT2860V2_SINGLE_SKU 150 | # bool "Single SKU" 151 | # depends on RT2860V2_AP 152 | 153 | #config RT2860V2_MCAST_RATE_SPECIFIC 154 | # bool "User specific tx rate of mcast pkt" 155 | # depends on RT2860V2_AP 156 | 157 | #config RT2860V2_SNMP 158 | # bool "Net-SNMP Support" 159 | # depends on RT2860V2_AP 160 | -------------------------------------------------------------------------------- /include/mac_ral/rf_ctrl.h: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002-2004, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | rf_ctrl.h 20 | 21 | Abstract: 22 | Ralink wireless chip RF related definition & structures 23 | 24 | Revision History: 25 | Who When What 26 | -------- ---------- ---------------------------------------------- 27 | */ 28 | 29 | #ifndef __RF_CTRL_H__ 30 | #define __RF_CTRL_H__ 31 | 32 | #ifdef RTMP_MAC 33 | #include "mac_ral/omac/ral_omac_rf_ctrl.h" 34 | #endif /* RTMP_MAC */ 35 | 36 | #ifdef RLT_MAC 37 | 38 | #endif /* RLT_MAC */ 39 | 40 | 41 | /* ================================================================================= */ 42 | /* Register format for RFCTRL */ 43 | /* ================================================================================= */ 44 | 45 | #define RF_CSR_CFG 0x500 46 | 47 | #ifdef RLT_RF 48 | 49 | #define RF_BANK0 0 50 | #define RF_BANK1 1 51 | #define RF_BANK2 2 52 | #define RF_BANK3 3 53 | #define RF_BANK4 4 54 | #define RF_BANK5 5 55 | #define RF_BANK6 6 56 | #define RF_BANK7 7 57 | #define RF_BANK8 8 58 | #define RF_BANK9 9 59 | #define RF_BANK10 10 60 | #define RF_BANK11 11 61 | #define RF_BANK12 12 62 | #define RF_BANK13 13 63 | #define RF_BANK14 14 64 | #define RF_BANK15 15 65 | 66 | /* @!Release 67 | RF_CSR_KICK:1 68 | Write - kick RF register read/write 69 | 0: do nothing 70 | 1: kick read/write process 71 | Read - Polling RF register read/write 72 | 0: idle 73 | 1: busy 74 | RF_CSR_RW:1 75 | 0: read 1: write 76 | rsv:12 77 | RF_CSR_REG_ID:10 78 | RF register ID, 0 for R0, 1 for R1 and so on 79 | Bits [17:15] 3 bits, indicates the bank number 80 | Bits [14:08] 7 bits, indicates the register number 81 | 82 | RF_CSR_DATA:8 83 | DATA written to/read from RF 84 | */ 85 | typedef union _RLT_RF_CSR_CFG { 86 | #ifdef RT_BIG_ENDIAN 87 | struct { 88 | UINT RF_CSR_KICK:1; 89 | UINT RF_CSR_WR:1; 90 | UINT rsv:12; 91 | #ifdef MT7601 92 | UINT RF_CSR_REG_BANK:4; 93 | UINT RF_CSR_REG_ID:6; 94 | #else 95 | UINT RF_CSR_REG_BANK:3; 96 | UINT RF_CSR_REG_ID:7; 97 | #endif /* MT7601 */ 98 | UINT RF_CSR_DATA:8; 99 | } field; 100 | #else 101 | struct { 102 | UINT RF_CSR_DATA:8; 103 | #ifdef MT7601 104 | UINT RF_CSR_REG_ID:6; 105 | UINT RF_CSR_REG_BANK:4; 106 | #else 107 | UINT RF_CSR_REG_ID:7; 108 | UINT RF_CSR_REG_BANK:3; 109 | #endif /* MT7601 */ 110 | UINT rsv:12; 111 | UINT RF_CSR_WR:1; 112 | UINT RF_CSR_KICK:1; 113 | } field; 114 | #endif /* RT_BIG_ENDIAN */ 115 | UINT word; 116 | }RLT_RF_CSR_CFG; 117 | #endif /* RLT_RF */ 118 | 119 | 120 | typedef union _RF_CSR_CFG_STRUC { 121 | #ifdef RT_BIG_ENDIAN 122 | struct { 123 | UINT32 Rsvd1:14; /* Reserved */ 124 | UINT32 RF_CSR_KICK:1; /* kick RF register read/write */ 125 | UINT32 RF_CSR_WR:1; /* 0: read 1: write */ 126 | UINT32 TESTCSR_RFACC_REGNUM:8; /* RF register ID */ 127 | UINT32 RF_CSR_DATA:8; /* DATA */ 128 | } field; 129 | #else 130 | struct { 131 | UINT32 RF_CSR_DATA:8; 132 | UINT32 TESTCSR_RFACC_REGNUM:8; 133 | UINT32 RF_CSR_WR:1; 134 | UINT32 RF_CSR_KICK:1; 135 | UINT32 Rsvd1:14; 136 | } field; 137 | #endif /* RT_BIG_ENDIAN */ 138 | UINT32 word; 139 | }RF_CSR_CFG_STRUC; 140 | 141 | #define RF_BYPASS_0 0x0504 142 | 143 | #define RF_SETTING_0 0x050C 144 | 145 | #endif /* __RF_CTRL_H__ */ 146 | 147 | -------------------------------------------------------------------------------- /elian/os/linux/glue.c: -------------------------------------------------------------------------------- 1 | 2 | #include "rt_config.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "../../msc/msc.h" 8 | #include "../../lib/plat.h" 9 | #include 10 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)) 11 | #include <../../fs/proc/internal.h> 12 | #endif 13 | 14 | #define MSC_PROC_NAME "elian" 15 | 16 | static int msc_proc_open(struct inode *inode, struct file *file); 17 | static int msc_proc_release(struct inode *inode, struct file *file); 18 | static int msc_proc_show(struct seq_file *seq, void *offset); 19 | static ssize_t msc_proc_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos); 20 | 21 | static struct proc_dir_entry *entry=NULL; 22 | 23 | const struct file_operations msc_proc_fops = { 24 | .open = msc_proc_open, 25 | .read = seq_read, 26 | .write = msc_proc_write, 27 | .llseek = seq_lseek, 28 | .release = msc_proc_release, 29 | }; 30 | 31 | void evt_cb(unsigned int eid, struct msc_result *result) 32 | { 33 | printk("[MSC] done: AM=%d, ssid=%s, pwd=%s, user=%s, cust_data_len=%d, cust_data=%s,\n", 34 | result->auth_mode, result->ssid, result->pwd, result->user, result->cust_data_len, result->cust_data); 35 | return; 36 | } 37 | 38 | int msc_proc_create(void *priv) 39 | { 40 | printk("MSC msc_proc_create: %p\n", priv); 41 | if (entry == NULL) { 42 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) 43 | entry = proc_create_data(MSC_PROC_NAME, S_IRUSR|S_IWUSR, NULL, &msc_proc_fops, priv); 44 | #else 45 | entry = create_proc_entry(MSC_PROC_NAME, S_IRUGO, NULL); 46 | if (!entry) 47 | return -ENOMEM; 48 | entry->proc_fops = &msc_proc_fops; 49 | #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) */ 50 | } 51 | 52 | return 0; 53 | } 54 | 55 | void msc_proc_destroy(void) 56 | { 57 | printk("MSC msc_proc_destroy: %s\n", MSC_PROC_NAME); 58 | if(entry != NULL) 59 | { 60 | remove_proc_entry(MSC_PROC_NAME, NULL); 61 | entry=NULL; 62 | } 63 | return; 64 | } 65 | 66 | 67 | static int msc_proc_show(struct seq_file *seq, void *offset) 68 | { 69 | struct msc_result result; 70 | 71 | msc_get_result(&result); 72 | 73 | #if 0 74 | for(i=0;iauth_mode, test_result->ssid, test_result->pwd, test_result->user, test_result->cust_data_len, test_result->cust_data); 79 | seq_printf(seq, "SSID\t: %s\n" 80 | "PASSWORD\t: %s\n" 81 | "AUTHMODE\t: %d\n" 82 | "TLV_HEX\t: %s\n", 83 | SMTCNResult.msc_ssid, SMTCNResult.msc_pwd, SMTCNResult.msc_authmode, SMTCNResult.msc_cust_tlv_str); 84 | #endif 85 | seq_printf(seq, "AM=%d, ssid=%s, pwd=%s, user=%s, cust_data_len=%d, cust_data=%s,\n", 86 | result.auth_mode, result.ssid, result.pwd, result.user, result.cust_data_len, result.cust_data); 87 | 88 | return 0; 89 | } 90 | 91 | static ssize_t msc_proc_write(struct file *file, const char __user *buf, 92 | size_t count, loff_t *ppos) 93 | { 94 | int err = 0; 95 | char data[128]; 96 | char result[128]; 97 | 98 | if (count > sizeof(data)) 99 | count = sizeof(data); 100 | 101 | if (copy_from_user(data, buf, count)) { 102 | err = -EFAULT; 103 | goto out; 104 | } 105 | data[count - 1] = 0; /* Make string */ 106 | 107 | 108 | msc_cmd_handler(data, (int)count, result, (void*)entry->data); 109 | #if 0 110 | if (strcmp(data, "clear") == 0) { 111 | msc_reset(); 112 | } else if (strcmp(data, "start") == 0) { 113 | memset(&g_para, 0, sizeof(g_para)); 114 | g_para.evt_cb = evt_cb; 115 | msc_start(&g_para, entry->data); 116 | } else if (strcmp(data, "stop") == 0) { 117 | msc_stop(entry->data); 118 | } 119 | #endif 120 | err = count; 121 | out: 122 | return err; 123 | } 124 | 125 | static int msc_proc_open(struct inode *inode, struct file *file) 126 | { 127 | return single_open(file, msc_proc_show, NULL); 128 | } 129 | 130 | static int msc_proc_release(struct inode *inode, struct file *file) 131 | { 132 | int res = single_release(inode, file); 133 | return res; 134 | } 135 | 136 | -------------------------------------------------------------------------------- /mcu/rtmp_mcu.c: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002-2004, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | rtmp_mcu.c 20 | 21 | Abstract: 22 | 23 | Revision History: 24 | Who When What 25 | -------- ---------- ---------------------------------------------- 26 | */ 27 | 28 | 29 | #include "rt_config.h" 30 | 31 | INT MCUBurstWrite(PRTMP_ADAPTER pAd, UINT32 Offset, UINT32 *Data, UINT32 Cnt) 32 | { 33 | RTUSBMultiWrite_nBytes(pAd, Offset, (PUCHAR)Data, Cnt * 4, 64); 34 | return 0; 35 | } 36 | 37 | INT MCURandomWrite(PRTMP_ADAPTER pAd, UINT32 Num,... /*RTMP_REG_PAIR *RegPair*/) 38 | { 39 | UINT32 Index; 40 | va_list arg_ptr; 41 | RTMP_REG_PAIR* RegPair = NULL; 42 | va_start(arg_ptr, Num); 43 | RegPair = va_arg(arg_ptr, PRTMP_REG_PAIR); 44 | for (Index = 0; Index < Num; Index++) 45 | RTMP_IO_WRITE32(pAd, RegPair->Register, RegPair->Value); 46 | va_end(arg_ptr); 47 | return 0; 48 | } 49 | 50 | VOID ChipOpsMCUHook(PRTMP_ADAPTER pAd, enum MCU_TYPE MCUType) 51 | { 52 | 53 | RTMP_CHIP_OP *pChipOps = &pAd->chipOps; 54 | 55 | 56 | if (MCUType == M8051) 57 | { 58 | pChipOps->sendCommandToMcu = RtmpAsicSendCommandToMcu; 59 | pChipOps->BurstWrite = MCUBurstWrite; 60 | pChipOps->RandomWrite = MCURandomWrite; 61 | } 62 | 63 | #ifdef CONFIG_ANDES_SUPPORT 64 | if (MCUType == ANDES) 65 | { 66 | 67 | #ifdef RTMP_USB_SUPPORT 68 | pChipOps->loadFirmware = USBLoadFirmwareToAndes; 69 | #endif 70 | //pChipOps->sendCommandToMcu = AsicSendCmdToAndes; 71 | pChipOps->Calibration = AndesCalibrationOP; 72 | pChipOps->BurstWrite = AndesBurstWrite; 73 | pChipOps->BurstRead = AndesBurstRead; 74 | pChipOps->RandomRead = AndesRandomRead; 75 | pChipOps->RFRandomRead = AndesRFRandomRead; 76 | pChipOps->ReadModifyWrite = AndesReadModifyWrite; 77 | pChipOps->RFReadModifyWrite = AndesRFReadModifyWrite; 78 | pChipOps->RandomWrite = AndesRandomWrite; 79 | pChipOps->RFRandomWrite = AndesRFRandomWrite; 80 | pChipOps->PwrSavingOP = AndesPwrSavingOP; 81 | } 82 | #endif 83 | } 84 | 85 | NDIS_STATUS isMCUNeedToLoadFIrmware( 86 | IN PRTMP_ADAPTER pAd) 87 | { 88 | NDIS_STATUS Status = NDIS_STATUS_SUCCESS; 89 | ULONG Index; 90 | UINT32 MacReg; 91 | 92 | Index = 0; 93 | 94 | #ifdef CONFIG_ANDES_SUPPORT 95 | if (WaitForAsicReady(pAd) == TRUE) 96 | { 97 | DBGPRINT(RT_DEBUG_TRACE,("%s WaitForAsicReady ====> TRUE\n", __FUNCTION__)); 98 | #if 1 // don't need to reset MAC in normal cases. 99 | MT7601_WLAN_ChipOnOff(pAd, FALSE, FALSE); 100 | #else 101 | MT7601_WLAN_ChipOnOff(pAd, TRUE, TRUE); 102 | #endif 103 | } 104 | else 105 | { 106 | DBGPRINT(RT_DEBUG_ERROR,("%s ====> \n", __FUNCTION__)); 107 | } 108 | #endif 109 | do { 110 | if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) 111 | return NDIS_STATUS_FAILURE; 112 | 113 | #ifdef CONFIG_ANDES_SUPPORT 114 | RTMP_IO_READ32(pAd, COM_REG0, &MacReg); 115 | 116 | if (MacReg == 0x1) 117 | break; 118 | 119 | RtmpOsMsDelay(10); 120 | #else 121 | RTMP_IO_READ32(pAd, PBF_SYS_CTRL, &MacReg); 122 | 123 | if (MacReg & 0x100) /* check bit 8*/ 124 | break; 125 | 126 | RTMPusecDelay(1000); 127 | #endif 128 | } while (Index++ < 100); 129 | 130 | if (Index >= 100) 131 | Status = NDIS_STATUS_FAILURE; 132 | return Status; 133 | } 134 | 135 | -------------------------------------------------------------------------------- /common/cmm_cmd.c: -------------------------------------------------------------------------------- 1 | /* 2 | *************************************************************************** 3 | * Ralink Tech Inc. 4 | * 4F, No. 2 Technology 5th Rd. 5 | * Science-based Industrial Park 6 | * Hsin-chu, Taiwan, R.O.C. 7 | * 8 | * (c) Copyright 2002-2006, Ralink Technology, Inc. 9 | * 10 | * All rights reserved. Ralink's source code is an unpublished work and the 11 | * use of a copyright notice does not imply otherwise. This source code 12 | * contains confidential trade secret material of Ralink Tech. Any attemp 13 | * or participation in deciphering, decoding, reverse engineering or in any 14 | * way altering the source code is stricitly prohibited, unless the prior 15 | * written consent of Ralink Technology, Inc. is obtained. 16 | *************************************************************************** 17 | 18 | Module Name: 19 | cmm_cmd.c 20 | 21 | Abstract: 22 | All command related API. 23 | 24 | Revision History: 25 | Who When What 26 | -------- ---------- ---------------------------------------------- 27 | Name Date Modification logs 28 | Paul Lin 06-25-2004 created 29 | */ 30 | 31 | #include "rt_config.h" 32 | 33 | 34 | 35 | 36 | /* 37 | ======================================================================== 38 | 39 | Routine Description: 40 | 41 | Arguments: 42 | 43 | Return Value: 44 | 45 | IRQL = 46 | 47 | Note: 48 | 49 | ======================================================================== 50 | */ 51 | VOID RTInitializeCmdQ( 52 | IN PCmdQ cmdq) 53 | { 54 | cmdq->head = NULL; 55 | cmdq->tail = NULL; 56 | cmdq->size = 0; 57 | cmdq->CmdQState = RTMP_TASK_STAT_INITED; 58 | } 59 | 60 | 61 | /* 62 | ======================================================================== 63 | 64 | Routine Description: 65 | 66 | Arguments: 67 | 68 | Return Value: 69 | 70 | IRQL = 71 | 72 | Note: 73 | 74 | ======================================================================== 75 | */ 76 | VOID RTThreadDequeueCmd( 77 | IN PCmdQ cmdq, 78 | OUT PCmdQElmt *pcmdqelmt) 79 | { 80 | *pcmdqelmt = cmdq->head; 81 | 82 | if (*pcmdqelmt != NULL) 83 | { 84 | cmdq->head = cmdq->head->next; 85 | cmdq->size--; 86 | if (cmdq->size == 0) 87 | cmdq->tail = NULL; 88 | } 89 | } 90 | 91 | 92 | /* 93 | ======================================================================== 94 | 95 | Routine Description: 96 | 97 | Arguments: 98 | 99 | Return Value: 100 | 101 | IRQL = 102 | 103 | Note: 104 | 105 | ======================================================================== 106 | */ 107 | NDIS_STATUS RTEnqueueInternalCmd( 108 | IN PRTMP_ADAPTER pAd, 109 | IN NDIS_OID Oid, 110 | IN PVOID pInformationBuffer, 111 | IN UINT32 InformationBufferLength) 112 | { 113 | NDIS_STATUS status; 114 | PCmdQElmt cmdqelmt = NULL; 115 | 116 | 117 | status = os_alloc_mem(pAd, (PUCHAR *)&cmdqelmt, sizeof(CmdQElmt)); 118 | if ((status != NDIS_STATUS_SUCCESS) || (cmdqelmt == NULL)) 119 | return (NDIS_STATUS_RESOURCES); 120 | NdisZeroMemory(cmdqelmt, sizeof(CmdQElmt)); 121 | 122 | if(InformationBufferLength > 0) 123 | { 124 | status = os_alloc_mem(pAd, (PUCHAR *)&cmdqelmt->buffer, InformationBufferLength); 125 | if ((status != NDIS_STATUS_SUCCESS) || (cmdqelmt->buffer == NULL)) 126 | { 127 | os_free_mem(pAd, cmdqelmt); 128 | return (NDIS_STATUS_RESOURCES); 129 | } 130 | else 131 | { 132 | NdisMoveMemory(cmdqelmt->buffer, pInformationBuffer, InformationBufferLength); 133 | cmdqelmt->bufferlength = InformationBufferLength; 134 | } 135 | } 136 | else 137 | { 138 | cmdqelmt->buffer = NULL; 139 | cmdqelmt->bufferlength = 0; 140 | } 141 | 142 | cmdqelmt->command = Oid; 143 | cmdqelmt->CmdFromNdis = FALSE; 144 | 145 | if (cmdqelmt != NULL) 146 | { 147 | NdisAcquireSpinLock(&pAd->CmdQLock); 148 | if (pAd->CmdQ.CmdQState & RTMP_TASK_CAN_DO_INSERT) 149 | { 150 | EnqueueCmd((&pAd->CmdQ), cmdqelmt); 151 | status = NDIS_STATUS_SUCCESS; 152 | } 153 | else 154 | { 155 | status = NDIS_STATUS_FAILURE; 156 | } 157 | NdisReleaseSpinLock(&pAd->CmdQLock); 158 | 159 | if (status == NDIS_STATUS_FAILURE) 160 | { 161 | if (cmdqelmt->buffer) 162 | os_free_mem(pAd, cmdqelmt->buffer); 163 | os_free_mem(pAd, cmdqelmt); 164 | } 165 | else 166 | RTCMDUp(&pAd->cmdQTask); 167 | } 168 | return(NDIS_STATUS_SUCCESS); 169 | } 170 | -------------------------------------------------------------------------------- /include/link_list.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __LINK_LIST_H__ 3 | #define __LINK_LIST_H__ 4 | 5 | typedef struct _LIST_ENTRY 6 | { 7 | struct _LIST_ENTRY *pNext; 8 | } LIST_ENTRY, *PLIST_ENTRY; 9 | 10 | typedef struct _LIST_HEADR 11 | { 12 | PLIST_ENTRY pHead; 13 | PLIST_ENTRY pTail; 14 | UCHAR size; 15 | } LIST_HEADER, *PLIST_HEADER; 16 | 17 | static inline VOID initList( 18 | IN PLIST_HEADER pList) 19 | { 20 | pList->pHead = pList->pTail = NULL; 21 | pList->size = 0; 22 | return; 23 | } 24 | 25 | static inline VOID insertTailList( 26 | IN PLIST_HEADER pList, 27 | IN PLIST_ENTRY pEntry) 28 | { 29 | pEntry->pNext = NULL; 30 | if (pList->pTail) 31 | pList->pTail->pNext = pEntry; 32 | else 33 | pList->pHead = pEntry; 34 | pList->pTail = pEntry; 35 | pList->size++; 36 | 37 | return; 38 | } 39 | 40 | static inline PLIST_ENTRY removeHeadList( 41 | IN PLIST_HEADER pList) 42 | { 43 | PLIST_ENTRY pNext; 44 | PLIST_ENTRY pEntry; 45 | 46 | pEntry = pList->pHead; 47 | if (pList->pHead != NULL) 48 | { 49 | pNext = pList->pHead->pNext; 50 | pList->pHead = pNext; 51 | if (pNext == NULL) 52 | pList->pTail = NULL; 53 | pList->size--; 54 | } 55 | return pEntry; 56 | } 57 | 58 | static inline int getListSize( 59 | IN PLIST_HEADER pList) 60 | { 61 | return pList->size; 62 | } 63 | 64 | static inline PLIST_ENTRY delEntryList( 65 | IN PLIST_HEADER pList, 66 | IN PLIST_ENTRY pEntry) 67 | { 68 | PLIST_ENTRY pCurEntry; 69 | PLIST_ENTRY pPrvEntry; 70 | 71 | if(pList->pHead == NULL) 72 | return NULL; 73 | 74 | if(pEntry == pList->pHead) 75 | { 76 | pCurEntry = pList->pHead; 77 | pList->pHead = pCurEntry->pNext; 78 | 79 | if(pList->pHead == NULL) 80 | pList->pTail = NULL; 81 | 82 | pList->size--; 83 | return pCurEntry; 84 | } 85 | 86 | pPrvEntry = pList->pHead; 87 | pCurEntry = pPrvEntry->pNext; 88 | while(pCurEntry != NULL) 89 | { 90 | if (pEntry == pCurEntry) 91 | { 92 | pPrvEntry->pNext = pCurEntry->pNext; 93 | 94 | if(pEntry == pList->pTail) 95 | pList->pTail = pPrvEntry; 96 | 97 | pList->size--; 98 | break; 99 | } 100 | pPrvEntry = pCurEntry; 101 | pCurEntry = pPrvEntry->pNext; 102 | } 103 | 104 | return pCurEntry; 105 | } 106 | 107 | 108 | typedef struct _DL_LIST 109 | { 110 | struct _DL_LIST *Next; 111 | struct _DL_LIST *Prev; 112 | }DL_LIST, *PDL_LIST; 113 | 114 | static inline void DlListInit(struct _DL_LIST *List) 115 | { 116 | List->Next = List; 117 | List->Prev = List; 118 | } 119 | 120 | static inline void DlListAdd(struct _DL_LIST *List, struct _DL_LIST *Item) 121 | { 122 | Item->Next = List->Next; 123 | Item->Prev = List; 124 | List->Next->Prev = Item; 125 | List->Next = Item; 126 | } 127 | 128 | static inline void DlListAddTail(struct _DL_LIST *List, struct _DL_LIST *Item) 129 | { 130 | DlListAdd(List->Prev, Item); 131 | } 132 | 133 | static inline void DlListDel(struct _DL_LIST *Item) 134 | { 135 | Item->Next->Prev = Item->Prev; 136 | Item->Prev->Next = Item->Next; 137 | Item->Next = NULL; 138 | Item->Prev = NULL; 139 | } 140 | 141 | static inline int DlListEmpty(struct _DL_LIST *List) 142 | { 143 | return List->Next == List; 144 | } 145 | 146 | static inline unsigned int DlListLen(struct _DL_LIST *List) 147 | { 148 | struct _DL_LIST *Item; 149 | unsigned int Count = 0; 150 | 151 | for (Item = List->Next; Item != List; Item = Item->Next) 152 | Count++; 153 | 154 | return Count; 155 | } 156 | 157 | 158 | #ifndef offsetof 159 | #define offsetof(type, member) ((long) &((type *) 0)->member) 160 | #endif 161 | 162 | #define DlListEntry(item, type, member) \ 163 | ((type *) ((char *) item - offsetof(type, member))) 164 | 165 | #define DlListFirst(list, type, member) \ 166 | (DlListEmpty((list)) ? NULL : \ 167 | DlListEntry((list)->Next, type, member)) 168 | 169 | #define DlListForEach(item, list, type, member) \ 170 | for (item = DlListEntry((list)->Next, type, member); \ 171 | &item->member != (list); \ 172 | item = DlListEntry(item->member.Next, type, member)) 173 | 174 | #define DlListForEachSafe(item, n, list, type, member) \ 175 | for (item = DlListEntry((list)->Next, type, member), \ 176 | n = DlListEntry(item->member.Next, type, member); \ 177 | &item->member != (list); \ 178 | item = n, n = DlListEntry(n->member.Next, type, member)) 179 | 180 | 181 | #endif /* ___LINK_LIST_H__ */ 182 | 183 | --------------------------------------------------------------------------------