├── hal_apollo ├── util.h ├── svn_version.h ├── dev_ioctl.h ├── smartconfig.c ├── bh_spi.h ├── test.c ├── mac80211 │ ├── driver-trace.c │ ├── wext_cfg.h │ ├── debugfs_sta.h │ ├── debugfs.h │ ├── cfg.h │ ├── aes_cmac.h │ ├── michael.h │ ├── wapi.h │ ├── debugfs_netdev.h │ ├── wme.h │ ├── mac80211_bridge.h │ ├── aes_ccm.h │ ├── tkip.h │ ├── wpa.h │ ├── event.c │ ├── debugfs_key.h │ ├── wep.h │ ├── ieee80211_Sstar_mem.h │ ├── Sstar_common.h │ ├── wapi.c │ ├── led.h │ ├── michael.c │ ├── spectmgmt.c │ ├── aes_cmac.c │ ├── rc80211_minstrel_ht.h │ ├── rc80211_minstrel.h │ ├── chan.c │ ├── rc80211_minstrel_ht_debugfs.c │ ├── aes_ccm.c │ ├── key.h │ ├── wme.c │ ├── rate.h │ └── rc80211_minstrel_debugfs.c ├── module_fs.h ├── Sstar_p2p.h ├── bh_usb.h ├── dcxo_dpll.h ├── dbg_event.h ├── ht.h ├── fwio.h ├── hwio_usb.h ├── hwio_spi.h ├── pm.h ├── smartconfig.h ├── internal_cmd.h ├── hwio.h ├── apollo_plat.h ├── ap.h ├── dbg_event.c ├── scan.h ├── txrx.h ├── Sstar_testmode.h ├── bh.h ├── queue.h └── sbus.h ├── README.md ├── include ├── linux │ ├── average.h │ ├── compat-3.10.h │ ├── math64.h │ ├── tracepoint.h │ ├── compat-2.6.14.h │ ├── printk.h │ ├── pm_qos.h │ ├── semaphore.h │ ├── compat-2.6.18.h │ ├── pm_runtime.h │ ├── of.h │ ├── export.h │ ├── compat-2.6.21.h │ ├── compat-3.3.h │ ├── compat-2.6.19.h │ ├── compat-2.6.20.h │ ├── rfkill.h │ ├── compat-4.9.h │ ├── compat-3.1.h │ ├── unaligned │ │ ├── be_struct.h │ │ ├── le_struct.h │ │ ├── be_memmove.h │ │ ├── le_memmove.h │ │ ├── memmove.h │ │ ├── packed_struct.h │ │ ├── access_ok.h │ │ ├── be_byteshift.h │ │ ├── le_byteshift.h │ │ └── generic.h │ ├── compat-2.6.30.h │ ├── atomic.h │ ├── compat-3.8.h │ ├── pm_qos_params.h │ ├── compat-2.6.35.h │ ├── compat-2.6.h │ ├── compat-3.2.h │ ├── cordic.h │ ├── compat-2.6.38.h │ ├── compat-2.6.22.h │ ├── compat-3.4.h │ ├── compat-3.0.h │ ├── crc8.h │ ├── compat-2.6.37.h │ ├── compat-2.6.32.h │ ├── compat-2.6.23.h │ ├── compat-2.6.36.h │ ├── compat-3.5.h │ ├── compat-2.6.39.h │ └── compat-2.6.33.h └── crypto │ └── aes.h ├── .config ├── Makefile └── Makefile.build.kernel /hal_apollo/util.h: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /hal_apollo/svn_version.h: -------------------------------------------------------------------------------- 1 | #define DRIVER_VER 1532 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ssw101b 2 | SigmaStar ssw101b WiFi driver 3 | -------------------------------------------------------------------------------- /hal_apollo/dev_ioctl.h: -------------------------------------------------------------------------------- 1 | #ifndef __DEV_IOCTL_H__ 2 | #define __DEV_IOCTL_H__ 3 | 4 | 5 | #endif 6 | -------------------------------------------------------------------------------- /hal_apollo/smartconfig.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/ssw101b/main/hal_apollo/smartconfig.c -------------------------------------------------------------------------------- /include/linux/average.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,37)) 4 | #include_next 5 | #endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,37)) */ 6 | -------------------------------------------------------------------------------- /hal_apollo/bh_spi.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef SSTAR_APOLLO_BH_USB_H 3 | #define SSTAR_APOLLO_BH_USB_H 4 | 5 | 6 | #define USB_BLOCK_SIZE (512) 7 | #define RX_BUFFER_SIZE 4000 8 | #define TX_BUFFER_SIZE 1680 9 | 10 | 11 | #endif//SSTAR_APOLLO_BH_USB_H -------------------------------------------------------------------------------- /hal_apollo/test.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main() 4 | { 5 | int i=1; 6 | int num=0; 7 | while(1){ 8 | if (i==1){ 9 | continue; 10 | } 11 | num++; 12 | printf("num=%d",num); 13 | } 14 | printf("hhh\n"); 15 | } 16 | -------------------------------------------------------------------------------- /include/linux/compat-3.10.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_3_10_COMPAT_H 2 | #define LINUX_3_10_COMPAT_H 3 | 4 | #include 5 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)) 6 | #define prandom_u32 random32 7 | #endif /* LINUX_3_10_COMPAT_H */ 8 | #endif 9 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/driver-trace.c: -------------------------------------------------------------------------------- 1 | /* bug in tracepoint.h, it should include this */ 2 | #include 3 | 4 | /* sparse isn't too happy with all macros... */ 5 | #ifndef __CHECKER__ 6 | #include "driver-ops.h" 7 | #define CREATE_TRACE_POINTS 8 | #include "driver-trace.h" 9 | #endif 10 | -------------------------------------------------------------------------------- /include/linux/math64.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMPAT_LINUX_MATH64_H 2 | #define _COMPAT_LINUX_MATH64_H 1 3 | 4 | #include 5 | 6 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25)) 7 | #include_next 8 | #endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25)) */ 9 | 10 | #endif /* _COMPAT_LINUX_MATH64_H */ 11 | -------------------------------------------------------------------------------- /include/linux/tracepoint.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMPAT_LINUX_TRACEPOINT_H 2 | #define _COMPAT_LINUX_TRACEPOINT_H 1 3 | 4 | #include 5 | 6 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) 7 | #include_next 8 | #endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) */ 9 | 10 | #endif /* _COMPAT_LINUX_TRACEPOINT_H */ 11 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/wext_cfg.h: -------------------------------------------------------------------------------- 1 | #ifndef __WEXT_CFG_H__ 2 | #define __WEXT_CFG_H__ 3 | 4 | /* 5 | start return 1 6 | stop return 0 7 | */ 8 | int ETF_Test_is_Start(void); 9 | void ETF_Test_Init(void); 10 | 11 | void register_wext_common(struct ieee80211_local *local); 12 | 13 | extern struct iw_handler_def Sstar_handlers_def; 14 | 15 | #endif /*__WEXT_CFG_H__*/ 16 | 17 | -------------------------------------------------------------------------------- /hal_apollo/module_fs.h: -------------------------------------------------------------------------------- 1 | #ifndef __MODULE_FS_H__ 2 | #define __MODULE_FS_H__ 3 | #include 4 | #include "mac80211/ieee80211_i.h" 5 | extern int Sstar_module_attribute_init(void); 6 | extern void Sstar_module_attribute_exit(void); 7 | struct Sstar_module_scan_node{ 8 | struct ieee80211_internal_scan_sta sta; 9 | struct hlist_node hnode; 10 | }; 11 | #endif 12 | -------------------------------------------------------------------------------- /include/linux/compat-2.6.14.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_26_14_COMPAT_H 2 | #define LINUX_26_14_COMPAT_H 3 | 4 | #include 5 | 6 | /* Compat work for 2.6.14 */ 7 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)) 8 | 9 | typedef unsigned int gfp_t; 10 | 11 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)) */ 12 | 13 | #endif /* LINUX_26_14_COMPAT_H */ 14 | -------------------------------------------------------------------------------- /include/linux/printk.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMPAT_LINUX_PRINTK_H 2 | #define _COMPAT_LINUX_PRINTK_H 1 3 | 4 | #include 5 | 6 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36)) 7 | #include_next 8 | #else 9 | #include 10 | #endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,35)) */ 11 | 12 | #endif /* _COMPAT_LINUX_PRINTK_H */ 13 | -------------------------------------------------------------------------------- /include/linux/pm_qos.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMPAT_LINUX_PM_QOS_H 2 | #define _COMPAT_LINUX_PM_QOS_H 1 3 | 4 | #include 5 | 6 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) 7 | #include_next 8 | #else 9 | #include 10 | #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) */ 11 | 12 | #endif /* _COMPAT_LINUX_PM_QOS_H */ 13 | -------------------------------------------------------------------------------- /include/linux/semaphore.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMPAT_LINUX_SEMAPHORE_H 2 | #define _COMPAT_LINUX_SEMAPHORE_H 1 3 | 4 | #include 5 | 6 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25)) 7 | #include_next 8 | #else 9 | #include 10 | #endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25)) */ 11 | 12 | #endif /* _COMPAT_LINUX_SEMAPHORE_H */ 13 | -------------------------------------------------------------------------------- /include/linux/compat-2.6.18.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_26_18_COMPAT_H 2 | #define LINUX_26_18_COMPAT_H 3 | 4 | #include 5 | 6 | /* Compat work for 2.6.18 */ 7 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)) 8 | 9 | #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) 10 | 11 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)) */ 12 | 13 | #endif /* LINUX_26_18_COMPAT_H */ 14 | -------------------------------------------------------------------------------- /include/linux/pm_runtime.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifndef __COMPAT_LINUX_PM_RUNTIME_H 4 | #define __COMPAT_LINUX_PM_RUNTIME_H 5 | 6 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) 7 | #include_next 8 | #else 9 | 10 | static inline void pm_runtime_enable(struct device *dev) {} 11 | 12 | #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) */ 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /include/linux/of.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMPAT_LINUX_OF_H 2 | #define _COMPAT_LINUX_OF_H 1 3 | 4 | #include 5 | 6 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) 7 | #include_next 8 | #else 9 | 10 | #ifdef CONFIG_OF 11 | #include_next 12 | #endif /* CONFIG_OF */ 13 | 14 | #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) */ 15 | 16 | #endif /* _COMPAT_LINUX_OF_H */ 17 | -------------------------------------------------------------------------------- /include/linux/export.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMPAT_LINUX_EXPORT_H 2 | #define _COMPAT_LINUX_EXPORT_H 1 3 | 4 | #include 5 | 6 | //#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) 7 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,86)) 8 | #include_next 9 | #else 10 | #include 11 | #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) */ 12 | 13 | #endif /* _COMPAT_LINUX_EXPORT_H */ 14 | -------------------------------------------------------------------------------- /hal_apollo/Sstar_p2p.h: -------------------------------------------------------------------------------- 1 | #ifndef _SSTAR_P2P_H_ 2 | #define _SSTAR_P2P_H_ 3 | int TxRxPublicActionFrame(u8 *pframe ,u32 len,int bTx); 4 | 5 | #ifdef SSTAR_P2P_CHANGE 6 | void Sstar_parase_p2p_scan_resp(struct Sstar_vif *priv,struct sk_buff *skb); 7 | bool Sstar_parase_p2p_action_frame(struct Sstar_vif *priv,struct sk_buff *skb,bool tx); 8 | bool Sstar_parase_p2p_mgmt_frame(struct Sstar_vif *priv,struct sk_buff *skb,bool tx); 9 | #endif 10 | 11 | #endif //_SSTAR_P2P_H_ 12 | 13 | -------------------------------------------------------------------------------- /include/linux/compat-2.6.21.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_26_21_COMPAT_H 2 | #define LINUX_26_21_COMPAT_H 3 | 4 | #include 5 | 6 | /* Compat work for 2.6.21 */ 7 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) 8 | 9 | #include 10 | 11 | #define register_sysctl_table(table) \ 12 | ({ \ 13 | register_sysctl_table((table), 0); \ 14 | }) 15 | 16 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) */ 17 | 18 | #endif /* LINUX_26_21_COMPAT_H */ 19 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/debugfs_sta.h: -------------------------------------------------------------------------------- 1 | #ifndef __MAC80211_DEBUGFS_STA_H 2 | #define __MAC80211_DEBUGFS_STA_H 3 | 4 | #include "sta_info.h" 5 | 6 | #ifdef CONFIG_MAC80211_SSTAR_DEBUGFS 7 | void ieee80211_sta_debugfs_add(struct sta_info *sta); 8 | void ieee80211_sta_debugfs_remove(struct sta_info *sta); 9 | #else 10 | static inline void ieee80211_sta_debugfs_add(struct sta_info *sta) {} 11 | static inline void ieee80211_sta_debugfs_remove(struct sta_info *sta) {} 12 | #endif 13 | 14 | #endif /* __MAC80211_DEBUGFS_STA_H */ 15 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/debugfs.h: -------------------------------------------------------------------------------- 1 | #ifndef __MAC80211_DEBUGFS_H 2 | #define __MAC80211_DEBUGFS_H 3 | 4 | #ifdef CONFIG_MAC80211_SSTAR_DEBUGFS 5 | extern void debugfs_hw_add(struct ieee80211_local *local); 6 | extern int mac80211_open_file_generic(struct inode *inode, struct file *file); 7 | extern int mac80211_format_buffer(char __user *userbuf, size_t count, 8 | loff_t *ppos, char *fmt, ...); 9 | #else 10 | static inline void debugfs_hw_add(struct ieee80211_local *local) 11 | { 12 | } 13 | #endif 14 | 15 | #endif /* __MAC80211_DEBUGFS_H */ 16 | -------------------------------------------------------------------------------- /include/linux/compat-3.3.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_3_3_COMPAT_H 2 | #define LINUX_3_3_COMPAT_H 3 | 4 | #include 5 | 6 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) 7 | 8 | /* include to override NL80211_FEATURE_SK_TX_STATUS */ 9 | #include 10 | 11 | static inline void skb_complete_wifi_ack(struct sk_buff *skb, bool acked) 12 | { 13 | WARN_ON(1); 14 | } 15 | #define NL80211_FEATURE_SK_TX_STATUS 0 16 | 17 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) */ 18 | 19 | #endif /* LINUX_3_3_COMPAT_H */ 20 | -------------------------------------------------------------------------------- /hal_apollo/bh_usb.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef SSTAR_APOLLO_BH_USB_H 3 | #define SSTAR_APOLLO_BH_USB_H 4 | 5 | 6 | #define USB_BLOCK_SIZE (512) 7 | #ifdef CONFIG_USB_AGGR_URB_TX 8 | #define RX_BUFFER_SIZE 12*1024 9 | #else 10 | #define RX_BUFFER_SIZE 4000//(1024*4-100) 11 | #endif 12 | #define RX_LONG_BUFFER_SIZE 4000 13 | 14 | #define TX_LONG_BUFFER_SIZE (1024*4) 15 | #ifdef CONFIG_USE_DMA_ADDR_BUFFER 16 | #define TX_BUFFER_SIZE 2048 17 | #else 18 | #define TX_BUFFER_SIZE 1680 19 | #endif //CONFIG_USE_DMA_ADDR_BUFFER 20 | 21 | #endif//SSTAR_APOLLO_BH_USB_H 22 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * mac80211 configuration hooks for cfg80211 3 | */ 4 | #ifndef __CFG_H 5 | #define __CFG_H 6 | 7 | extern struct cfg80211_ops mac80211_config_ops; 8 | int ieee80211_start_pending_roc_work(struct ieee80211_local *local, 9 | struct net_device *dev, 10 | struct ieee80211_sub_if_data *sdata, 11 | struct ieee80211_channel *channel, 12 | enum nl80211_channel_type channel_type, 13 | unsigned int duration, u64 *cookie, 14 | struct sk_buff *txskb); 15 | 16 | #endif /* __CFG_H */ 17 | -------------------------------------------------------------------------------- /include/crypto/aes.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMPAT_CRYPTO_AES_H 2 | #define _COMPAT_CRYPTO_AES_H 3 | 4 | #include 5 | 6 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,24)) 7 | #include_next 8 | #else 9 | 10 | #define AES_MIN_KEY_SIZE 16 11 | #define AES_MAX_KEY_SIZE 32 12 | #define AES_KEYSIZE_128 16 13 | #define AES_KEYSIZE_192 24 14 | #define AES_KEYSIZE_256 32 15 | #define AES_BLOCK_SIZE 16 16 | #define AES_MAX_KEYLENGTH (15 * 16) 17 | #define AES_MAX_KEYLENGTH_U32 (AES_MAX_KEYLENGTH / sizeof(u32)) 18 | 19 | #endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,24)) */ 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /include/linux/compat-2.6.19.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_26_19_COMPAT_H 2 | #define LINUX_26_19_COMPAT_H 3 | 4 | #include 5 | 6 | /* Compat work for 2.6.19 */ 7 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)) 8 | 9 | #include 10 | 11 | static inline int 12 | compat_kmem_cache_destroy(struct kmem_cache *cachep) 13 | { 14 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) 15 | return kmem_cache_destroy(cachep); 16 | #else 17 | kmem_cache_destroy(cachep); 18 | return 0; 19 | #endif 20 | } 21 | 22 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) */ 23 | 24 | #endif /* LINUX_26_19_COMPAT_H */ 25 | -------------------------------------------------------------------------------- /include/linux/compat-2.6.20.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_26_20_COMPAT_H 2 | #define LINUX_26_20_COMPAT_H 3 | 4 | #include 5 | 6 | /* Compat work for 2.6.20 */ 7 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) 8 | 9 | #include 10 | 11 | typedef void (*work_func_t)(struct work_struct *work); 12 | typedef void (*compat_work_func_t)(void *work); 13 | static inline void (INIT_WORK)(struct work_struct *work, work_func_t func) 14 | { 15 | INIT_WORK(work, (compat_work_func_t)func, work); 16 | } 17 | #undef INIT_WORK 18 | 19 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) */ 20 | 21 | #endif /* LINUX_26_20_COMPAT_H */ 22 | -------------------------------------------------------------------------------- /include/linux/rfkill.h: -------------------------------------------------------------------------------- 1 | #ifndef __COMPAT_RFKILL_H 2 | #define __COMPAT_RFKILL_H 3 | 4 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)) 5 | 6 | #include_next 7 | 8 | #else 9 | 10 | #include 11 | 12 | #undef CONFIG_RFKILL 13 | #undef CONFIG_RFKILL_INPUT 14 | #undef CONFIG_RFKILL_LEDS 15 | 16 | #ifdef CONFIG_RFKILL_BACKPORT 17 | #define CONFIG_RFKILL 1 18 | #endif 19 | 20 | #ifdef CONFIG_RFKILL_BACKPORT_INPUT 21 | #define CONFIG_RFKILL_INPUT 22 | #endif 23 | 24 | #ifdef CONFIG_RFKILL_BACKPORT_LEDS 25 | #define CONFIG_RFKILL_LEDS 26 | #endif 27 | 28 | #include 29 | 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/aes_cmac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008, Jouni Malinen 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 2 as 6 | * published by the Free Software Foundation. 7 | */ 8 | 9 | #ifndef AES_CMAC_H 10 | #define AES_CMAC_H 11 | 12 | #include 13 | 14 | struct crypto_cipher * ieee80211_aes_cmac_key_setup(const u8 key[]); 15 | void ieee80211_aes_cmac(struct crypto_cipher *tfm, const u8 *aad, 16 | const u8 *data, size_t data_len, u8 *mic); 17 | void ieee80211_aes_cmac_key_free(struct crypto_cipher *tfm); 18 | 19 | #endif /* AES_CMAC_H */ 20 | -------------------------------------------------------------------------------- /hal_apollo/dcxo_dpll.h: -------------------------------------------------------------------------------- 1 | #include "apollo.h" 2 | #include "hwio.h" 3 | #include "fwio.h" 4 | #include "bh.h" 5 | #include "apollo_plat.h" 6 | int Sstar_config_dpll(struct Sstar_common *hw_priv,char* value,int prjType,int dpllClock); 7 | int Sstar_config_dcxo(struct Sstar_common *hw_priv,char *value,int prjType,int dcxoType,int dpllClock); 8 | int Sstar_wait_wlan_rdy(struct Sstar_common *hw_priv); 9 | int Sstar_system_done(struct Sstar_common *hw_priv); 10 | int Sstar_config_jtag_mode(struct Sstar_common *hw_priv); 11 | void Sstar_set_config_to_smu_apolloC(struct Sstar_common *hw_priv,int dpllClock); 12 | void Sstar_set_config_to_smu_apolloB(struct Sstar_common *hw_priv,int dpllClock); 13 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/michael.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Michael MIC implementation - optimized for TKIP MIC operations 3 | * Copyright 2002-2003, Instant802 Networks, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | */ 9 | 10 | #ifndef MICHAEL_H 11 | #define MICHAEL_H 12 | 13 | #include 14 | 15 | #define MICHAEL_MIC_LEN 8 16 | 17 | struct michael_mic_ctx { 18 | u32 l, r; 19 | }; 20 | 21 | void michael_mic(const u8 *key, struct ieee80211_hdr *hdr, 22 | const u8 *data, size_t data_len, u8 *mic); 23 | 24 | #endif /* MICHAEL_H */ 25 | -------------------------------------------------------------------------------- /include/linux/compat-4.9.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_4_9_COMPAT_H 2 | #define LINUX_4_9_COMPAT_H 3 | 4 | #include 5 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,9,0)) 6 | #define SSTAR_IEEE80211_BAND_5GHZ IEEE80211_BAND_5GHZ 7 | #define SSTAR_IEEE80211_BAND_2GHZ IEEE80211_BAND_2GHZ 8 | #define SSTAR_IEEE80211_NUM_BANDS IEEE80211_NUM_BANDS 9 | #define Sstar_ieee80211_band ieee80211_band 10 | #else 11 | 12 | #define SSTAR_IEEE80211_BAND_5GHZ NL80211_BAND_5GHZ 13 | #define SSTAR_IEEE80211_BAND_2GHZ NL80211_BAND_2GHZ 14 | #define SSTAR_IEEE80211_NUM_BANDS NUM_NL80211_BANDS 15 | #define Sstar_ieee80211_band nl80211_band 16 | #endif //(LINUX_VERSION_CODE < KERNEL_VERSION(4,9,0)) 17 | #endif/* LINUX_4_9_COMPAT_H */ -------------------------------------------------------------------------------- /hal_apollo/mac80211/wapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Software WAPI encryption implementation 3 | * Copyright (c) 2011, sigmastar 4 | * Author: Janusz Dziedzic 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 2 as 8 | * published by the Free Software Foundation. 9 | */ 10 | 11 | #ifndef WAPI_H 12 | #define WAPI_H 13 | 14 | #include 15 | #include 16 | #include "ieee80211_i.h" 17 | #include "key.h" 18 | 19 | #ifndef ETH_P_WAPI 20 | #define ETH_P_WAPI 0x88B4 21 | #endif 22 | 23 | 24 | ieee80211_rx_result 25 | ieee80211_crypto_wapi_decrypt(struct ieee80211_rx_data *rx); 26 | 27 | #endif /* WAPI_H */ 28 | -------------------------------------------------------------------------------- /include/linux/compat-3.1.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_3_1_COMPAT_H 2 | #define LINUX_3_1_COMPAT_H 3 | 4 | #include 5 | 6 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) 7 | 8 | #define genl_dump_check_consistent(cb, user_hdr, family) 9 | 10 | #define IFF_TX_SKB_SHARING 0x10000 /* The interface supports sharing 11 | * skbs on transmit */ 12 | 13 | #define PCMCIA_DEVICE_MANF_CARD_PROD_ID3(manf, card, v3, vh3) { \ 14 | .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \ 15 | PCMCIA_DEV_ID_MATCH_CARD_ID| \ 16 | PCMCIA_DEV_ID_MATCH_PROD_ID3, \ 17 | .manf_id = (manf), \ 18 | .card_id = (card), \ 19 | .prod_id = { NULL, NULL, (v3), NULL }, \ 20 | .prod_id_hash = { 0, 0, (vh3), 0 }, } 21 | 22 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) */ 23 | 24 | #endif /* LINUX_3_1_COMPAT_H */ 25 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/debugfs_netdev.h: -------------------------------------------------------------------------------- 1 | /* routines exported for debugfs handling */ 2 | 3 | #ifndef __IEEE80211_DEBUGFS_NETDEV_H 4 | #define __IEEE80211_DEBUGFS_NETDEV_H 5 | 6 | #ifdef CONFIG_MAC80211_SSTAR_DEBUGFS 7 | void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata); 8 | void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata); 9 | void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata); 10 | #else 11 | static inline void ieee80211_debugfs_add_netdev( 12 | struct ieee80211_sub_if_data *sdata) 13 | {} 14 | static inline void ieee80211_debugfs_remove_netdev( 15 | struct ieee80211_sub_if_data *sdata) 16 | {} 17 | static inline void ieee80211_debugfs_rename_netdev( 18 | struct ieee80211_sub_if_data *sdata) 19 | {} 20 | #endif 21 | 22 | #endif /* __IEEE80211_DEBUGFS_NETDEV_H */ 23 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/wme.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004, Instant802 Networks, Inc. 3 | * Copyright 2005, Devicescape Software, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | */ 9 | 10 | #ifndef _WME_H 11 | #define _WME_H 12 | 13 | #include 14 | #include "ieee80211_i.h" 15 | 16 | extern const int ieee802_1d_to_ac[8]; 17 | 18 | u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, 19 | struct sk_buff *skb); 20 | void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata, 21 | struct sk_buff *skb); 22 | u16 ieee80211_downgrade_queue(struct ieee80211_local *local, 23 | struct sk_buff *skb); 24 | 25 | 26 | #endif /* _WME_H */ 27 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/mac80211_bridge.h: -------------------------------------------------------------------------------- 1 | #ifndef _MAC80211_BR_H_ 2 | #define _MAC80211_BR_H_ 3 | 4 | #define WLAN_ETHHDR_LEN 14 5 | #define NETDEV_HWADDR(sdata) ((sdata)->dev->dev_addr) 6 | #define NET_BR0_AGEING_TIME 120 7 | 8 | 9 | 10 | void ieee80211_brigde_flush(struct ieee80211_sub_if_data *sdata); 11 | int ieee80211_brigde_change_rxhdr(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb); 12 | int ieee80211_brigde_change_txhdr(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb); 13 | struct ieee80211_sub_if_data *ieee80211_brigde_sdata_check(struct ieee80211_local *local,struct sk_buff *skb,struct ieee80211_sub_if_data *source_sdata); 14 | 15 | void br0_netdev_open(struct net_device *netdev); 16 | int br0_attach(struct ieee80211_sub_if_data *sdata); 17 | void br0_detach(struct ieee80211_sub_if_data *sdata); 18 | 19 | #endif // _MAC80211_BR_H_ 20 | 21 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/aes_ccm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003-2004, Instant802 Networks, Inc. 3 | * Copyright 2006, Devicescape Software, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | */ 9 | 10 | #ifndef AES_CCM_H 11 | #define AES_CCM_H 12 | 13 | #include 14 | 15 | struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[]); 16 | void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch, 17 | u8 *data, size_t data_len, 18 | u8 *cdata, u8 *mic); 19 | int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch, 20 | u8 *cdata, size_t data_len, 21 | u8 *mic, u8 *data); 22 | void ieee80211_aes_key_free(struct crypto_cipher *tfm); 23 | 24 | #endif /* AES_CCM_H */ 25 | -------------------------------------------------------------------------------- /include/linux/unaligned/be_struct.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_UNALIGNED_BE_STRUCT_H 2 | #define _LINUX_UNALIGNED_BE_STRUCT_H 3 | 4 | #include 5 | 6 | static inline u16 get_unaligned_be16(const void *p) 7 | { 8 | return __get_unaligned_cpu16((const u8 *)p); 9 | } 10 | 11 | static inline u32 get_unaligned_be32(const void *p) 12 | { 13 | return __get_unaligned_cpu32((const u8 *)p); 14 | } 15 | 16 | static inline u64 get_unaligned_be64(const void *p) 17 | { 18 | return __get_unaligned_cpu64((const u8 *)p); 19 | } 20 | 21 | static inline void put_unaligned_be16(u16 val, void *p) 22 | { 23 | __put_unaligned_cpu16(val, p); 24 | } 25 | 26 | static inline void put_unaligned_be32(u32 val, void *p) 27 | { 28 | __put_unaligned_cpu32(val, p); 29 | } 30 | 31 | static inline void put_unaligned_be64(u64 val, void *p) 32 | { 33 | __put_unaligned_cpu64(val, p); 34 | } 35 | 36 | #endif /* _LINUX_UNALIGNED_BE_STRUCT_H */ 37 | -------------------------------------------------------------------------------- /include/linux/unaligned/le_struct.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_UNALIGNED_LE_STRUCT_H 2 | #define _LINUX_UNALIGNED_LE_STRUCT_H 3 | 4 | #include 5 | 6 | static inline u16 get_unaligned_le16(const void *p) 7 | { 8 | return __get_unaligned_cpu16((const u8 *)p); 9 | } 10 | 11 | static inline u32 get_unaligned_le32(const void *p) 12 | { 13 | return __get_unaligned_cpu32((const u8 *)p); 14 | } 15 | 16 | static inline u64 get_unaligned_le64(const void *p) 17 | { 18 | return __get_unaligned_cpu64((const u8 *)p); 19 | } 20 | 21 | static inline void put_unaligned_le16(u16 val, void *p) 22 | { 23 | __put_unaligned_cpu16(val, p); 24 | } 25 | 26 | static inline void put_unaligned_le32(u32 val, void *p) 27 | { 28 | __put_unaligned_cpu32(val, p); 29 | } 30 | 31 | static inline void put_unaligned_le64(u64 val, void *p) 32 | { 33 | __put_unaligned_cpu64(val, p); 34 | } 35 | 36 | #endif /* _LINUX_UNALIGNED_LE_STRUCT_H */ 37 | -------------------------------------------------------------------------------- /include/linux/unaligned/be_memmove.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_UNALIGNED_BE_MEMMOVE_H 2 | #define _LINUX_UNALIGNED_BE_MEMMOVE_H 3 | 4 | #include 5 | 6 | static inline u16 get_unaligned_be16(const void *p) 7 | { 8 | return __get_unaligned_memmove16((const u8 *)p); 9 | } 10 | 11 | static inline u32 get_unaligned_be32(const void *p) 12 | { 13 | return __get_unaligned_memmove32((const u8 *)p); 14 | } 15 | 16 | static inline u64 get_unaligned_be64(const void *p) 17 | { 18 | return __get_unaligned_memmove64((const u8 *)p); 19 | } 20 | 21 | static inline void put_unaligned_be16(u16 val, void *p) 22 | { 23 | __put_unaligned_memmove16(val, p); 24 | } 25 | 26 | static inline void put_unaligned_be32(u32 val, void *p) 27 | { 28 | __put_unaligned_memmove32(val, p); 29 | } 30 | 31 | static inline void put_unaligned_be64(u64 val, void *p) 32 | { 33 | __put_unaligned_memmove64(val, p); 34 | } 35 | 36 | #endif /* _LINUX_UNALIGNED_LE_MEMMOVE_H */ 37 | -------------------------------------------------------------------------------- /include/linux/unaligned/le_memmove.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_UNALIGNED_LE_MEMMOVE_H 2 | #define _LINUX_UNALIGNED_LE_MEMMOVE_H 3 | 4 | #include 5 | 6 | static inline u16 get_unaligned_le16(const void *p) 7 | { 8 | return __get_unaligned_memmove16((const u8 *)p); 9 | } 10 | 11 | static inline u32 get_unaligned_le32(const void *p) 12 | { 13 | return __get_unaligned_memmove32((const u8 *)p); 14 | } 15 | 16 | static inline u64 get_unaligned_le64(const void *p) 17 | { 18 | return __get_unaligned_memmove64((const u8 *)p); 19 | } 20 | 21 | static inline void put_unaligned_le16(u16 val, void *p) 22 | { 23 | __put_unaligned_memmove16(val, p); 24 | } 25 | 26 | static inline void put_unaligned_le32(u32 val, void *p) 27 | { 28 | __put_unaligned_memmove32(val, p); 29 | } 30 | 31 | static inline void put_unaligned_le64(u64 val, void *p) 32 | { 33 | __put_unaligned_memmove64(val, p); 34 | } 35 | 36 | #endif /* _LINUX_UNALIGNED_LE_MEMMOVE_H */ 37 | -------------------------------------------------------------------------------- /include/linux/unaligned/memmove.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_UNALIGNED_MEMMOVE_H 2 | #define _LINUX_UNALIGNED_MEMMOVE_H 3 | 4 | #include 5 | #include 6 | 7 | /* Use memmove here, so gcc does not insert a __builtin_memcpy. */ 8 | 9 | static inline u16 __get_unaligned_memmove16(const void *p) 10 | { 11 | u16 tmp; 12 | memmove(&tmp, p, 2); 13 | return tmp; 14 | } 15 | 16 | static inline u32 __get_unaligned_memmove32(const void *p) 17 | { 18 | u32 tmp; 19 | memmove(&tmp, p, 4); 20 | return tmp; 21 | } 22 | 23 | static inline u64 __get_unaligned_memmove64(const void *p) 24 | { 25 | u64 tmp; 26 | memmove(&tmp, p, 8); 27 | return tmp; 28 | } 29 | 30 | static inline void __put_unaligned_memmove16(u16 val, void *p) 31 | { 32 | memmove(p, &val, 2); 33 | } 34 | 35 | static inline void __put_unaligned_memmove32(u32 val, void *p) 36 | { 37 | memmove(p, &val, 4); 38 | } 39 | 40 | static inline void __put_unaligned_memmove64(u64 val, void *p) 41 | { 42 | memmove(p, &val, 8); 43 | } 44 | 45 | #endif /* _LINUX_UNALIGNED_MEMMOVE_H */ 46 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/tkip.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2004, Instant802 Networks, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 2 as 6 | * published by the Free Software Foundation. 7 | */ 8 | 9 | #ifndef TKIP_H 10 | #define TKIP_H 11 | 12 | #include 13 | #include 14 | #include "key.h" 15 | 16 | u8 *ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key *key); 17 | 18 | int ieee80211_tkip_encrypt_data(struct crypto_cipher *tfm, 19 | struct ieee80211_key *key, 20 | struct sk_buff *skb, 21 | u8 *payload, size_t payload_len); 22 | 23 | enum { 24 | TKIP_DECRYPT_OK = 0, 25 | TKIP_DECRYPT_NO_EXT_IV = -1, 26 | TKIP_DECRYPT_INVALID_KEYIDX = -2, 27 | TKIP_DECRYPT_REPLAY = -3, 28 | }; 29 | int ieee80211_tkip_decrypt_data(struct crypto_cipher *tfm, 30 | struct ieee80211_key *key, 31 | u8 *payload, size_t payload_len, u8 *ta, 32 | u8 *ra, int only_iv, int queue, 33 | u32 *out_iv32, u16 *out_iv16); 34 | 35 | #endif /* TKIP_H */ 36 | -------------------------------------------------------------------------------- /include/linux/compat-2.6.30.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_26_30_COMPAT_H 2 | #define LINUX_26_30_COMPAT_H 3 | 4 | #include 5 | 6 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)) 7 | 8 | #include 9 | 10 | #ifndef TP_PROTO 11 | #define TP_PROTO(args...) TPPROTO(args) 12 | #endif 13 | #ifndef TP_ARGS 14 | #define TP_ARGS(args...) TPARGS(args) 15 | #endif 16 | 17 | #define IRQ_WAKE_THREAD (2) 18 | 19 | /* From : include/linux/pm.h */ 20 | /* How to reorder dpm_list after device_move() */ 21 | enum dpm_order { 22 | DPM_ORDER_NONE, 23 | DPM_ORDER_DEV_AFTER_PARENT, 24 | DPM_ORDER_PARENT_BEFORE_DEV, 25 | DPM_ORDER_DEV_LAST, 26 | }; 27 | 28 | static inline void dev_set_uevent_suppress(struct device *dev, int val) 29 | { 30 | dev->uevent_suppress = val; 31 | } 32 | 33 | /* 34 | * Print a one-time message (analogous to WARN_ONCE() et al): 35 | */ 36 | #define printk_once(x...) ({ \ 37 | static bool __print_once; \ 38 | \ 39 | if (!__print_once) { \ 40 | __print_once = true; \ 41 | printk(x); \ 42 | } \ 43 | }) 44 | 45 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)) */ 46 | 47 | #endif /* LINUX_26_30_COMPAT_H */ 48 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/wpa.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2004, Instant802 Networks, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 2 as 6 | * published by the Free Software Foundation. 7 | */ 8 | 9 | #ifndef WPA_H 10 | #define WPA_H 11 | 12 | #include 13 | #include 14 | #include "ieee80211_i.h" 15 | 16 | ieee80211_tx_result 17 | ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx); 18 | ieee80211_rx_result 19 | ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx); 20 | 21 | ieee80211_tx_result 22 | ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx); 23 | ieee80211_rx_result 24 | ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx); 25 | 26 | ieee80211_tx_result 27 | ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx); 28 | ieee80211_rx_result 29 | ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx); 30 | 31 | ieee80211_tx_result 32 | ieee80211_crypto_aes_cmac_encrypt(struct ieee80211_tx_data *tx); 33 | ieee80211_rx_result 34 | ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx); 35 | 36 | #endif /* WPA_H */ 37 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/event.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 Johannes Berg 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 2 as 6 | * published by the Free Software Foundation. 7 | * 8 | * mac80211 - events 9 | */ 10 | #include 11 | #include "ieee80211_i.h" 12 | 13 | /* 14 | * Indicate a failed Michael MIC to userspace. If the caller knows the TSC of 15 | * the frame that generated the MIC failure (i.e., if it was provided by the 16 | * driver or is still in the frame), it should provide that information. 17 | */ 18 | void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx, 19 | struct ieee80211_hdr *hdr, const u8 *tsc, 20 | gfp_t gfp) 21 | { 22 | #ifndef SSTAR_PRIVATE_IE 23 | cfg80211_michael_mic_failure(sdata->dev, hdr->addr2, 24 | (hdr->addr1[0] & 0x01) ? 25 | NL80211_KEYTYPE_GROUP : 26 | NL80211_KEYTYPE_PAIRWISE, 27 | keyidx, tsc, gfp); 28 | #else 29 | #pragma message "IPC not support mic failure" 30 | Sstar_printk_err( "%s:IPC not support mic failure\n",__func__); 31 | #endif 32 | } 33 | -------------------------------------------------------------------------------- /include/linux/atomic.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMPAT_LINUX_ATOMIC_H 2 | #define _COMPAT_LINUX_ATOMIC_H 1 3 | 4 | #include 5 | 6 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36)) 7 | #include_next 8 | #else 9 | 10 | #include 11 | 12 | /** 13 | * atomic_inc_not_zero_hint - increment if not null 14 | * @v: pointer of type atomic_t 15 | * @hint: probable value of the atomic before the increment 16 | * 17 | * This version of atomic_inc_not_zero() gives a hint of probable 18 | * value of the atomic. This helps processor to not read the memory 19 | * before doing the atomic read/modify/write cycle, lowering 20 | * number of bus transactions on some arches. 21 | * 22 | * Returns: 0 if increment was not done, 1 otherwise. 23 | */ 24 | #ifndef atomic_inc_not_zero_hint 25 | static inline int atomic_inc_not_zero_hint(atomic_t *v, int hint) 26 | { 27 | int val, c = hint; 28 | 29 | /* sanity test, should be removed by compiler if hint is a constant */ 30 | if (!hint) 31 | return atomic_inc_not_zero(v); 32 | 33 | do { 34 | val = atomic_cmpxchg(v, c, c + 1); 35 | if (val == c) 36 | return 1; 37 | c = val; 38 | } while (c); 39 | 40 | return 0; 41 | } 42 | #endif 43 | 44 | #endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36)) */ 45 | 46 | #endif /* _COMPAT_LINUX_ATOMIC_H */ 47 | -------------------------------------------------------------------------------- /include/linux/compat-3.8.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_3_8_COMPAT_H 2 | #define LINUX_3_8_COMPAT_H 3 | 4 | #include 5 | //#include 6 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) 7 | #define led_brightness_set led_set_brightness 8 | #if 0 9 | /** 10 | * struct genl_info - receiving information 11 | * @snd_seq: sending sequence number 12 | * @snd_portid: netlink portid of sender 13 | * @nlhdr: netlink message header 14 | * @genlhdr: generic netlink message header 15 | * @userhdr: user specific header 16 | * @attrs: netlink attributes 17 | * @_net: network namespace 18 | * @user_ptr: user pointers 19 | */ 20 | #include 21 | //#define genl_info Sstar_genl_info 22 | struct Sstar_genl_info{ 23 | struct genl_info *info; 24 | u32 snd_seq; 25 | u32 snd_portid; 26 | struct nlmsghdr * nlhdr; 27 | struct genlmsghdr * genlhdr; 28 | void * userhdr; 29 | struct nlattr ** attrs; 30 | #ifdef CONFIG_NET_NS 31 | struct net * _net; 32 | #endif 33 | void * user_ptr[2]; 34 | }; 35 | #define genl_info Sstar_genl_info 36 | //#include 37 | 38 | #endif 39 | #endif /* LINUX_3_8_COMPAT_H */ 40 | #endif 41 | -------------------------------------------------------------------------------- /include/linux/unaligned/packed_struct.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_UNALIGNED_PACKED_STRUCT_H 2 | #define _LINUX_UNALIGNED_PACKED_STRUCT_H 3 | 4 | #include 5 | 6 | struct __una_u16 { u16 x __attribute__((packed)); }; 7 | struct __una_u32 { u32 x __attribute__((packed)); }; 8 | struct __una_u64 { u64 x __attribute__((packed)); }; 9 | 10 | static inline u16 __get_unaligned_cpu16(const void *p) 11 | { 12 | const struct __una_u16 *ptr = (const struct __una_u16 *)p; 13 | return ptr->x; 14 | } 15 | 16 | static inline u32 __get_unaligned_cpu32(const void *p) 17 | { 18 | const struct __una_u32 *ptr = (const struct __una_u32 *)p; 19 | return ptr->x; 20 | } 21 | 22 | static inline u64 __get_unaligned_cpu64(const void *p) 23 | { 24 | const struct __una_u64 *ptr = (const struct __una_u64 *)p; 25 | return ptr->x; 26 | } 27 | 28 | static inline void __put_unaligned_cpu16(u16 val, void *p) 29 | { 30 | struct __una_u16 *ptr = (struct __una_u16 *)p; 31 | ptr->x = val; 32 | } 33 | 34 | static inline void __put_unaligned_cpu32(u32 val, void *p) 35 | { 36 | struct __una_u32 *ptr = (struct __una_u32 *)p; 37 | ptr->x = val; 38 | } 39 | 40 | static inline void __put_unaligned_cpu64(u64 val, void *p) 41 | { 42 | struct __una_u64 *ptr = (struct __una_u64 *)p; 43 | ptr->x = val; 44 | } 45 | 46 | #endif /* _LINUX_UNALIGNED_PACKED_STRUCT_H */ 47 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/debugfs_key.h: -------------------------------------------------------------------------------- 1 | #ifndef __MAC80211_DEBUGFS_KEY_H 2 | #define __MAC80211_DEBUGFS_KEY_H 3 | 4 | #ifdef CONFIG_MAC80211_SSTAR_DEBUGFS 5 | void ieee80211_debugfs_key_add(struct ieee80211_key *key); 6 | void ieee80211_debugfs_key_remove(struct ieee80211_key *key); 7 | void ieee80211_debugfs_key_update_default(struct ieee80211_sub_if_data *sdata); 8 | void ieee80211_debugfs_key_add_mgmt_default( 9 | struct ieee80211_sub_if_data *sdata); 10 | void ieee80211_debugfs_key_remove_mgmt_default( 11 | struct ieee80211_sub_if_data *sdata); 12 | void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key, 13 | struct sta_info *sta); 14 | #else 15 | static inline void ieee80211_debugfs_key_add(struct ieee80211_key *key) 16 | {} 17 | static inline void ieee80211_debugfs_key_remove(struct ieee80211_key *key) 18 | {} 19 | static inline void ieee80211_debugfs_key_update_default( 20 | struct ieee80211_sub_if_data *sdata) 21 | {} 22 | static inline void ieee80211_debugfs_key_add_mgmt_default( 23 | struct ieee80211_sub_if_data *sdata) 24 | {} 25 | static inline void ieee80211_debugfs_key_remove_mgmt_default( 26 | struct ieee80211_sub_if_data *sdata) 27 | {} 28 | static inline void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key, 29 | struct sta_info *sta) 30 | {} 31 | #endif 32 | 33 | #endif /* __MAC80211_DEBUGFS_KEY_H */ 34 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/wep.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Software WEP encryption implementation 3 | * Copyright 2002, Jouni Malinen 4 | * Copyright 2003, Instant802 Networks, Inc. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 2 as 8 | * published by the Free Software Foundation. 9 | */ 10 | 11 | #ifndef WEP_H 12 | #define WEP_H 13 | 14 | #include 15 | #include 16 | #include "ieee80211_i.h" 17 | #include "key.h" 18 | 19 | int ieee80211_wep_init(struct ieee80211_local *local); 20 | void ieee80211_wep_free(struct ieee80211_local *local); 21 | int ieee80211_wep_encrypt_data(struct crypto_cipher *tfm, u8 *rc4key, 22 | size_t klen, u8 *data, size_t data_len); 23 | int ieee80211_wep_encrypt(struct ieee80211_local *local, 24 | struct sk_buff *skb, 25 | const u8 *key, int keylen, int keyidx); 26 | int ieee80211_wep_decrypt_data(struct crypto_cipher *tfm, u8 *rc4key, 27 | size_t klen, u8 *data, size_t data_len); 28 | bool ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key); 29 | 30 | ieee80211_rx_result 31 | ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx); 32 | ieee80211_tx_result 33 | ieee80211_crypto_wep_encrypt(struct ieee80211_tx_data *tx); 34 | 35 | #endif /* WEP_H */ 36 | -------------------------------------------------------------------------------- /include/linux/pm_qos_params.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifndef __COMPAT_LINUX_PM_QOS_PARAMS_H 4 | #define __COMPAT_LINUX_PM_QOS_PARAMS_H 5 | 6 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) 7 | #include_next 8 | #else 9 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)) 10 | #include_next 11 | #else 12 | /* interface for the pm_qos_power infrastructure of the linux kernel. 13 | * 14 | * Mark Gross 15 | */ 16 | #include 17 | #include 18 | #include 19 | 20 | #define PM_QOS_RESERVED 0 21 | #define PM_QOS_CPU_DMA_LATENCY 1 22 | #define PM_QOS_NETWORK_LATENCY 2 23 | #define PM_QOS_NETWORK_THROUGHPUT 3 24 | #define PM_QOS_SYSTEM_BUS_FREQ 4 25 | 26 | #define PM_QOS_NUM_CLASSES 5 27 | #define PM_QOS_DEFAULT_VALUE -1 28 | 29 | int pm_qos_add_requirement(int qos, char *name, s32 value); 30 | int pm_qos_update_requirement(int qos, char *name, s32 new_value); 31 | void pm_qos_remove_requirement(int qos, char *name); 32 | 33 | int pm_qos_requirement(int qos); 34 | 35 | int pm_qos_add_notifier(int qos, struct notifier_block *notifier); 36 | int pm_qos_remove_notifier(int qos, struct notifier_block *notifier); 37 | #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)) */ 38 | #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) */ 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /hal_apollo/dbg_event.h: -------------------------------------------------------------------------------- 1 | #ifndef DBG_EVENT_H 2 | #define DBG_EVENT_H 3 | #ifdef DBG_EVENT_LOG 4 | void ELOG_INIT(void); 5 | void ELOG_Add(u8 id,u32 data); 6 | void ELOG_Stop(void); 7 | void ELOG_Start(void); 8 | void ELOG_Show(void); 9 | void ELOG_Clear(void); 10 | #define EELOG_INIT() ELOG_INIT() 11 | #define EELOG_Add( id, data) ELOG_Add( id, data) 12 | #define EELOG_Stop() ELOG_Stop() 13 | #define EELOG_Start() ELOG_Start() 14 | #define EELOG_Show() ELOG_Show() 15 | #define EELOG_Clear() ELOG_Clear() 16 | #else 17 | #define EELOG_INIT() 18 | #define EELOG_Add( id, data) 19 | #define EELOG_Stop() 20 | #define EELOG_Start() 21 | #define EELOG_Show() 22 | #define EELOG_Clear() 23 | #endif 24 | enum{ 25 | USB_RX_EVENT_BASE=0x10, 26 | USB_TX_EVENT_BASE=0x20, 27 | SDIO_RX_EVENT_BASE=0x30, 28 | SDIO_TX_EVENT_BASE=0x40, 29 | USB_HAL_EVENT_BASE=0X50, 30 | USB_MAC80211_EVENT_BASE=0x60, 31 | SDIO_HAL_EVENT_BASE=0X70, 32 | SDIO_MAC80211_EVENT_BASE=0x80 33 | 34 | }; 35 | enum { 36 | USB_BH_RX_EVENT=USB_RX_EVENT_BASE, 37 | USB_BH_RX_EVENT1=USB_RX_EVENT_BASE+1, 38 | USB_BH_RX_EVENT2=USB_RX_EVENT_BASE+2, 39 | USB_BH_RX_EVENT3=USB_RX_EVENT_BASE+3 40 | 41 | }; 42 | enum { 43 | USB_BH_TX_EVENT=USB_TX_EVENT_BASE, 44 | USB_BH_TX_EVENT1=USB_TX_EVENT_BASE+1, 45 | USB_BH_TX_EVENT2=USB_TX_EVENT_BASE+2, 46 | USB_BH_TX_EVENT3=USB_TX_EVENT_BASE+3 47 | 48 | }; 49 | #endif //DBG_EVENT_H 50 | 51 | -------------------------------------------------------------------------------- /hal_apollo/ht.h: -------------------------------------------------------------------------------- 1 | /* 2 | * HT-related code for sigmastar APOLLO driver 3 | * * 4 | * Copyright (c) 2016, sigmastar 5 | * Author: 6 | * 7 | * Based on apollo code 8 | * Copyright (c) 2010, ST-Ericsson 9 | * Author: Dmitry Tarnyagin 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License version 2 as 13 | * published by the Free Software Foundation. 14 | */ 15 | 16 | #ifndef SSTAR_APOLLO_HT_H_INCLUDED 17 | #define SSTAR_APOLLO_HT_H_INCLUDED 18 | 19 | #include 20 | 21 | struct Sstar_ht_info { 22 | struct ieee80211_sta_ht_cap ht_cap; 23 | enum nl80211_channel_type channel_type; 24 | u16 operation_mode; 25 | }; 26 | 27 | static inline int Sstar_is_ht(const struct Sstar_ht_info *ht_info) 28 | { 29 | return ht_info->channel_type != NL80211_CHAN_NO_HT; 30 | } 31 | 32 | static inline int Sstar_ht_greenfield(const struct Sstar_ht_info *ht_info) 33 | { 34 | return Sstar_is_ht(ht_info) && 35 | (ht_info->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD) && 36 | !(ht_info->operation_mode & 37 | IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT); 38 | } 39 | 40 | static inline int Sstar_ht_ampdu_density(const struct Sstar_ht_info *ht_info) 41 | { 42 | if (!Sstar_is_ht(ht_info)) 43 | return 0; 44 | return ht_info->ht_cap.ampdu_density; 45 | } 46 | 47 | #endif /* SSTAR_APOLLO_HT_H_INCLUDED */ 48 | -------------------------------------------------------------------------------- /include/linux/compat-2.6.35.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_26_35_COMPAT_H 2 | #define LINUX_26_35_COMPAT_H 3 | 4 | #include 5 | 6 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)) 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | /* added on linux/kernel.h */ 13 | #define USHRT_MAX ((u16)(~0U)) 14 | #define SHRT_MAX ((s16)(USHRT_MAX>>1)) 15 | #define SHRT_MIN ((s16)(-SHRT_MAX - 1)) 16 | 17 | #define SDIO_BUS_ECSI 0x20 /* Enable continuous SPI interrupt */ 18 | #define SDIO_BUS_SCSI 0x40 /* Support continuous SPI interrupt */ 19 | 20 | #define netdev_hw_addr dev_mc_list 21 | 22 | static inline wait_queue_head_t *sk_sleep(struct sock *sk) 23 | { 24 | return sk->sk_sleep; 25 | } 26 | 27 | #define sdio_writeb_readb(func, write_byte, addr, err_ret) sdio_readb(func, addr, err_ret) 28 | 29 | int hex_to_bin(char ch); 30 | 31 | extern loff_t noop_llseek(struct file *file, loff_t offset, int origin); 32 | 33 | #define pm_qos_request(_qos) pm_qos_requirement(_qos) 34 | 35 | static inline struct usb_host_endpoint * 36 | usb_pipe_endpoint(struct usb_device *dev, unsigned int pipe) 37 | { 38 | struct usb_host_endpoint **eps; 39 | eps = usb_pipein(pipe) ? dev->ep_in : dev->ep_out; 40 | return eps[usb_pipeendpoint(pipe)]; 41 | } 42 | 43 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)) */ 44 | 45 | #endif /* LINUX_26_35_COMPAT_H */ 46 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/ieee80211_Sstar_mem.h: -------------------------------------------------------------------------------- 1 | #ifndef _IEEE80211_SSTAR_MEM_H_ 2 | #define _IEEE80211_SSTAR_MEM_H_ 3 | #if defined (SSTAR_ALLOC_MEM_DEBUG) 4 | extern void *ieee80211_Sstar_kzalloc(size_t s, gfp_t gfp,const char *func); 5 | extern void *ieee80211_Sstar_kmalloc(size_t s, gfp_t gfp,const char *func); 6 | extern void *ieee80211_Sstar_kcalloc(size_t n, size_t size, gfp_t gfp,const char *func); 7 | extern void *ieee80211_Sstar_krealloc(void *p, size_t new_size, gfp_t gfp,const char *func); 8 | extern void ieee80211_Sstar_kfree(void *p); 9 | extern void ieee80211_Sstar_mem_exit(void); 10 | extern void ieee80211_Sstar_mem_int(void); 11 | 12 | 13 | #define Sstar_kzalloc(_s,_gfp) ieee80211_Sstar_kzalloc(_s,_gfp,__func__) 14 | #define Sstar_kmalloc(_s,_gfp) ieee80211_Sstar_kmalloc(_s,_gfp,__func__) 15 | #define Sstar_kcalloc(_n,_size,_gfp) ieee80211_Sstar_kcalloc(_n,_size,_gfp,__func__) 16 | #define Sstar_krealloc(_p,_new_size,_gfp) ieee80211_Sstar_krealloc(_p,_new_size,_gfp,__func__) 17 | #define Sstar_kfree(_p) ieee80211_Sstar_kfree(_p) 18 | #else 19 | #define Sstar_kzalloc(_s,_gfp) kzalloc(_s,_gfp) 20 | #define Sstar_kmalloc(_s,_gfp) kmalloc(_s,_gfp) 21 | #define Sstar_kcalloc(_n,_size,_gfp) kcalloc(_n,_size,_gfp) 22 | #define Sstar_krealloc(_p,_new_size,_gfp) krealloc(_p,_new_size,_gfp) 23 | #define Sstar_kfree(_p) kfree(_p) 24 | #define ieee80211_Sstar_mem_exit() 25 | #define ieee80211_Sstar_mem_int() 26 | #endif 27 | 28 | #endif //_SSTAR_P2P_H_ 29 | 30 | -------------------------------------------------------------------------------- /hal_apollo/fwio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Firmware API for mac80211 sigmastar APOLLO drivers 3 | * * 4 | * Copyright (c) 2016, sigmastar 5 | * Author: 6 | * 7 | * Based on apollo code 8 | * Copyright (c) 2010, ST-Ericsson 9 | * Author: Dmitry Tarnyagin 10 | * 11 | * Based on: 12 | * ST-Ericsson UMAC CW1200 driver which is 13 | * Copyright (c) 2010, ST-Ericsson 14 | * Author: Ajitpal Singh 15 | * 16 | * This program is free software; you can redistribute it and/or modify 17 | * it under the terms of the GNU General Public License version 2 as 18 | * published by the Free Software Foundation. 19 | */ 20 | 21 | #ifndef FWIO_H_INCLUDED 22 | #define FWIO_H_INCLUDED 23 | 24 | #ifndef CONFIG_FW_NAME 25 | #if ((SSTAR_WIFI_PLATFORM == 13/*PLATFORM_AMLOGIC_S805*/) || (SSTAR_WIFI_PLATFORM == 8)) 26 | #define FIRMWARE_DEFAULT_PATH "../wifi/Sstar/fw.bin" 27 | #else // PLATFORM_AMLOGIC_S805 28 | #define FIRMWARE_DEFAULT_PATH "fw.bin" 29 | #endif //PLATFORM_AMLOGIC_S805 30 | #else 31 | #define FIRMWARE_DEFAULT_PATH CONFIG_FW_NAME 32 | #endif 33 | #define SDD_FILE_DEFAULT_PATH ("sdd.bin") 34 | 35 | #define SSTAR_APOLLO_REV_1601 (1601) 36 | 37 | struct Sstar_common; 38 | 39 | 40 | int Sstar_get_hw_type(u32 config_reg_val, int *major_revision); 41 | 42 | int Sstar_load_firmware(struct Sstar_common *hw_priv); 43 | void Sstar_release_firmware(void); 44 | int Sstar_init_firmware(void); 45 | #ifdef CONFIG_PM_SLEEP 46 | int Sstar_cache_fw_before_suspend(struct device *pdev); 47 | #endif 48 | #endif 49 | -------------------------------------------------------------------------------- /include/linux/compat-2.6.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_26_COMPAT_H 2 | #define LINUX_26_COMPAT_H 3 | 4 | #include 5 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) 6 | #include 7 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) 8 | #include 9 | #else 10 | #include 11 | #endif 12 | 13 | /* STERICSSON_WLAN_BUILT_IN hack*/ 14 | #ifndef COMPAT_STATIC 15 | #include 16 | #endif 17 | 18 | /* 19 | * Each compat file represents compatibility code for new kernel 20 | * code introduced for *that* kernel revision. 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #endif /* LINUX_26_COMPAT_H */ 50 | -------------------------------------------------------------------------------- /include/linux/unaligned/access_ok.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_UNALIGNED_ACCESS_OK_H 2 | #define _LINUX_UNALIGNED_ACCESS_OK_H 3 | 4 | #include 5 | #include 6 | 7 | static inline u16 get_unaligned_le16(const void *p) 8 | { 9 | return le16_to_cpup((__le16 *)p); 10 | } 11 | 12 | static inline u32 get_unaligned_le32(const void *p) 13 | { 14 | return le32_to_cpup((__le32 *)p); 15 | } 16 | 17 | static inline u64 get_unaligned_le64(const void *p) 18 | { 19 | return le64_to_cpup((__le64 *)p); 20 | } 21 | 22 | static inline u16 get_unaligned_be16(const void *p) 23 | { 24 | return be16_to_cpup((__be16 *)p); 25 | } 26 | 27 | static inline u32 get_unaligned_be32(const void *p) 28 | { 29 | return be32_to_cpup((__be32 *)p); 30 | } 31 | 32 | static inline u64 get_unaligned_be64(const void *p) 33 | { 34 | return be64_to_cpup((__be64 *)p); 35 | } 36 | 37 | static inline void put_unaligned_le16(u16 val, void *p) 38 | { 39 | *((__le16 *)p) = cpu_to_le16(val); 40 | } 41 | 42 | static inline void put_unaligned_le32(u32 val, void *p) 43 | { 44 | *((__le32 *)p) = cpu_to_le32(val); 45 | } 46 | 47 | static inline void put_unaligned_le64(u64 val, void *p) 48 | { 49 | *((__le64 *)p) = cpu_to_le64(val); 50 | } 51 | 52 | static inline void put_unaligned_be16(u16 val, void *p) 53 | { 54 | *((__be16 *)p) = cpu_to_be16(val); 55 | } 56 | 57 | static inline void put_unaligned_be32(u32 val, void *p) 58 | { 59 | *((__be32 *)p) = cpu_to_be32(val); 60 | } 61 | 62 | static inline void put_unaligned_be64(u64 val, void *p) 63 | { 64 | *((__be64 *)p) = cpu_to_be64(val); 65 | } 66 | 67 | #endif /* _LINUX_UNALIGNED_ACCESS_OK_H */ 68 | -------------------------------------------------------------------------------- /hal_apollo/hwio_usb.h: -------------------------------------------------------------------------------- 1 | #define USB_AUTO_WAKEUP 0 2 | #define HW_DOWN_FW 3 | #define DOWNLOAD_BLOCK_SIZE (64) 4 | 5 | 6 | #ifndef SSTAR_APOLLO_HWIO_USB_H_INCLUDED 7 | #define SSTAR_APOLLO_HWIO_USB_H_INCLUDED 8 | #include "apollo_plat.h" 9 | 10 | #define SIGMASTAR_WIFI_HDR_FLAG (0x34353677) 11 | #if ((PROJ_TYPE>=ARES_A) || (PROJ_TYPE==ATHENA_LITE_ECO)) 12 | #define DOWNLOAD_ITCM_ADDR (0x00010000) 13 | #else 14 | #define DOWNLOAD_ITCM_ADDR (0x00000000) 15 | #endif 16 | #define DOWNLOAD_ITCM_SIZE (128*1024) 17 | #define DOWNLOAD_DTCM_ADDR (0x00800000) 18 | #define DOWNLOAD_DTCM_SIZE (48*1024) 19 | 20 | 21 | 22 | #define SYS_BASE_ADDR_SILICON (0) 23 | #define PAC_BASE_ADDRESS_SILICON (SYS_BASE_ADDR_SILICON + 0x09000000) 24 | #define PAC_SHARED_MEMORY_SILICON (PAC_BASE_ADDRESS_SILICON) 25 | 26 | 27 | int Sstar_direct_write_reg_32(struct Sstar_common *hw_priv, u32 addr, u32 val); 28 | int Sstar_direct_read_reg_32(struct Sstar_common *hw_priv, u32 addr, u32 *val); 29 | int Sstar_fw_write(struct Sstar_common *priv, u32 addr, const void *buf, 30 | u32 buf_len); 31 | int Sstar_ep0_read(struct Sstar_common *hw_priv, u32 addr, 32 | void *buf, u32 buf_len); 33 | int Sstar_ep0_write(struct Sstar_common *hw_priv, u32 addr, 34 | const void *buf, u32 buf_len); 35 | #ifdef USB_CMD_UES_EP0 36 | int Sstar_ep0_write_cmd(struct Sstar_common *hw_priv, struct wsm_hdr_tx * wsm_h); 37 | #endif 38 | /* 39 | *lock for probe dan disconnect 40 | */ 41 | extern void Sstar_usb_module_muxlock(void); 42 | extern void Sstar_usb_module_muxunlock(void); 43 | 44 | #define Sstar_module_muxlock() Sstar_usb_module_muxlock() 45 | #define Sstar_module_muxunlock() Sstar_usb_module_muxunlock() 46 | 47 | #endif //SSTAR_APOLLO_HWIO_USB_H_INCLUDED 48 | -------------------------------------------------------------------------------- /include/linux/unaligned/be_byteshift.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_UNALIGNED_BE_BYTESHIFT_H 2 | #define _LINUX_UNALIGNED_BE_BYTESHIFT_H 3 | 4 | #include 5 | 6 | static inline u16 __get_unaligned_be16(const u8 *p) 7 | { 8 | return p[0] << 8 | p[1]; 9 | } 10 | 11 | static inline u32 __get_unaligned_be32(const u8 *p) 12 | { 13 | return p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3]; 14 | } 15 | 16 | static inline u64 __get_unaligned_be64(const u8 *p) 17 | { 18 | return (u64)__get_unaligned_be32(p) << 32 | 19 | __get_unaligned_be32(p + 4); 20 | } 21 | 22 | static inline void __put_unaligned_be16(u16 val, u8 *p) 23 | { 24 | *p++ = val >> 8; 25 | *p++ = val; 26 | } 27 | 28 | static inline void __put_unaligned_be32(u32 val, u8 *p) 29 | { 30 | __put_unaligned_be16(val >> 16, p); 31 | __put_unaligned_be16(val, p + 2); 32 | } 33 | 34 | static inline void __put_unaligned_be64(u64 val, u8 *p) 35 | { 36 | __put_unaligned_be32(val >> 32, p); 37 | __put_unaligned_be32(val, p + 4); 38 | } 39 | 40 | static inline u16 get_unaligned_be16(const void *p) 41 | { 42 | return __get_unaligned_be16((const u8 *)p); 43 | } 44 | 45 | static inline u32 get_unaligned_be32(const void *p) 46 | { 47 | return __get_unaligned_be32((const u8 *)p); 48 | } 49 | 50 | static inline u64 get_unaligned_be64(const void *p) 51 | { 52 | return __get_unaligned_be64((const u8 *)p); 53 | } 54 | 55 | static inline void put_unaligned_be16(u16 val, void *p) 56 | { 57 | __put_unaligned_be16(val, p); 58 | } 59 | 60 | static inline void put_unaligned_be32(u32 val, void *p) 61 | { 62 | __put_unaligned_be32(val, p); 63 | } 64 | 65 | static inline void put_unaligned_be64(u64 val, void *p) 66 | { 67 | __put_unaligned_be64(val, p); 68 | } 69 | 70 | #endif /* _LINUX_UNALIGNED_BE_BYTESHIFT_H */ 71 | -------------------------------------------------------------------------------- /include/linux/unaligned/le_byteshift.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_UNALIGNED_LE_BYTESHIFT_H 2 | #define _LINUX_UNALIGNED_LE_BYTESHIFT_H 3 | 4 | #include 5 | 6 | static inline u16 __get_unaligned_le16(const u8 *p) 7 | { 8 | return p[0] | p[1] << 8; 9 | } 10 | 11 | static inline u32 __get_unaligned_le32(const u8 *p) 12 | { 13 | return p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24; 14 | } 15 | 16 | static inline u64 __get_unaligned_le64(const u8 *p) 17 | { 18 | return (u64)__get_unaligned_le32(p + 4) << 32 | 19 | __get_unaligned_le32(p); 20 | } 21 | 22 | static inline void __put_unaligned_le16(u16 val, u8 *p) 23 | { 24 | *p++ = val; 25 | *p++ = val >> 8; 26 | } 27 | 28 | static inline void __put_unaligned_le32(u32 val, u8 *p) 29 | { 30 | __put_unaligned_le16(val >> 16, p + 2); 31 | __put_unaligned_le16(val, p); 32 | } 33 | 34 | static inline void __put_unaligned_le64(u64 val, u8 *p) 35 | { 36 | __put_unaligned_le32(val >> 32, p + 4); 37 | __put_unaligned_le32(val, p); 38 | } 39 | 40 | static inline u16 get_unaligned_le16(const void *p) 41 | { 42 | return __get_unaligned_le16((const u8 *)p); 43 | } 44 | 45 | static inline u32 get_unaligned_le32(const void *p) 46 | { 47 | return __get_unaligned_le32((const u8 *)p); 48 | } 49 | 50 | static inline u64 get_unaligned_le64(const void *p) 51 | { 52 | return __get_unaligned_le64((const u8 *)p); 53 | } 54 | 55 | static inline void put_unaligned_le16(u16 val, void *p) 56 | { 57 | __put_unaligned_le16(val, p); 58 | } 59 | 60 | static inline void put_unaligned_le32(u32 val, void *p) 61 | { 62 | __put_unaligned_le32(val, p); 63 | } 64 | 65 | static inline void put_unaligned_le64(u64 val, void *p) 66 | { 67 | __put_unaligned_le64(val, p); 68 | } 69 | 70 | #endif /* _LINUX_UNALIGNED_LE_BYTESHIFT_H */ 71 | -------------------------------------------------------------------------------- /include/linux/compat-3.2.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_3_2_COMPAT_H 2 | #define LINUX_3_2_COMPAT_H 3 | 4 | #include 5 | 6 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)) 7 | 8 | #include 9 | #include 10 | 11 | #define PMSG_IS_AUTO(msg) (((msg).event & PM_EVENT_AUTO) != 0) 12 | 13 | /** 14 | * skb_frag_page - retrieve the page refered to by a paged fragment 15 | * @frag: the paged fragment 16 | * 17 | * Returns the &struct page associated with @frag. 18 | */ 19 | static inline struct page *skb_frag_page(const skb_frag_t *frag) 20 | { 21 | return frag->page; 22 | } 23 | 24 | /** 25 | * skb_frag_dma_map - maps a paged fragment via the DMA API 26 | * @device: the device to map the fragment to 27 | * @frag: the paged fragment to map 28 | * @offset: the offset within the fragment (starting at the 29 | * fragment's own offset) 30 | * @size: the number of bytes to map 31 | * @direction: the direction of the mapping (%PCI_DMA_*) 32 | * 33 | * Maps the page associated with @frag to @device. 34 | */ 35 | static inline dma_addr_t skb_frag_dma_map(struct device *dev, 36 | const skb_frag_t *frag, 37 | size_t offset, size_t size, 38 | enum dma_data_direction dir) 39 | { 40 | return dma_map_page(dev, skb_frag_page(frag), 41 | frag->page_offset + offset, size, dir); 42 | } 43 | 44 | #define ETH_P_TDLS 0x890D /* TDLS */ 45 | 46 | static inline unsigned int skb_frag_size(const skb_frag_t *frag) 47 | { 48 | return frag->size; 49 | } 50 | 51 | static inline char *hex_byte_pack(char *buf, u8 byte) 52 | { 53 | *buf++ = hex_asc_hi(byte); 54 | *buf++ = hex_asc_lo(byte); 55 | return buf; 56 | } 57 | 58 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)) */ 59 | 60 | #endif /* LINUX_3_2_COMPAT_H */ 61 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/Sstar_common.h: -------------------------------------------------------------------------------- 1 | #ifndef __SSTAR_COMMON_H__ 2 | #define __SSTAR_COMMON_H__ 3 | 4 | 5 | #define USER_DATE_LEN 255 6 | #define MAC_FILTER_NUM 8 7 | 8 | typedef struct _Wifi_Recv_Info 9 | { 10 | unsigned char Ssid[32]; 11 | unsigned char channel; 12 | unsigned int Rssi; //信号强度 13 | unsigned int Quality; //信号质量 14 | unsigned char phy_noise; //噪声 15 | unsigned char Bssid[6]; //热点 WiFi MAC地址 16 | unsigned char User_data[USER_DATE_LEN+1]; //存放收到广播包后要回复私有数据 17 | }Wifi_Recv_Info_t; //接收结构体 18 | 19 | typedef struct _Wifi_AP_Info 20 | { 21 | unsigned int flag; 22 | Wifi_Recv_Info_t priv_recv_info; 23 | }Wifi_Ap_Info_t; 24 | 25 | typedef struct _Wifi_Send_Info 26 | { 27 | unsigned char mac_filter; 28 | unsigned char Ssid[32]; 29 | unsigned short channel; 30 | unsigned char Bssid[MAC_FILTER_NUM][ETH_ALEN]; //需要过滤的mac地址 31 | unsigned char User_data[USER_DATE_LEN+1]; //存放要发送的私有数据 32 | }Wifi_Send_Info_t; //发送结构体 33 | 34 | typedef struct Sstar_private_data{ 35 | int set_flag; 36 | int data_len; 37 | char user_data[USER_DATE_LEN+1]; 38 | }SSTAR_PRIVATE_DATA; 39 | 40 | 41 | #define AP_SCAN_NUM_MAX 32 //ap number per channel 42 | #define CHANNEL_NUM 14 //channel 43 | 44 | typedef struct _best_channel_info_ 45 | { 46 | u8 ssid[32]; 47 | u8 mac_addr[ETH_ALEN]; 48 | u8 rssi; 49 | u8 flag; 50 | u8 enc_type; 51 | }BEST_CHANNEL_INFO; 52 | typedef struct _best_ch_busy_ratio_ 53 | { 54 | unsigned int best_ch_busy_ratio[CHANNEL_NUM]; 55 | unsigned int total_cnt; 56 | }BEST_CHANNEL_BUSY_RATIO; 57 | 58 | typedef struct _best_ch_scan_result_ 59 | { 60 | unsigned int channel_ap_num[CHANNEL_NUM]; 61 | unsigned int busy_ratio[CHANNEL_NUM]; 62 | unsigned char suggest_ch; 63 | }Best_Channel_Scan_Result; 64 | 65 | typedef struct _special_ch_freq_{ 66 | //unsigned int special_ch; 67 | unsigned int special_freq;//2380MHz or 2504MHz 68 | unsigned int flag; 69 | }SPECIAL_CH_FREQ; 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /hal_apollo/hwio_spi.h: -------------------------------------------------------------------------------- 1 | 2 | #define HW_DOWN_FW 3 | #define DOWNLOAD_BLOCK_SIZE (50) 4 | 5 | 6 | #ifndef SSTAR_APOLLO_HWIO_SPI_H_INCLUDED 7 | #define SSTAR_APOLLO_HWIO_SPI_H_INCLUDED 8 | #include "apollo_plat.h" 9 | 10 | #define SIGMASTAR_WIFI_HDR_FLAG (0x34353677) 11 | #if (PROJ_TYPE>=ARES_A) 12 | #define DOWNLOAD_ITCM_ADDR (0x00010000) 13 | #else 14 | #define DOWNLOAD_ITCM_ADDR (0x00000000) 15 | #endif 16 | #define DOWNLOAD_ITCM_SIZE (128*1024) 17 | #define DOWNLOAD_DTCM_ADDR (0x00800000) 18 | #define DOWNLOAD_DTCM_SIZE (48*1024) 19 | 20 | 21 | 22 | #define SYS_BASE_ADDR_SILICON (0) 23 | #define PAC_BASE_ADDRESS_SILICON (SYS_BASE_ADDR_SILICON + 0x09000000) 24 | #define PAC_SHARED_MEMORY_SILICON (PAC_BASE_ADDRESS_SILICON) 25 | 26 | #define SPI_READ_BLOCK_SIZE (32 *4 ) 27 | #define SPI_WRITE_BLOCK_SIZE (264) 28 | 29 | #define SPI_CHANNEL_FLAG BIT(0) 30 | #define SPI_RDY_IRQ BIT(1) 31 | #define SPI_HW_SW_RDY BIT(2) 32 | #define SPI_RX_DATA_LENGTH(status) ((status >> 3) & 0x1fff) // bit [15:3] 33 | #define SPI_STATUS_READY BIT(16) 34 | #define SPI_OVERRUN BIT(17) 35 | #define SPI_UNDERRUN BIT(18) 36 | 37 | 38 | int Sstar_read_data(struct Sstar_common *priv, void *buf, u32 buf_len); 39 | int Sstar_write_data(struct Sstar_common *priv, const void *buf, u32 buf_len); 40 | int Sstar_read_status(struct Sstar_common *priv, u32 *status); 41 | int Sstar_read_status_ready(struct Sstar_common *priv, u32 *ready); 42 | int Sstar_update_status_channelflag(struct Sstar_common *priv); 43 | int Sstar_read_status_channelflag(struct Sstar_common *priv, u32 *channelflag); 44 | int Sstar_direct_write_reg_32(struct Sstar_common *hw_priv, u32 addr, u32 val); 45 | int Sstar_direct_read_reg_32(struct Sstar_common *hw_priv, u32 addr, u32 *val); 46 | 47 | int Sstar_fw_write(struct Sstar_common *priv, u32 addr, const void *buf, 48 | u32 buf_len); 49 | #endif //SSTAR_APOLLO_HWIO_SPI_H_INCLUDED 50 | -------------------------------------------------------------------------------- /include/linux/cordic.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Broadcom Corporation 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 13 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | #ifndef __CORDIC_H_ 17 | #define __CORDIC_H_ 18 | 19 | #include 20 | 21 | /** 22 | * struct cordic_iq - i/q coordinate. 23 | * 24 | * @i: real part of coordinate (in phase). 25 | * @q: imaginary part of coordinate (quadrature). 26 | */ 27 | struct cordic_iq { 28 | s32 i; 29 | s32 q; 30 | }; 31 | 32 | /** 33 | * cordic_calc_iq() - calculates the i/q coordinate for given angle. 34 | * 35 | * @theta: angle in degrees for which i/q coordinate is to be calculated. 36 | * @coord: function output parameter holding the i/q coordinate. 37 | * 38 | * The function calculates the i/q coordinate for a given angle using 39 | * cordic algorithm. The coordinate consists of a real (i) and an 40 | * imaginary (q) part. The real part is essentially the cosine of the 41 | * angle and the imaginary part is the sine of the angle. The returned 42 | * values are scaled by 2^16 for precision. The range for theta is 43 | * for -180 degrees to +180 degrees. Passed values outside this range are 44 | * converted before doing the actual calculation. 45 | */ 46 | struct cordic_iq cordic_calc_iq(s32 theta); 47 | 48 | #endif /* __CORDIC_H_ */ 49 | -------------------------------------------------------------------------------- /hal_apollo/pm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Mac80211 power management interface for sigmastar APOLLO mac80211 drivers 3 | * * 4 | * Copyright (c) 2016, sigmastar 5 | * Author: 6 | * 7 | * Based on apollo code 8 | * Copyright (c) 2011, ST-Ericsson 9 | * Author: Dmitry Tarnyagin 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License version 2 as 13 | * published by the Free Software Foundation. 14 | */ 15 | 16 | #ifndef PM_H_INCLUDED 17 | #define PM_H_INCLUDED 18 | #include 19 | #ifdef CONFIG_WAKELOCK 20 | #include 21 | #endif 22 | 23 | /* ******************************************************************** */ 24 | /* mac80211 API */ 25 | 26 | #ifdef CONFIG_PM 27 | 28 | /* extern */ struct Sstar_common; 29 | /* private */ struct Sstar_suspend_state; 30 | struct Sstar_pm_stayawake_lock{ 31 | struct Sstar_common *hw_priv; 32 | int stayawak_cnt; 33 | spinlock_t stayawak_spinlock; 34 | #ifdef CONFIG_WAKELOCK 35 | struct wake_lock stayawak_lock; 36 | #endif 37 | }; 38 | struct Sstar_pm_state { 39 | struct platform_driver pm_driver; 40 | #ifdef CONFIG_WAKELOCK 41 | struct wake_lock wakelock; 42 | #else 43 | struct timer_list stay_awake; 44 | #endif 45 | struct platform_device *pm_dev; 46 | spinlock_t lock; 47 | struct Sstar_pm_stayawake_lock stayawake_lock; 48 | int b_init; 49 | }; 50 | 51 | struct Sstar_pm_state_vif { 52 | struct Sstar_suspend_state *suspend_state; 53 | }; 54 | 55 | int Sstar_pm_init(struct Sstar_pm_state *pm, 56 | struct Sstar_common *priv); 57 | void Sstar_pm_deinit(struct Sstar_pm_state *pm); 58 | void Sstar_pm_stay_awake(struct Sstar_pm_state *pm, 59 | unsigned long tmo); 60 | int Sstar_wow_suspend(struct ieee80211_hw *hw, 61 | struct cfg80211_wowlan *wowlan); 62 | int Sstar_wow_resume(struct ieee80211_hw *hw); 63 | void Sstar_pm_stay_awake_lock(struct Sstar_pm_state *pm); 64 | void Sstar_pm_stay_awake_unlock(struct Sstar_pm_state *pm); 65 | #endif 66 | #endif 67 | -------------------------------------------------------------------------------- /hal_apollo/smartconfig.h: -------------------------------------------------------------------------------- 1 | #ifndef __SMART_CONFIG_H__ 2 | #define __SMART_CONFIG_H__ 3 | /* 4 | enum smartconfig_status{ 5 | CONFIG_ST_IDLE = 0, 6 | CONFIG_ST_START = 1, 7 | CONFIG_ST_GET_MAGIC = 2, 8 | CONFIG_ST_SWITCH_PAYLOAD_CH = 3, 9 | CONFIG_ST_GET_PAYLOAD = 4, 10 | CONFIG_ST_DONE_SUCCESS = 5, 11 | CONFIG_ST_DONE_FAIL =6, 12 | CONFIG_ST_DUPLICATE_FAIL =7, 13 | CONFIG_ST_STARTCONFIG_ERR =8, 14 | };*/ 15 | enum smartconfig_status{ 16 | CONFIG_ST_IDLE = 0, 17 | CONFIG_ST_REIDLE = 8, 18 | CONFIG_ST_START = 1, 19 | CONFIG_ST_GET_MAGIC = 2, 20 | CONFIG_ST_PAYLOAD = 3, 21 | CONFIG_ST_RE_PAYLOAD = 4, 22 | CONFIG_ST_GET_TOTALLEN = 5, 23 | CONFIG_ST_SWITCH_PAYLOAD_CH = 6, 24 | CONFIG_ST_GET_PAYLOAD = 7, 25 | CONFIG_ST_GET_PAYLOAD_CSUM = 8, 26 | CONFIG_ST_DONE_SUCCESS = 9, 27 | CONFIG_ST_DONE_FAIL =10, 28 | CONFIG_ST_DUPLICATE_FAIL =11, 29 | CONFIG_ST_STARTCONFIG_ERR =12, 30 | }; 31 | 32 | enum smartconfig_type{ 33 | CONFIG_TP_SSTAR_SMART = 0, 34 | CONFIG_TP_AIRKISS = 1, 35 | }; 36 | 37 | struct smartconfig_config{ 38 | enum smartconfig_type type; 39 | /*cnt : 1 ~ 10*/ 40 | int magic_cnt; 41 | /*ms : 20ms ~ 200ms*/ 42 | int magic_time; 43 | /*ms : 500ms ~ 10000ms*/ 44 | int payload_time; 45 | }; 46 | int Sstar_smartconfig_start(struct Sstar_common *hw_priv,int enable); 47 | int Sstar_smartconfig_stop(struct Sstar_common *hw_priv); 48 | int smartconfig_start(struct Sstar_common *hw_priv,struct smartconfig_config * st_cfg); 49 | int smartconfig_stop(struct Sstar_common *hw_priv); 50 | int smartconfig_status(struct Sstar_common *hw_priv); 51 | 52 | /*cnt : 2 ~ 10*/ 53 | int smartconfig_magic_channel_cnt(int cnt); 54 | /*ms : 20ms ~ 200ms*/ 55 | int smartconfig_magic_channel_timeout(int ms); 56 | /*ms : 500ms ~ 10000ms*/ 57 | int smartconfig_payload_timeout(int ms); 58 | void Sstar_smart_scan_work(struct work_struct *work); 59 | void Sstar_smart_setchan_work(struct work_struct *work); 60 | void Sstar_smart_stop_work(struct work_struct *work); 61 | void Sstar_smartconfig_expire_timer(unsigned long arg); 62 | 63 | 64 | 65 | 66 | 67 | #endif /*__SMART_CONFIG_H__*/ 68 | -------------------------------------------------------------------------------- /hal_apollo/internal_cmd.h: -------------------------------------------------------------------------------- 1 | #ifndef __INTERNAL_CMD__ 2 | #define __INTERNAL_CMD__ 3 | #include 4 | #include "mac80211/ieee80211_i.h" 5 | 6 | bool Sstar_internal_cmd_scan_triger(struct ieee80211_sub_if_data *sdata,struct ieee80211_internal_scan_request *req); 7 | bool Sstar_internal_cmd_stainfo(struct ieee80211_local *local,struct ieee80211_internal_sta_req *sta_req); 8 | bool Sstar_internal_cmd_monitor_req(struct ieee80211_sub_if_data *sdata,struct ieee80211_internal_monitor_req *monitor_req); 9 | bool Sstar_internal_cmd_stop_monitor(struct ieee80211_sub_if_data *sdata); 10 | bool Sstar_internal_wsm_adaptive(struct Sstar_common *hw_priv,struct ieee80211_internal_wsm_adaptive *adaptive); 11 | bool Sstar_internal_wsm_txpwr_dcxo(struct Sstar_common *hw_priv,struct ieee80211_internal_wsm_txpwr_dcxo *txpwr_dcxo); 12 | bool Sstar_internal_wsm_txpwr(struct Sstar_common *hw_priv,struct ieee80211_internal_wsm_txpwr *txpwr); 13 | bool Sstar_internal_freq_set(struct ieee80211_hw *hw,struct ieee80211_internal_set_freq_req *req); 14 | bool Sstar_internal_cmd_scan_build(struct ieee80211_local *local,struct ieee80211_internal_scan_request *req, 15 | u8* channels,int n_channels,struct cfg80211_ssid *ssids,int n_ssids, 16 | struct ieee80211_internal_mac *macs,int n_macs); 17 | bool Sstar_internal_channel_auto_select_results(struct ieee80211_sub_if_data *sdata, 18 | struct ieee80211_internal_channel_auto_select_results *results); 19 | bool Sstar_internal_channel_auto_select(struct ieee80211_sub_if_data *sdata, 20 | struct ieee80211_internal_channel_auto_select_req *req); 21 | bool Sstar_internal_request_chip_cap(struct ieee80211_hw *hw,struct ieee80211_internal_req_chip *req); 22 | bool Sstar_internal_update_ap_conf(struct ieee80211_sub_if_data *sdata,struct ieee80211_internal_ap_conf *conf_req,bool clear); 23 | bool Sstar_internal_wsm_set_rate(struct Sstar_common *hw_priv,struct ieee80211_internal_rate_req *req); 24 | bool Sstar_internal_wsm_set_rate_power(struct Sstar_common *hw_priv,struct ieee80211_internal_rate_power_req *req); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /.config: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated file; DO NOT EDIT. 3 | # sstar Wifi Driver Configuration 4 | # 5 | CONFIG_SSTAR_MENUCONFIG=y 6 | CONFIG_SSTAR_WIRELESS=y 7 | # CONFIG_SSW101x is not set 8 | # CONFIG_SSW101 is not set 9 | CONFIG_SSW101B=y 10 | # CONFIG_SSTAR6041 is not set 11 | CONFIG_SSTAR_USB_BUS=y 12 | # CONFIG_SSTAR_SDIO_BUS is not set 13 | # CONFIG_SSTAR_SPI_BUS is not set 14 | # CONFIG_SSTAR_USE_FIRMWARE_BIN is not set 15 | CONFIG_SSTAR_USE_FIRMWARE_H=y 16 | 17 | # 18 | # Driver Extern Function Select 19 | # 20 | # CONFIG_SSTAR_SUPPORT_BRIDGE is not set 21 | CONFIG_SSTAR_FUNC_NOTXCONFIRM=y 22 | # CONFIG_SSTAR_FUNC_EARLYSUSPEND is not set 23 | CONFIG_SSTAR_FUNC_MONITOR=y 24 | # CONFIG_SSTAR_FUNC_SKB_DEBUG is not set 25 | # CONFIG_SSTAR_FUNC_MEM_DEBUG is not set 26 | # CONFIG_SSTAR_FUNC_CHANNEL_5G_PRETEND_2G is not set 27 | CONFIG_SSTAR_FUNC_USB_AGGRTX=y 28 | CONFIG_SSTAR_FUNC_USB_DMABUFF=y 29 | CONFIG_SSTAR_FUNC_USB_CMD_ENHANCE=y 30 | #CONFIG_SSTAR_FUNC_USB_DATA_ENHANCE=y 31 | # CONFIG_SSTAR_FUNC_PS_WAKEUP_RELOAD_FW is not set 32 | # CONFIG_SSTAR_FUNC_HW_CHSUM is not set 33 | CONFIG_SSTAR_FUNC_DRV_LOADER_FAST=y 34 | CONFIG_SSTAR_FUNC_PRIVE_IE=y 35 | 36 | # 37 | # Driver debug features 38 | # 39 | # CONFIG_SSTAR_APOLLO_DEBUGFS is not set 40 | # CONFIG_SSTAR_APOLLO_DEBUG_ON_BOOT is not set 41 | # CONFIG_SSTAR_APOLLO_BH_DEBUG is not set 42 | # CONFIG_SSTAR_APOLLO_WSM_DEBUG is not set 43 | # CONFIG_SSTAR_APOLLO_WSM_DUMPS is not set 44 | # CONFIG_SSTAR_APOLLO_WSM_DUMPS_SHORT is not set 45 | # CONFIG_SSTAR_APOLLO_TXRX_DEBUG is not set 46 | # CONFIG_SSTAR_APOLLO_TX_POLICY_DEBUG is not set 47 | # CONFIG_SSTAR_APOLLO_STA_DEBUG is not set 48 | # CONFIG_SSTAR_APOLLO_DUMP_ON_ERROR is not set 49 | # CONFIG_SSTAR_APOLLO_WAPI_SUPPORT is not set 50 | CONFIG_SSTAR_APOLLO_SUPPORT_SGI=y 51 | CONFIG_MAC80211_SSTAR_HAS_RC=y 52 | CONFIG_MAC80211_SSTAR_RC_MINSTREL=y 53 | CONFIG_MAC80211_SSTAR_RC_MINSTREL_HT=y 54 | CONFIG_MAC80211_SSTAR_RC_DEFAULT_MINSTREL=y 55 | CONFIG_SSTAR_WIFIIF1_NAME="wlan%d" 56 | CONFIG_SSTAR_WIFIIF2_NAME="p2p%d" 57 | CONFIG_SSTAR_MODULE_NAME="ssw101b_wifi_usb" 58 | CONFIG_MAC80211_SSTAR_RC_DEFAULT="minstrel_ht" 59 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/wapi.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Software WAPI encryption implementation 3 | * Copyright (c) 2011, sigmastar 4 | * Author: Janusz Dziedzic 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 2 as 8 | * published by the Free Software Foundation. 9 | */ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include 24 | #include "ieee80211_i.h" 25 | #include "wapi.h" 26 | 27 | 28 | static int ieee80211_wapi_decrypt(struct ieee80211_local *local, 29 | struct sk_buff *skb, 30 | struct ieee80211_key *key) 31 | { 32 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 33 | int hdrlen = ieee80211_hdrlen(hdr->frame_control); 34 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); 35 | int data_len; 36 | 37 | if (!(status->flag & RX_FLAG_DECRYPTED)) { 38 | /* TODO - SMS4 decryption for firmware without 39 | * SMS4 support */ 40 | return RX_DROP_UNUSABLE; 41 | } 42 | 43 | 44 | data_len = skb->len - hdrlen - WAPI_IV_LEN - WAPI_ICV_LEN; 45 | if (data_len < 0) 46 | return RX_DROP_UNUSABLE; 47 | 48 | /* Trim ICV */ 49 | Sstar_skb_trim(skb, skb->len - WAPI_ICV_LEN); 50 | 51 | /* Remove IV */ 52 | memmove(skb->data + WAPI_IV_LEN, skb->data, hdrlen); 53 | Sstar_skb_pull(skb, WAPI_IV_LEN); 54 | 55 | return RX_CONTINUE; 56 | } 57 | 58 | ieee80211_rx_result 59 | ieee80211_crypto_wapi_decrypt(struct ieee80211_rx_data *rx) 60 | { 61 | struct sk_buff *skb = rx->skb; 62 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 63 | 64 | if (!ieee80211_is_data(hdr->frame_control)) 65 | return RX_CONTINUE; 66 | 67 | if (ieee80211_wapi_decrypt(rx->local, rx->skb, rx->key)) 68 | return RX_DROP_UNUSABLE; 69 | 70 | return RX_CONTINUE; 71 | } 72 | -------------------------------------------------------------------------------- /hal_apollo/hwio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Low-level API for mac80211 sigmastar apollo wifi drivers 3 | * 4 | * Copyright (c) 2016, sigmastar 5 | * 6 | * Based on: 7 | * Copyright (c) 2010, stericsson 8 | * Author: Dmitry Tarnyagin 9 | * 10 | * Based on: 11 | * ST-Ericsson UMAC CW1200 driver which is 12 | * Copyright (c) 2010, ST-Ericsson 13 | * Author: Ajitpal Singh 14 | * 15 | * This program is free software; you can redistribute it and/or modify 16 | * it under the terms of the GNU General Public License version 2 as 17 | * published by the Free Software Foundation. 18 | */ 19 | 20 | #ifndef SSTAR_APOLLO_HWIO_H_INCLUDED 21 | #define SSTAR_APOLLO_HWIO_H_INCLUDED 22 | 23 | 24 | /* extern */ struct Sstar_common; 25 | /* Hardware Type Definitions */ 26 | #define HIF_1601_FPGA (0) 27 | #define HIF_1601_CHIP (1) 28 | 29 | 30 | 31 | 32 | /* Download error code */ 33 | #define DOWNLOAD_PENDING (0xFFFFFFFF) 34 | #define DOWNLOAD_SUCCESS (0) 35 | #define DOWNLOAD_EXCEPTION (1) 36 | #define DOWNLOAD_ERR_MEM_1 (2) 37 | #define DOWNLOAD_ERR_MEM_2 (3) 38 | #define DOWNLOAD_ERR_SOFTWARE (4) 39 | #define DOWNLOAD_ERR_FILE_SIZE (5) 40 | #define DOWNLOAD_ERR_CHECKSUM (6) 41 | #define DOWNLOAD_ERR_OVERFLOW (7) 42 | #define DOWNLOAD_ERR_IMAGE (8) 43 | #define DOWNLOAD_ERR_HOST (9) 44 | #define DOWNLOAD_ERR_ABORT (10) 45 | 46 | 47 | #ifdef USB_BUS 48 | #include "hwio_usb.h" 49 | #endif 50 | #ifdef SDIO_BUS 51 | #include "hwio_sdio.h" 52 | #endif 53 | #ifdef SPI_BUS 54 | #include "hwio_spi.h" 55 | #endif 56 | 57 | int Sstar_fw_write(struct Sstar_common *priv, u32 addr, const void *buf,u32 buf_len); 58 | int Sstar_before_load_firmware(struct Sstar_common *hw_priv); 59 | int Sstar_after_load_firmware(struct Sstar_common *hw_priv); 60 | void Sstar_firmware_init_check(struct Sstar_common *hw_priv); 61 | int Sstar_reset_lmc_cpu(struct Sstar_common *hw_priv); 62 | int Sstar_reset_chip(struct Sstar_common *hw_priv); 63 | 64 | #ifndef Sstar_module_muxlock 65 | #define Sstar_module_muxlock() 66 | #endif 67 | 68 | #ifndef Sstar_module_muxunlock 69 | #define Sstar_module_muxunlock() 70 | #endif 71 | #endif //SSTAR_APOLLO_HWIO_H_INCLUDED 72 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | PWD := $(shell pwd) 3 | WIFI_INSTALL_DIR := $(PWD)/output 4 | 5 | NOSTDINC_FLAGS := -I$(src)/include/ \ 6 | -include $(src)/include/linux/compat-2.6.h \ 7 | -DCOMPAT_STATIC 8 | 9 | ##################################################### 10 | export 11 | MODULES_NAME = ssw101b_wifi_usb 12 | CONFIG_FPGA = n 13 | CONFIG_1601 = n 14 | CONFIG_1606 = n 15 | CONFIG_APOLLOC = n 16 | CONFIG_APOLLOD = n 17 | CONFIG_APOLLOE = n 18 | CONFIG_ATHENAA = n 19 | CONFIG_ATHENAB = n 20 | CONFIG_ATHENAB_24M = n 21 | CONFIG_ATHENAC = n 22 | CONFIG_ATHENALITE = n 23 | CONFIG_ATHENALITE_ECO = n 24 | CONFIG_ARES = n 25 | CONFIG_ARESB = y 26 | CONFIG_HERA = n 27 | USB_BUS = y 28 | SPI_BUS = n 29 | SDIO_BUS = n 30 | TX_NO_CONFIRM = n 31 | MULT_NAME = n 32 | SSTAR_MAKEFILE_SUB = y 33 | 34 | LOAD_FW_H = y 35 | SKB_DEBUG = n 36 | MEM_DEBUG = n 37 | BRIDGE = n 38 | MONITOR = y 39 | EARLYSUSPEND = n 40 | CH5G = y 41 | USBAGGTX = y 42 | NOTXCONFIRM = y 43 | USBDMABUFF = y 44 | USBCMDENHANCE = y 45 | USBDATAENHANCE = y 46 | PMRELODDFW = n 47 | CHECKSUM = n 48 | CONFIG_NOT_SUPPORT_40M_CHW = n 49 | 50 | ################################################## 51 | ifeq ($(CONFIG_HERA),y) 52 | SDIO_BUS = y 53 | endif 54 | 55 | ##################################################### 56 | export 57 | ifeq ($(CONFIG_SSTAR_APOLLO),) 58 | CONFIG_SSTAR_APOLLO = m 59 | endif 60 | 61 | export 62 | include $(src)/Makefile.build.kernel 63 | 64 | export 65 | SSTAR_WIFI__EXT_CCFLAGS = -DSSTAR_WIFI_PLATFORM=18 66 | 67 | ##################################################### 68 | export 69 | ifeq ($(CONFIG_MAC80211_SSTAR_RC_MINSTREL),) 70 | SSTAR_WIFI__EXT_CCFLAGS += -DCONFIG_MAC80211_SSTAR_RC_MINSTREL=1 71 | CONFIG_MAC80211_SSTAR_RC_MINSTREL = y 72 | endif 73 | 74 | ifeq ($(CONFIG_MAC80211_SSTAR_RC_MINSTREL_HT),) 75 | SSTAR_WIFI__EXT_CCFLAGS += -DCONFIG_MAC80211_SSTAR_RC_MINSTREL_HT=1 76 | CONFIG_MAC80211_SSTAR_RC_MINSTREL_HT = y 77 | endif 78 | 79 | ifeq ($(USB_BUS),y) 80 | HIF := usb 81 | endif 82 | 83 | ifeq ($(SDIO_BUS),y) 84 | HIF := sdio 85 | endif 86 | 87 | ifeq ($(SPI_BUS),y) 88 | HIF := spi 89 | endif 90 | 91 | modules: 92 | $(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KDIR) M=$(shell pwd) modules -j8 93 | 94 | strip: 95 | $(CROSS_COMPILE)strip $(WIFI_INSTALL_DIR)/$(MODULES_NAME).ko --strip-unneeded 96 | 97 | clean: 98 | make -C $(KDIR) M=$(PWD) ARCH=$(ARCH) clean 99 | -------------------------------------------------------------------------------- /include/linux/unaligned/generic.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_UNALIGNED_GENERIC_H 2 | #define _LINUX_UNALIGNED_GENERIC_H 3 | 4 | /* 5 | * Cause a link-time error if we try an unaligned access other than 6 | * 1,2,4 or 8 bytes long 7 | */ 8 | extern void __bad_unaligned_access_size(void); 9 | 10 | #define __get_unaligned_le(ptr) ((__force typeof(*(ptr)))({ \ 11 | __builtin_choose_expr(sizeof(*(ptr)) == 1, *(ptr), \ 12 | __builtin_choose_expr(sizeof(*(ptr)) == 2, get_unaligned_le16((ptr)), \ 13 | __builtin_choose_expr(sizeof(*(ptr)) == 4, get_unaligned_le32((ptr)), \ 14 | __builtin_choose_expr(sizeof(*(ptr)) == 8, get_unaligned_le64((ptr)), \ 15 | __bad_unaligned_access_size())))); \ 16 | })) 17 | 18 | #define __get_unaligned_be(ptr) ((__force typeof(*(ptr)))({ \ 19 | __builtin_choose_expr(sizeof(*(ptr)) == 1, *(ptr), \ 20 | __builtin_choose_expr(sizeof(*(ptr)) == 2, get_unaligned_be16((ptr)), \ 21 | __builtin_choose_expr(sizeof(*(ptr)) == 4, get_unaligned_be32((ptr)), \ 22 | __builtin_choose_expr(sizeof(*(ptr)) == 8, get_unaligned_be64((ptr)), \ 23 | __bad_unaligned_access_size())))); \ 24 | })) 25 | 26 | #define __put_unaligned_le(val, ptr) ({ \ 27 | void *__gu_p = (ptr); \ 28 | switch (sizeof(*(ptr))) { \ 29 | case 1: \ 30 | *(u8 *)__gu_p = (__force u8)(val); \ 31 | break; \ 32 | case 2: \ 33 | put_unaligned_le16((__force u16)(val), __gu_p); \ 34 | break; \ 35 | case 4: \ 36 | put_unaligned_le32((__force u32)(val), __gu_p); \ 37 | break; \ 38 | case 8: \ 39 | put_unaligned_le64((__force u64)(val), __gu_p); \ 40 | break; \ 41 | default: \ 42 | __bad_unaligned_access_size(); \ 43 | break; \ 44 | } \ 45 | (void)0; }) 46 | 47 | #define __put_unaligned_be(val, ptr) ({ \ 48 | void *__gu_p = (ptr); \ 49 | switch (sizeof(*(ptr))) { \ 50 | case 1: \ 51 | *(u8 *)__gu_p = (__force u8)(val); \ 52 | break; \ 53 | case 2: \ 54 | put_unaligned_be16((__force u16)(val), __gu_p); \ 55 | break; \ 56 | case 4: \ 57 | put_unaligned_be32((__force u32)(val), __gu_p); \ 58 | break; \ 59 | case 8: \ 60 | put_unaligned_be64((__force u64)(val), __gu_p); \ 61 | break; \ 62 | default: \ 63 | __bad_unaligned_access_size(); \ 64 | break; \ 65 | } \ 66 | (void)0; }) 67 | 68 | #endif /* _LINUX_UNALIGNED_GENERIC_H */ 69 | -------------------------------------------------------------------------------- /hal_apollo/apollo_plat.h: -------------------------------------------------------------------------------- 1 | /* * 2 | * Copyright (c) 2016, sigmastar 3 | * Author: 4 | * 5 | *Based on apollo code 6 | * Copyright (C) ST-Ericsson SA 2011 7 | * 8 | * Author: Dmitry Tarnyagin 9 | * License terms: GNU General Public License (GPL) version 2 10 | */ 11 | 12 | #ifndef SSTAR_APOLLO_PLAT_H_INCLUDED 13 | #define SSTAR_APOLLO_PLAT_H_INCLUDED 14 | 15 | /* 16 | ********************************************************* 17 | * 18 | *PLATFORM_XUNWEI: based on linux3.0 19 | * 20 | *PLATFORM_SUN6I: based on linux3.3 21 | * 22 | *PLATFORM_FRIENDLY:based on linux3.086 23 | * 24 | ********************************************************* 25 | */ 26 | #define PLATFORM_XUNWEI (1) 27 | #define PLATFORM_SUN6I (2) 28 | #define PLATFORM_FRIENDLY (3) 29 | #define PLATFORM_SUN6I_64 (4) 30 | #define PLATFORM_CDLINUX (12) 31 | #define PLATFORM_AMLOGIC_S805 (13) 32 | #define PLATFORM_AMLOGIC_905 (8) 33 | 34 | #ifndef SSTAR_WIFI_PLATFORM 35 | #define SSTAR_WIFI_PLATFORM PLATFORM_XUNWEI 36 | #endif 37 | 38 | #define APOLLO_1505 0 39 | #define APOLLO_1601 1 40 | #define APOLLO_1606 0 41 | #define APOLLO_C 2 42 | #define APOLLO_D 3 43 | #define APOLLO_E 4 44 | #define APOLLO_F 5 45 | #define ATHENA_B 6 46 | #define ATHENA_LITE 7 47 | #define ATHENA_LITE_ECO 8 48 | #define ARES_A 9 49 | #define ARES_B 10 50 | #define HERA 11 51 | 52 | 53 | #ifndef PROJ_TYPE 54 | #define PROJ_TYPE ATHENA_B 55 | #endif 56 | 57 | #define CRYSTAL_MODE 0 58 | #define EXTERNAL_MODE 1 59 | #ifndef DCXO_TYPE 60 | #define DCXO_TYPE CRYSTAL_MODE 61 | #endif 62 | 63 | #define DPLL_CLOCK_26M 0 64 | #define DPLL_CLOCK_40M 1 65 | #define DPLL_CLOCK_24M 2 66 | 67 | #ifndef DPLL_CLOCK 68 | #define DPLL_CLOCK DPLL_CLOCK_40M 69 | #endif 70 | 71 | #include 72 | 73 | struct Sstar_platform_data { 74 | const char *mmc_id; 75 | const int irq_gpio; 76 | const int power_gpio; 77 | const int reset_gpio; 78 | int (*power_ctrl)(const struct Sstar_platform_data *pdata, 79 | bool enable); 80 | int (*clk_ctrl)(const struct Sstar_platform_data *pdata, 81 | bool enable); 82 | int (*insert_ctrl)(const struct Sstar_platform_data *pdata, 83 | bool enable); 84 | }; 85 | 86 | /* Declaration only. Should be implemented in arch/xxx/mach-yyy */ 87 | struct Sstar_platform_data *Sstar_get_platform_data(void); 88 | 89 | 90 | 91 | #endif /* SSTAR_APOLLO_PLAT_H_INCLUDED */ 92 | -------------------------------------------------------------------------------- /hal_apollo/ap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * mac80211 STA and AP API for mac80211 sigmastar APOLLO drivers 3 | * * 4 | * Copyright (c) 2016, sigmastar 5 | * Author: 6 | * 7 | *Based on apollo code 8 | * Copyright (c) 2010, ST-Ericsson 9 | * Author: Dmitry Tarnyagin 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License version 2 as 13 | * published by the Free Software Foundation. 14 | */ 15 | 16 | #ifndef AP_H_INCLUDED 17 | #define AP_H_INCLUDED 18 | 19 | #define SSTAR_APOLLO_NOA_NOTIFICATION_DELAY 10 20 | 21 | int Sstar_set_tim(struct ieee80211_hw *dev, struct ieee80211_sta *sta, 22 | bool set); 23 | int Sstar_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 24 | struct ieee80211_sta *sta); 25 | int Sstar_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 26 | struct ieee80211_sta *sta); 27 | void Sstar_sta_notify(struct ieee80211_hw *dev, struct ieee80211_vif *vif, 28 | enum sta_notify_cmd notify_cmd, 29 | struct ieee80211_sta *sta); 30 | void Sstar_bss_info_changed(struct ieee80211_hw *dev, 31 | struct ieee80211_vif *vif, 32 | struct ieee80211_bss_conf *info, 33 | u32 changed); 34 | int Sstar_ampdu_action(struct ieee80211_hw *hw, 35 | struct ieee80211_vif *vif, 36 | enum ieee80211_ampdu_mlme_action action, 37 | struct ieee80211_sta *sta, u16 tid, u16 *ssn, 38 | u8 buf_size); 39 | 40 | void Sstar_suspend_resume(struct Sstar_vif *priv, 41 | struct wsm_suspend_resume *arg); 42 | void Sstar_set_tim_work(struct work_struct *work); 43 | void Sstar_set_cts_work(struct work_struct *work); 44 | void Sstar_multicast_start_work(struct work_struct *work); 45 | void Sstar_multicast_stop_work(struct work_struct *work); 46 | void Sstar_mcast_timeout(unsigned long arg); 47 | int Sstar_find_link_id(struct Sstar_vif *priv, const u8 *mac); 48 | int Sstar_alloc_link_id(struct Sstar_vif *priv, const u8 *mac); 49 | void Sstar_link_id_work(struct work_struct *work); 50 | void Sstar_link_id_gc_work(struct work_struct *work); 51 | void Sstar_notify_noa(struct Sstar_vif *priv, int delay); 52 | int ABwifi_unmap_link(struct Sstar_vif *priv, int link_id); 53 | void Sstar_ht_info_update_work(struct work_struct *work); 54 | int Sstar_start_monitor_mode(struct Sstar_vif *priv, 55 | struct ieee80211_channel *chan); 56 | int Sstar_stop_monitor_mode(struct Sstar_vif *priv); 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/led.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006, Johannes Berg 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 2 as 6 | * published by the Free Software Foundation. 7 | */ 8 | 9 | #include 10 | #include 11 | #include 12 | #include "ieee80211_i.h" 13 | 14 | #ifdef CONFIG_MAC80211_SSTAR_LEDS 15 | void ieee80211_led_rx(struct ieee80211_local *local); 16 | void ieee80211_led_tx(struct ieee80211_local *local, int q); 17 | void ieee80211_led_assoc(struct ieee80211_local *local, 18 | bool associated); 19 | void ieee80211_led_radio(struct ieee80211_local *local, 20 | bool enabled); 21 | void ieee80211_led_names(struct ieee80211_local *local); 22 | void ieee80211_led_init(struct ieee80211_local *local); 23 | void ieee80211_led_exit(struct ieee80211_local *local); 24 | void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local, 25 | unsigned int types_on, unsigned int types_off); 26 | #else 27 | static inline void ieee80211_led_rx(struct ieee80211_local *local) 28 | { 29 | } 30 | static inline void ieee80211_led_tx(struct ieee80211_local *local, int q) 31 | { 32 | } 33 | static inline void ieee80211_led_assoc(struct ieee80211_local *local, 34 | bool associated) 35 | { 36 | } 37 | static inline void ieee80211_led_radio(struct ieee80211_local *local, 38 | bool enabled) 39 | { 40 | } 41 | static inline void ieee80211_led_names(struct ieee80211_local *local) 42 | { 43 | } 44 | static inline void ieee80211_led_init(struct ieee80211_local *local) 45 | { 46 | } 47 | static inline void ieee80211_led_exit(struct ieee80211_local *local) 48 | { 49 | } 50 | static inline void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local, 51 | unsigned int types_on, 52 | unsigned int types_off) 53 | { 54 | } 55 | #endif 56 | 57 | static inline void 58 | ieee80211_tpt_led_trig_tx(struct ieee80211_local *local, __le16 fc, int bytes) 59 | { 60 | #ifdef CONFIG_MAC80211_SSTAR_LEDS 61 | if (local->tpt_led_trigger && ieee80211_is_data(fc)) 62 | local->tpt_led_trigger->tx_bytes += bytes; 63 | #endif 64 | } 65 | 66 | static inline void 67 | ieee80211_tpt_led_trig_rx(struct ieee80211_local *local, __le16 fc, int bytes) 68 | { 69 | #ifdef CONFIG_MAC80211_SSTAR_LEDS 70 | if (local->tpt_led_trigger && ieee80211_is_data(fc)) 71 | local->tpt_led_trigger->rx_bytes += bytes; 72 | #endif 73 | } 74 | -------------------------------------------------------------------------------- /include/linux/compat-2.6.38.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_26_38_COMPAT_H 2 | #define LINUX_26_38_COMPAT_H 3 | 4 | #include 5 | 6 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)) 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | /* rename member in struct mmc_host in include/linux/mmc/host.h */ 13 | #define max_segs max_hw_segs 14 | 15 | 16 | /* Exponentially weighted moving average (EWMA) */ 17 | 18 | /* For more documentation see lib/average.c */ 19 | #define pr_warn pr_warning 20 | #define create_freezable_workqueue create_freezeable_workqueue 21 | 22 | static inline int skb_checksum_start_offset(const struct sk_buff *skb) 23 | { 24 | return skb->csum_start - skb_headroom(skb); 25 | } 26 | 27 | /* from include/linux/printk.h */ 28 | #define pr_emerg_once(fmt, ...) \ 29 | printk_once(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) 30 | #define pr_alert_once(fmt, ...) \ 31 | printk_once(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) 32 | #define pr_crit_once(fmt, ...) \ 33 | printk_once(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) 34 | #define pr_err_once(fmt, ...) \ 35 | printk_once(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) 36 | #define pr_warn_once(fmt, ...) \ 37 | printk_once(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) 38 | #define pr_notice_once(fmt, ...) \ 39 | printk_once(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) 40 | #define pr_info_once(fmt, ...) \ 41 | printk_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) 42 | #define pr_cont_once(fmt, ...) \ 43 | printk_once(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__) 44 | #if defined(DEBUG) 45 | #define pr_debug_once(fmt, ...) \ 46 | printk_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) 47 | #else 48 | #define pr_debug_once(fmt, ...) \ 49 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) 50 | #endif 51 | 52 | /* include/linux/netdevice.h */ 53 | #define alloc_netdev_mqs(sizeof_priv, name, setup, txqs, rxqs) \ 54 | alloc_netdev_mq(sizeof_priv, name, setup, \ 55 | max_t(unsigned int, txqs, rxqs)) 56 | 57 | #define ETH_P_LINK_CTL 0x886c /* HPNA, wlan link local tunnel */ 58 | 59 | /** 60 | * is_unicast_ether_addr - Determine if the Ethernet address is unicast 61 | * @addr: Pointer to a six-byte array containing the Ethernet address 62 | * 63 | * Return true if the address is a unicast address. 64 | */ 65 | static inline int is_unicast_ether_addr(const u8 *addr) 66 | { 67 | return !is_multicast_ether_addr(addr); 68 | } 69 | 70 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)) */ 71 | 72 | #endif /* LINUX_26_38_COMPAT_H */ 73 | -------------------------------------------------------------------------------- /hal_apollo/dbg_event.c: -------------------------------------------------------------------------------- 1 | #define DBG_EVENT_LOG 2 | #ifdef DBG_EVENT_LOG 3 | #include 4 | #define ELOG_LEN 64 5 | struct elog_id{ 6 | unsigned int id; 7 | unsigned int valid; 8 | unsigned long tim; 9 | unsigned int data; 10 | }; 11 | struct elog_s { 12 | u8 start; 13 | u8 index; 14 | u16 len; 15 | struct elog_id e_id[ELOG_LEN]; 16 | }; 17 | 18 | #define EVENT_MEM_ALIGN 8 19 | #ifndef ALIGN 20 | #define ALIGN(a,b) (((a) + ((b) - 1)) & (~((b)-1))) 21 | #endif 22 | 23 | struct elog_s elogdata; 24 | 25 | struct elog_s *elog = (struct elog_s * )&elogdata; 26 | void ELOG_INIT(void) 27 | { 28 | int len =0; 29 | elog = (struct elog_s * )&elogdata; 30 | //elog = (struct elog_s * )ALIGN((u32)&SM_Region.data[0],EVENT_MEM_ALIGN); 31 | //ASSERT((SM_MEM_LEN-sizeof(elog)-EVENT_MEM_ALIGN)>sizeof(struct elog_id),0x99); 32 | //len = (SM_MEM_LEN-sizeof(elog)-EVENT_MEM_ALIGN)/sizeof(struct elog_id); 33 | //if(len > ELOG_LEN) 34 | len = ELOG_LEN; 35 | memset(elog,0,sizeof(struct elog_id)); 36 | elog->start = 1; 37 | elog->index = 0; 38 | elog->len = len; 39 | Sstar_printk_always("ELOG_INIT len %d \n",elog->len); 40 | 41 | } 42 | 43 | void ELOG_Add(u8 id,u32 data) 44 | { 45 | if(elog->start ){ 46 | elog->e_id[elog->index].id = id; 47 | elog->e_id[elog->index].data = data; 48 | elog->e_id[elog->index].tim = jiffies; 49 | elog->e_id[elog->index].valid = 1; 50 | elog->index++; 51 | if(elog->index >= elog->len){ 52 | elog->index = 0; 53 | } 54 | } 55 | 56 | } 57 | void ELOG_Stop(void) 58 | { 59 | elog->start = 0; 60 | Sstar_printk_always("E_Stop\n"); 61 | } 62 | void ELOG_Start(void) 63 | { 64 | elog->start = 1; 65 | } 66 | 67 | void ELOG_Clear(void) 68 | { 69 | int i=0; 70 | elog->index=0; 71 | while(ilen){ 72 | elog->e_id[i].valid = 0; 73 | i++; 74 | } 75 | } 76 | 77 | void ELOG_Show(void) 78 | { 79 | u32 tim = 0; 80 | u8 index = elog->index; 81 | int loop = 0; 82 | Sstar_printk_always("ELOG_Show id:data:tim (%d:%d)\n",elog->index,elog->len); 83 | do { 84 | loop++; 85 | if(index >= elog->len){ 86 | index = 0; 87 | } 88 | if(!elog->e_id[index].valid){ 89 | index++; 90 | continue; 91 | } 92 | Sstar_printk_always("%02x|%08x|%06lx\n",elog->e_id[index].id, 93 | elog->e_id[index].data, 94 | (elog->e_id[index].tim-tim)); 95 | tim = elog->e_id[index].tim; 96 | index++; 97 | }while(loop < elog->len);//(index!=elog->index); 98 | Sstar_printk_always("ELOG_Show end\n"); 99 | } 100 | #endif //if DBG_EVENT_LOG 101 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/michael.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Michael MIC implementation - optimized for TKIP MIC operations 3 | * Copyright 2002-2003, Instant802 Networks, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | */ 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include "michael.h" 15 | 16 | static void michael_block(struct michael_mic_ctx *mctx, u32 val) 17 | { 18 | mctx->l ^= val; 19 | mctx->r ^= rol32(mctx->l, 17); 20 | mctx->l += mctx->r; 21 | mctx->r ^= ((mctx->l & 0xff00ff00) >> 8) | 22 | ((mctx->l & 0x00ff00ff) << 8); 23 | mctx->l += mctx->r; 24 | mctx->r ^= rol32(mctx->l, 3); 25 | mctx->l += mctx->r; 26 | mctx->r ^= ror32(mctx->l, 2); 27 | mctx->l += mctx->r; 28 | } 29 | 30 | static void michael_mic_hdr(struct michael_mic_ctx *mctx, const u8 *key, 31 | struct ieee80211_hdr *hdr) 32 | { 33 | u8 *da, *sa, tid; 34 | 35 | da = ieee80211_get_DA(hdr); 36 | sa = ieee80211_get_SA(hdr); 37 | if (ieee80211_is_data_qos(hdr->frame_control)) 38 | tid = *ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK; 39 | else 40 | tid = 0; 41 | 42 | mctx->l = get_unaligned_le32(key); 43 | mctx->r = get_unaligned_le32(key + 4); 44 | 45 | /* 46 | * A pseudo header (DA, SA, Priority, 0, 0, 0) is used in Michael MIC 47 | * calculation, but it is _not_ transmitted 48 | */ 49 | michael_block(mctx, get_unaligned_le32(da)); 50 | michael_block(mctx, get_unaligned_le16(&da[4]) | 51 | (get_unaligned_le16(sa) << 16)); 52 | michael_block(mctx, get_unaligned_le32(&sa[2])); 53 | michael_block(mctx, tid); 54 | } 55 | 56 | void michael_mic(const u8 *key, struct ieee80211_hdr *hdr, 57 | const u8 *data, size_t data_len, u8 *mic) 58 | { 59 | u32 val; 60 | size_t block, blocks, left; 61 | struct michael_mic_ctx mctx; 62 | 63 | michael_mic_hdr(&mctx, key, hdr); 64 | 65 | /* Real data */ 66 | blocks = data_len / 4; 67 | left = data_len % 4; 68 | 69 | for (block = 0; block < blocks; block++) 70 | michael_block(&mctx, get_unaligned_le32(&data[block * 4])); 71 | 72 | /* Partial block of 0..3 bytes and padding: 0x5a + 4..7 zeros to make 73 | * total length a multiple of 4. */ 74 | val = 0x5a; 75 | while (left > 0) { 76 | val <<= 8; 77 | left--; 78 | val |= data[blocks * 4 + left]; 79 | } 80 | 81 | michael_block(&mctx, val); 82 | michael_block(&mctx, 0); 83 | 84 | put_unaligned_le32(mctx.l, mic); 85 | put_unaligned_le32(mctx.r, mic + 4); 86 | } 87 | -------------------------------------------------------------------------------- /Makefile.build.kernel: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | # Makefile For Kernel 3 | ############################################################################ 4 | 5 | NOSTDINC_FLAGS := -I$(src)/include/ \ 6 | -include $(src)/include/linux/compat-2.6.h \ 7 | -DCOMPAT_STATIC 8 | 9 | KBUILD_CFLAGS += -Wno-address 10 | 11 | ifneq ($(SSTAR_MAKEFILE_SUB),y) 12 | export 13 | 14 | ifeq ($(CONFIG_SSTAR_MODULE_NAME),) 15 | CONFIG_SSTAR_MODULE_NAME = Sstar_wifi 16 | endif 17 | 18 | ifeq ($(CONFIG_SSTAR_WIFIIF1_NAME),) 19 | CONFIG_SSTAR_WIFIIF1_NAME = "wlan%d" 20 | endif 21 | 22 | ifeq ($(CONFIG_SSTAR_WIFIIF2_NAME),) 23 | CONFIG_SSTAR_WIFIIF2_NAME = "p2p%d" 24 | endif 25 | 26 | ifeq ($(CONFIG_SSTAR_FW_NAME),) 27 | CONFIG_SSTAR_FW_NAME="fw.bin" 28 | endif 29 | 30 | export 31 | SDIO_HOST ?= $(shell echo $(CONFIG_SSTAR_SDIO_MMCx)) 32 | IF1NAME ?= $(shell echo $(CONFIG_SSTAR_WIFIIF1_NAME)) 33 | IF2NAME ?= $(shell echo $(CONFIG_SSTAR_WIFIIF2_NAME)) 34 | FW ?= $(shell echo $(CONFIG_SSTAR_FW_NAME)) 35 | MODULES_NAME ?= $(shell echo $(CONFIG_SSTAR_MODULE_NAME)) 36 | LOAD_FW_H ?= $(CONFIG_SSTAR_USE_FIRMWARE_H) 37 | SKB_DEBUG ?= $(CONFIG_SSTAR_FUNC_SKB_DEBUG) 38 | MEM_DEBUG ?= $(CONFIG_SSTAR_FUNC_SKB_DEBUG) 39 | BRIDGE ?= $(CONFIG_SSTAR_SUPPORT_BRIDGE) 40 | MONITOR ?= $(CONFIG_SSTAR_FUNC_MONITOR) 41 | EARLYSUSPEND ?= $(CONFIG_SSTAR_FUNC_EARLYSUSPEND) 42 | NOTXCONFIRM ?= $(CONFIG_SSTAR_FUNC_NOTXCONFIRM) 43 | CH5G ?= $(CONFIG_SSTAR_FUNC_CHANNEL_5G_PRETEND_2G) 44 | USBAGGTX ?= $(CONFIG_SSTAR_FUNC_USB_AGGRTX) 45 | USBDMABUFF ?= $(CONFIG_SSTAR_FUNC_USB_DMABUFF) 46 | USBCMDENHANCE ?= $(CONFIG_SSTAR_FUNC_USB_CMD_ENHANCE) 47 | USBDATAENHANCE ?= $(CONFIG_SSTAR_FUNC_USB_DATA_ENHANCE) 48 | PMRELODDFW ?= $(CONFIG_SSTAR_FUNC_PS_WAKEUP_RELOAD_FW) 49 | USB_BUS ?= $(CONFIG_SSTAR_USB_BUS) 50 | SDIO_BUS ?= $(CONFIG_SSTAR_SDIO_BUS) 51 | SPI_BUS ?= $(CONFIG_SSTAR_SPI_BUS) 52 | CHECKSUM ?= $(CONFIG_SSTAR_FUNC_HW_CHSUM) 53 | CONFIG_ATHENAB ?= $(CONFIG_SSW101x)$(CONFIG_SSW101) 54 | CONFIG_ARESB ?= $(CONFIG_SSW101B) 55 | CONFIG_HERA ?= $(CONFIG_SSTAR6041) 56 | CONFIG_NOT_SUPPORT_40M_CHW ?= $(CONFIG_SSW101x) 57 | DRVLOADERFAST ?= $(CONFIG_SSTAR_FUNC_DRV_LOADER_FAST) 58 | PRI_IE ?= $(CONFIG_SSTAR_FUNC_PRIVE_IE) 59 | ############################################################# 60 | #SSTAR6041 ONLY USE SDIO 61 | ifeq ($(CONFIG_HERA),y) 62 | SDIO_BUS = y 63 | endif 64 | ifeq ($(CONFIG_SSTAR_SDIO_24M),y) 65 | ifeq ($(CONFIG_ATHENAB),y) 66 | CONFIG_ATHENAB_24M = y 67 | CONFIG_ATHENAB = n 68 | endif 69 | endif 70 | endif 71 | 72 | obj-$(CONFIG_SSTAR_APOLLO) += hal_apollo/ 73 | -------------------------------------------------------------------------------- /include/linux/compat-2.6.22.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_26_22_COMPAT_H 2 | #define LINUX_26_22_COMPAT_H 3 | 4 | #include 5 | 6 | /* Compat work for 2.6.21 */ 7 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)) 8 | 9 | #include 10 | #include 11 | 12 | /* reuse ax25_ptr */ 13 | #define ieee80211_ptr ax25_ptr 14 | 15 | #ifdef CONFIG_AX25 16 | #error Compat reuses the AX.25 pointer so that may not be enabled! 17 | #endif 18 | 19 | static inline unsigned char *skb_mac_header(const struct sk_buff *skb) 20 | { 21 | return skb->mac.raw; 22 | } 23 | 24 | static inline void skb_set_mac_header(struct sk_buff *skb, int offset) 25 | { 26 | skb->mac.raw = skb->data + offset; 27 | } 28 | 29 | static inline void skb_reset_mac_header(struct sk_buff *skb) 30 | { 31 | skb->mac.raw = skb->data; 32 | } 33 | 34 | static inline void skb_reset_network_header(struct sk_buff *skb) 35 | { 36 | skb->nh.raw = skb->data; 37 | } 38 | 39 | static inline void skb_set_network_header(struct sk_buff *skb, int offset) 40 | { 41 | skb->nh.raw = skb->data + offset; 42 | } 43 | 44 | static inline void skb_set_transport_header(struct sk_buff *skb, int offset) 45 | { 46 | skb->h.raw = skb->data + offset; 47 | } 48 | 49 | static inline unsigned char *skb_transport_header(struct sk_buff *skb) 50 | { 51 | return skb->h.raw; 52 | } 53 | 54 | static inline unsigned char *skb_network_header(const struct sk_buff *skb) 55 | { 56 | return skb->nh.raw; 57 | } 58 | 59 | static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb) 60 | { 61 | return skb->tail; 62 | } 63 | 64 | static inline struct iphdr *ip_hdr(const struct sk_buff *skb) 65 | { 66 | return (struct iphdr *)skb_network_header(skb); 67 | } 68 | 69 | static inline void skb_copy_from_linear_data(const struct sk_buff *skb, 70 | void *to, 71 | const unsigned int len) 72 | { 73 | memcpy(to, skb->data, len); 74 | } 75 | 76 | static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb, 77 | const int offset, void *to, 78 | const unsigned int len) 79 | { 80 | memcpy(to, skb->data + offset, len); 81 | } 82 | 83 | #define __maybe_unused __attribute__((unused)) 84 | 85 | #define uninitialized_var(x) x = x 86 | 87 | /* This will lead to very weird behaviour... */ 88 | #define NLA_BINARY NLA_STRING 89 | 90 | static inline int pci_set_mwi(struct pci_dev *dev) 91 | { 92 | return -ENOSYS; 93 | } 94 | 95 | static inline void pci_clear_mwi(struct pci_dev *dev) 96 | { 97 | } 98 | 99 | #define list_first_entry(ptr, type, member) \ 100 | list_entry((ptr)->next, type, member) 101 | 102 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)) */ 103 | 104 | #endif /* LINUX_26_22_COMPAT_H */ 105 | -------------------------------------------------------------------------------- /include/linux/compat-3.4.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_3_4_COMPAT_H 2 | #define LINUX_3_4_COMPAT_H 3 | 4 | #include 5 | 6 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) 7 | 8 | #include 9 | #include 10 | 11 | extern int simple_open(struct inode *inode, struct file *file); 12 | 13 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) 14 | #define skb_add_rx_frag(skb, i, page, off, size, truesize) \ 15 | v2_6_28_skb_add_rx_frag(skb, i, page, off, size) 16 | #else 17 | #define skb_add_rx_frag(skb, i, page, off, size, truesize) \ 18 | skb_add_rx_frag(skb, i, page, off, size) 19 | #endif 20 | 21 | #ifdef CONFIG_X86_X32_ABI 22 | #define COMPAT_USE_64BIT_TIME \ 23 | (!!(task_pt_regs(current)->orig_ax & __X32_SYSCALL_BIT)) 24 | #else 25 | #define COMPAT_USE_64BIT_TIME 0 26 | #endif 27 | 28 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)) 29 | static inline void eth_hw_addr_random(struct net_device *dev) 30 | { 31 | #error eth_hw_addr_random() needs to be implemented for < 2.6.12 32 | } 33 | #else /* kernels >= 2.6.12 */ 34 | 35 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) 36 | static inline void eth_hw_addr_random(struct net_device *dev) 37 | { 38 | get_random_bytes(dev->dev_addr, ETH_ALEN); 39 | dev->dev_addr[0] &= 0xfe; /* clear multicast bit */ 40 | dev->dev_addr[0] |= 0x02; /* set local assignment bit (IEEE802) */ 41 | } 42 | #else /* kernels >= 2.6.31 */ 43 | 44 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) 45 | /* So this is 2.6.31..2.6.35 */ 46 | 47 | /* Just have the flags present, they won't really mean anything though */ 48 | #define NET_ADDR_PERM 0 /* address is permanent (default) */ 49 | #define NET_ADDR_RANDOM 1 /* address is generated randomly */ 50 | #define NET_ADDR_STOLEN 2 /* address is stolen from other device */ 51 | 52 | static inline void eth_hw_addr_random(struct net_device *dev) 53 | { 54 | random_ether_addr(dev->dev_addr); 55 | } 56 | 57 | #else /* 2.6.36 and on */ 58 | static inline void eth_hw_addr_random(struct net_device *dev) 59 | { 60 | dev_hw_addr_random(dev, dev->dev_addr); 61 | } 62 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) */ 63 | 64 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) */ 65 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)) */ 66 | 67 | /* source include/linux/pci.h */ 68 | /** 69 | * module_pci_driver() - Helper macro for registering a PCI driver 70 | * @__pci_driver: pci_driver struct 71 | * 72 | * Helper macro for PCI drivers which do not do anything special in module 73 | * init/exit. This eliminates a lot of boilerplate. Each module may only 74 | * use this macro once, and calling it replaces module_init() and module_exit() 75 | */ 76 | #define module_pci_driver(__pci_driver) \ 77 | module_driver(__pci_driver, pci_register_driver, \ 78 | pci_unregister_driver) 79 | 80 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) */ 81 | 82 | #endif /* LINUX_5_4_COMPAT_H */ 83 | -------------------------------------------------------------------------------- /hal_apollo/scan.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Scan interface for sigmastar APOLLO mac80211 drivers 3 | * * 4 | * Copyright (c) 2016, sigmastar 5 | * Author: 6 | * 7 | *Based on apollo code 8 | * Copyright (c) 2010, ST-Ericsson 9 | * Author: Dmitry Tarnyagin 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License version 2 as 13 | * published by the Free Software Foundation. 14 | */ 15 | 16 | #ifndef SCAN_H_INCLUDED 17 | #define SCAN_H_INCLUDED 18 | 19 | #include 20 | #include "wsm.h" 21 | 22 | /* external */ struct sk_buff; 23 | /* external */ struct cfg80211_scan_request; 24 | /* external */ struct ieee80211_channel; 25 | /* external */ struct ieee80211_hw; 26 | /* external */ struct work_struct; 27 | 28 | struct Sstar_scan { 29 | struct semaphore lock; 30 | struct work_struct work; 31 | #ifdef ROAM_OFFLOAD 32 | struct work_struct swork; /* scheduled scan work */ 33 | struct cfg80211_sched_scan_request *sched_req; 34 | #endif /*ROAM_OFFLOAD*/ 35 | struct delayed_work timeout; 36 | struct cfg80211_scan_request *req; 37 | struct ieee80211_scan_req_wrap *req_wrap; 38 | struct ieee80211_channel **begin; 39 | struct ieee80211_channel **curr; 40 | struct ieee80211_channel **end; 41 | struct wsm_ssid ssids[WSM_SCAN_MAX_NUM_OF_SSIDS]; 42 | int output_power; 43 | int n_ssids; 44 | int status; 45 | atomic_t in_progress; 46 | /* Direct probe requests workaround */ 47 | struct delayed_work probe_work; 48 | int direct_probe; 49 | u8 if_id; 50 | int wait_complete; 51 | struct work_struct smartwork; 52 | struct work_struct smartsetChanwork; 53 | struct work_struct smartstopwork; 54 | u8 scan_smartconfig; 55 | u8 cca; 56 | u8 passive; 57 | }; 58 | 59 | int Sstar_hw_scan(struct ieee80211_hw *hw, 60 | struct ieee80211_vif *vif, 61 | struct ieee80211_scan_req_wrap *req_wrap); 62 | #ifdef ROAM_OFFLOAD 63 | int Sstar_hw_sched_scan_start(struct ieee80211_hw *hw, 64 | struct ieee80211_vif *vif, 65 | struct cfg80211_sched_scan_request *req, 66 | struct ieee80211_sched_scan_ies *ies); 67 | void Sstar_hw_sched_scan_stop(struct Sstar_common *priv); 68 | void Sstar_sched_scan_work(struct work_struct *work); 69 | #endif /*ROAM_OFFLOAD*/ 70 | void Sstar_scan_work(struct work_struct *work); 71 | void Sstar_scan_timeout(struct work_struct *work); 72 | void etf_scan_end_work(struct work_struct *work); 73 | void Sstar_scan_complete_cb(struct Sstar_common *priv, 74 | struct wsm_scan_complete *arg); 75 | 76 | /* ******************************************************************** */ 77 | /* Raw probe requests TX workaround */ 78 | void Sstar_probe_work(struct work_struct *work); 79 | void Sstar_scan_listenning_restart_delayed(struct Sstar_vif *priv); 80 | 81 | #ifdef CONFIG_SSTAR_APOLLO_TESTMODE 82 | /* Advance Scan Timer */ 83 | void Sstar_advance_scan_timeout(struct work_struct *work); 84 | #endif 85 | void Sstar_cancel_hw_scan(struct ieee80211_hw *hw,struct ieee80211_vif *vif); 86 | void Sstar_wait_scan_complete_sync(struct Sstar_common *hw_priv); 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/spectmgmt.c: -------------------------------------------------------------------------------- 1 | /* 2 | * spectrum management 3 | * 4 | * Copyright 2003, Jouni Malinen 5 | * Copyright 2002-2005, Instant802 Networks, Inc. 6 | * Copyright 2005-2006, Devicescape Software, Inc. 7 | * Copyright 2006-2007 Jiri Benc 8 | * Copyright 2007, Michael Wu 9 | * Copyright 2007-2008, Intel Corporation 10 | * Copyright 2008, Johannes Berg 11 | * 12 | * This program is free software; you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License version 2 as 14 | * published by the Free Software Foundation. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include "ieee80211_i.h" 21 | #include "sta_info.h" 22 | #include "wme.h" 23 | 24 | static void ieee80211_send_refuse_measurement_request(struct ieee80211_sub_if_data *sdata, 25 | struct ieee80211_msrment_ie *request_ie, 26 | const u8 *da, const u8 *bssid, 27 | u8 dialog_token) 28 | { 29 | struct ieee80211_local *local = sdata->local; 30 | struct sk_buff *skb; 31 | struct Sstar_ieee80211_mgmt *msr_report; 32 | 33 | skb = Sstar_dev_alloc_skb(sizeof(*msr_report) + local->hw.extra_tx_headroom + 34 | sizeof(struct ieee80211_msrment_ie)); 35 | if (!skb) 36 | return; 37 | 38 | Sstar_skb_reserve(skb, local->hw.extra_tx_headroom); 39 | msr_report = (struct Sstar_ieee80211_mgmt *)Sstar_skb_put(skb, 24); 40 | memset(msr_report, 0, 24); 41 | memcpy(msr_report->da, da, ETH_ALEN); 42 | memcpy(msr_report->sa, sdata->vif.addr, ETH_ALEN); 43 | memcpy(msr_report->bssid, bssid, ETH_ALEN); 44 | msr_report->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | 45 | IEEE80211_STYPE_ACTION); 46 | 47 | Sstar_skb_put(skb, 1 + sizeof(msr_report->u.action.u.measurement)); 48 | msr_report->u.action.category = WLAN_CATEGORY_SPECTRUM_MGMT; 49 | msr_report->u.action.u.measurement.action_code = 50 | WLAN_ACTION_SPCT_MSR_RPRT; 51 | msr_report->u.action.u.measurement.dialog_token = dialog_token; 52 | 53 | msr_report->u.action.u.measurement.element_id = SSTAR_WLAN_EID_MEASURE_REPORT; 54 | msr_report->u.action.u.measurement.length = 55 | sizeof(struct ieee80211_msrment_ie); 56 | 57 | memset(&msr_report->u.action.u.measurement.msr_elem, 0, 58 | sizeof(struct ieee80211_msrment_ie)); 59 | msr_report->u.action.u.measurement.msr_elem.token = request_ie->token; 60 | msr_report->u.action.u.measurement.msr_elem.mode |= 61 | IEEE80211_SPCT_MSR_RPRT_MODE_REFUSED; 62 | msr_report->u.action.u.measurement.msr_elem.type = request_ie->type; 63 | 64 | ieee80211_tx_skb(sdata, skb); 65 | } 66 | 67 | void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, 68 | struct Sstar_ieee80211_mgmt *mgmt, 69 | size_t len) 70 | { 71 | /* 72 | * Ignoring measurement request is spec violation. 73 | * Mandatory measurements must be reported optional 74 | * measurements might be refused or reported incapable 75 | * For now just refuse 76 | * TODO: Answer basic measurement as unmeasured 77 | */ 78 | ieee80211_send_refuse_measurement_request(sdata, 79 | &mgmt->u.action.u.measurement.msr_elem, 80 | mgmt->sa, mgmt->bssid, 81 | mgmt->u.action.u.measurement.dialog_token); 82 | } 83 | -------------------------------------------------------------------------------- /include/linux/compat-3.0.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_3_0_COMPAT_H 2 | #define LINUX_3_0_COMPAT_H 3 | 4 | #include 5 | 6 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)) 7 | 8 | /* 9 | * since commit 1c5cae815d19ffe02bdfda1260949ef2b1806171 10 | * "net: call dev_alloc_name from register_netdevice" dev_alloc_name is 11 | * called automatically. This is not implemented in older kernel 12 | * versions so it will result in device wrong names. 13 | */ 14 | static inline int register_netdevice_name(struct net_device *dev) 15 | { 16 | int err; 17 | 18 | if (strchr(dev->name, '%')) { 19 | err = dev_alloc_name(dev, dev->name); 20 | if (err < 0) 21 | return err; 22 | } 23 | 24 | return register_netdevice(dev); 25 | } 26 | 27 | #define register_netdevice(dev) register_netdevice_name(dev) 28 | 29 | /* BCMA core, see drivers/bcma/ */ 30 | #ifndef BCMA_CORE 31 | /* Broadcom's specific AMBA core, see drivers/bcma/ */ 32 | struct bcma_device_id { 33 | __u16 manuf; 34 | __u16 id; 35 | __u8 rev; 36 | __u8 class; 37 | }; 38 | #define BCMA_CORE(_manuf, _id, _rev, _class) \ 39 | { .manuf = _manuf, .id = _id, .rev = _rev, .class = _class, } 40 | #define BCMA_CORETABLE_END \ 41 | { 0, }, 42 | 43 | #define BCMA_ANY_MANUF 0xFFFF 44 | #define BCMA_ANY_ID 0xFFFF 45 | #define BCMA_ANY_REV 0xFF 46 | #define BCMA_ANY_CLASS 0xFF 47 | #endif /* BCMA_CORE */ 48 | 49 | int mac_pton(const char *s, u8 *mac); 50 | 51 | int __must_check kstrtoull_from_user(const char __user *s, size_t count, unsigned int base, unsigned long long *res); 52 | int __must_check kstrtoll_from_user(const char __user *s, size_t count, unsigned int base, long long *res); 53 | int __must_check kstrtoul_from_user(const char __user *s, size_t count, unsigned int base, unsigned long *res); 54 | int __must_check kstrtol_from_user(const char __user *s, size_t count, unsigned int base, long *res); 55 | int __must_check kstrtouint_from_user(const char __user *s, size_t count, unsigned int base, unsigned int *res); 56 | int __must_check kstrtoint_from_user(const char __user *s, size_t count, unsigned int base, int *res); 57 | int __must_check kstrtou16_from_user(const char __user *s, size_t count, unsigned int base, u16 *res); 58 | int __must_check kstrtos16_from_user(const char __user *s, size_t count, unsigned int base, s16 *res); 59 | int __must_check kstrtou8_from_user(const char __user *s, size_t count, unsigned int base, u8 *res); 60 | int __must_check kstrtos8_from_user(const char __user *s, size_t count, unsigned int base, s8 *res); 61 | 62 | static inline int __must_check kstrtou64_from_user(const char __user *s, size_t count, unsigned int base, u64 *res) 63 | { 64 | return kstrtoull_from_user(s, count, base, res); 65 | } 66 | 67 | static inline int __must_check kstrtos64_from_user(const char __user *s, size_t count, unsigned int base, s64 *res) 68 | { 69 | return kstrtoll_from_user(s, count, base, res); 70 | } 71 | 72 | static inline int __must_check kstrtou32_from_user(const char __user *s, size_t count, unsigned int base, u32 *res) 73 | { 74 | return kstrtouint_from_user(s, count, base, res); 75 | } 76 | 77 | static inline int __must_check kstrtos32_from_user(const char __user *s, size_t count, unsigned int base, s32 *res) 78 | { 79 | return kstrtoint_from_user(s, count, base, res); 80 | } 81 | 82 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)) */ 83 | 84 | #endif /* LINUX_3_0_COMPAT_H */ 85 | -------------------------------------------------------------------------------- /hal_apollo/txrx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Datapath interface for sigmastar APOLLO mac80211 drivers 3 | * * 4 | * Copyright (c) 2016, sigmastar 5 | * Author: 6 | * 7 | *Based on apollo code 8 | * Copyright (c) 2010, ST-Ericsson 9 | * Author: Dmitry Tarnyagin 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License version 2 as 13 | * published by the Free Software Foundation. 14 | */ 15 | 16 | #ifndef SSTAR_APOLLO_TXRX_H 17 | #define SSTAR_APOLLO_TXRX_H 18 | 19 | #include 20 | 21 | /* extern */ struct ieee80211_hw; 22 | /* extern */ struct sk_buff; 23 | /* extern */ struct wsm_tx; 24 | /* extern */ struct wsm_rx; 25 | /* extern */ struct wsm_tx_confirm; 26 | /* extern */ struct Sstar_txpriv; 27 | /* extern */ struct Sstar_vif; 28 | 29 | struct tx_policy { 30 | union { 31 | __le32 tbl[3]; 32 | u8 raw[12]; 33 | }; 34 | u8 defined; /* TODO: u32 or u8, profile and select best */ 35 | u8 usage_count; /* --// -- */ 36 | u8 retry_count; /* --// -- */ 37 | u8 uploaded; 38 | }; 39 | 40 | struct tx_policy_cache_entry { 41 | struct tx_policy policy; 42 | struct list_head link; 43 | }; 44 | 45 | #define TX_POLICY_CACHE_SIZE (8) 46 | struct tx_policy_cache { 47 | struct tx_policy_cache_entry cache[TX_POLICY_CACHE_SIZE]; 48 | struct list_head used; 49 | struct list_head free; 50 | spinlock_t lock; 51 | }; 52 | 53 | /* ******************************************************************** */ 54 | /* TX policy cache */ 55 | /* Intention of TX policy cache is an overcomplicated WSM API. 56 | * Device does not accept per-PDU tx retry sequence. 57 | * It uses "tx retry policy id" instead, so driver code has to sync 58 | * linux tx retry sequences with a retry policy table in the device. 59 | */ 60 | void tx_policy_init(struct Sstar_common *hw_priv); 61 | void tx_policy_upload_work(struct work_struct *work); 62 | 63 | /* ******************************************************************** */ 64 | /* TX implementation */ 65 | 66 | u32 Sstar_rate_mask_to_wsm(struct Sstar_common *hw_priv, 67 | u32 rates); 68 | void Sstar_tx(struct ieee80211_hw *dev, struct sk_buff *skb); 69 | void Sstar_skb_dtor(struct Sstar_common *hw_priv, 70 | struct sk_buff *skb, 71 | const struct Sstar_txpriv *txpriv); 72 | 73 | /* ******************************************************************** */ 74 | /* WSM callbacks */ 75 | 76 | void Sstar_tx_confirm_cb(struct Sstar_common *hw_priv, 77 | struct wsm_tx_confirm *arg); 78 | void Sstar_rx_cb(struct Sstar_vif *priv, 79 | struct wsm_rx *arg, 80 | struct sk_buff **skb_p); 81 | 82 | /* ******************************************************************** */ 83 | /* Timeout */ 84 | 85 | void Sstar_tx_timeout(struct work_struct *work); 86 | 87 | /* ******************************************************************** */ 88 | /* Security */ 89 | int Sstar_alloc_key(struct Sstar_common *hw_priv); 90 | void Sstar_free_key(struct Sstar_common *hw_priv, int idx); 91 | void Sstar_free_keys(struct Sstar_common *hw_priv); 92 | int Sstar_upload_keys(struct Sstar_vif *priv); 93 | 94 | /* ******************************************************************** */ 95 | /* Workaround for WFD test case 6.1.10 */ 96 | void Sstar_link_id_reset(struct work_struct *work); 97 | 98 | #endif /* SSTAR_APOLLO_TXRX_H */ 99 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/aes_cmac.c: -------------------------------------------------------------------------------- 1 | /* 2 | * AES-128-CMAC with TLen 16 for IEEE 802.11w BIP 3 | * Copyright 2008, Jouni Malinen 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | */ 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | #include "key.h" 18 | #include "aes_cmac.h" 19 | 20 | #define AES_CMAC_KEY_LEN 16 21 | #define CMAC_TLEN 8 /* CMAC TLen = 64 bits (8 octets) */ 22 | #define AAD_LEN 20 23 | 24 | 25 | static void gf_mulx(u8 *pad) 26 | { 27 | int i, carry; 28 | 29 | carry = pad[0] & 0x80; 30 | for (i = 0; i < AES_BLOCK_SIZE - 1; i++) 31 | pad[i] = (pad[i] << 1) | (pad[i + 1] >> 7); 32 | pad[AES_BLOCK_SIZE - 1] <<= 1; 33 | if (carry) 34 | pad[AES_BLOCK_SIZE - 1] ^= 0x87; 35 | } 36 | 37 | 38 | static void aes_128_cmac_vector(struct crypto_cipher *tfm, size_t num_elem, 39 | const u8 *addr[], const size_t *len, u8 *mac) 40 | { 41 | u8 scratch[2 * AES_BLOCK_SIZE]; 42 | u8 *cbc, *pad; 43 | const u8 *pos, *end; 44 | size_t i, e, left, total_len; 45 | 46 | cbc = scratch; 47 | pad = scratch + AES_BLOCK_SIZE; 48 | 49 | memset(cbc, 0, AES_BLOCK_SIZE); 50 | 51 | total_len = 0; 52 | for (e = 0; e < num_elem; e++) 53 | total_len += len[e]; 54 | left = total_len; 55 | 56 | e = 0; 57 | pos = addr[0]; 58 | end = pos + len[0]; 59 | 60 | while (left >= AES_BLOCK_SIZE) { 61 | for (i = 0; i < AES_BLOCK_SIZE; i++) { 62 | cbc[i] ^= *pos++; 63 | if (pos >= end) { 64 | e++; 65 | pos = addr[e]; 66 | end = pos + len[e]; 67 | } 68 | } 69 | if (left > AES_BLOCK_SIZE) 70 | crypto_cipher_encrypt_one(tfm, cbc, cbc); 71 | left -= AES_BLOCK_SIZE; 72 | } 73 | 74 | memset(pad, 0, AES_BLOCK_SIZE); 75 | crypto_cipher_encrypt_one(tfm, pad, pad); 76 | gf_mulx(pad); 77 | 78 | if (left || total_len == 0) { 79 | for (i = 0; i < left; i++) { 80 | cbc[i] ^= *pos++; 81 | if (pos >= end) { 82 | e++; 83 | pos = addr[e]; 84 | end = pos + len[e]; 85 | } 86 | } 87 | cbc[left] ^= 0x80; 88 | gf_mulx(pad); 89 | } 90 | 91 | for (i = 0; i < AES_BLOCK_SIZE; i++) 92 | pad[i] ^= cbc[i]; 93 | crypto_cipher_encrypt_one(tfm, pad, pad); 94 | memcpy(mac, pad, CMAC_TLEN); 95 | } 96 | 97 | 98 | void ieee80211_aes_cmac(struct crypto_cipher *tfm, const u8 *aad, 99 | const u8 *data, size_t data_len, u8 *mic) 100 | { 101 | const u8 *addr[3]; 102 | size_t len[3]; 103 | u8 zero[CMAC_TLEN]; 104 | 105 | memset(zero, 0, CMAC_TLEN); 106 | addr[0] = aad; 107 | len[0] = AAD_LEN; 108 | addr[1] = data; 109 | len[1] = data_len - CMAC_TLEN; 110 | addr[2] = zero; 111 | len[2] = CMAC_TLEN; 112 | 113 | aes_128_cmac_vector(tfm, 3, addr, len, mic); 114 | } 115 | 116 | 117 | struct crypto_cipher * ieee80211_aes_cmac_key_setup(const u8 key[]) 118 | { 119 | struct crypto_cipher *tfm; 120 | 121 | tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); 122 | if (!IS_ERR(tfm)) 123 | crypto_cipher_setkey(tfm, key, AES_CMAC_KEY_LEN); 124 | 125 | return tfm; 126 | } 127 | 128 | 129 | void ieee80211_aes_cmac_key_free(struct crypto_cipher *tfm) 130 | { 131 | crypto_free_cipher(tfm); 132 | } 133 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/rc80211_minstrel_ht.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 Felix Fietkau 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 2 as 6 | * published by the Free Software Foundation. 7 | */ 8 | 9 | #ifndef __RC_MINSTREL_HT_H 10 | #define __RC_MINSTREL_HT_H 11 | 12 | /* 13 | * The number of streams can be changed to 2 to reduce code 14 | * size and memory footprint. 15 | */ 16 | #define MINSTREL_MAX_STREAMS 3 17 | #define MINSTREL_STREAM_GROUPS 4 18 | 19 | /* scaled fraction values */ 20 | #define MINSTREL_SCALE 16 21 | #define MINSTREL_FRAC(val, div) (((val) << MINSTREL_SCALE) / div) 22 | #define MINSTREL_TRUNC(val) ((val) >> MINSTREL_SCALE) 23 | 24 | #define MCS_GROUP_RATES 8 25 | 26 | struct mcs_group { 27 | u32 flags; 28 | unsigned int streams; 29 | unsigned int duration[MCS_GROUP_RATES]; 30 | }; 31 | 32 | extern const struct mcs_group minstrel_mcs_groups[]; 33 | 34 | struct minstrel_rate_stats { 35 | /* current / last sampling period attempts/success counters */ 36 | unsigned int attempts, last_attempts; 37 | unsigned int success, last_success; 38 | 39 | /* total attempts/success counters */ 40 | u64 att_hist, succ_hist; 41 | 42 | /* current throughput */ 43 | unsigned int cur_tp; 44 | 45 | /* packet delivery probabilities */ 46 | unsigned int cur_prob, probability; 47 | 48 | /* maximum retry counts */ 49 | unsigned int retry_count; 50 | unsigned int retry_count_rtscts; 51 | 52 | bool retry_updated; 53 | u8 sample_skipped; 54 | }; 55 | 56 | struct minstrel_mcs_group_data { 57 | u8 index; 58 | u8 column; 59 | 60 | /* bitfield of supported MCS rates of this group */ 61 | u8 supported; 62 | 63 | /* selected primary rates */ 64 | unsigned int max_tp_rate; 65 | unsigned int max_tp_rate2; 66 | unsigned int max_prob_rate; 67 | 68 | /* MCS rate statistics */ 69 | struct minstrel_rate_stats rates[MCS_GROUP_RATES]; 70 | }; 71 | 72 | struct minstrel_ht_sta { 73 | /* ampdu length (average, per sampling interval) */ 74 | unsigned int ampdu_len; 75 | unsigned int ampdu_packets; 76 | 77 | /* ampdu length (EWMA) */ 78 | unsigned int avg_ampdu_len; 79 | 80 | /* best throughput rate */ 81 | unsigned int max_tp_rate; 82 | 83 | /* second best throughput rate */ 84 | unsigned int max_tp_rate2; 85 | 86 | /* best probability rate */ 87 | unsigned int max_prob_rate; 88 | 89 | /* time of last status update */ 90 | unsigned long stats_update; 91 | 92 | /* overhead time in usec for each frame */ 93 | unsigned int overhead; 94 | unsigned int overhead_rtscts; 95 | 96 | unsigned int total_packets; 97 | unsigned int sample_packets; 98 | 99 | /* tx flags to add for frames for this sta */ 100 | u32 tx_flags; 101 | 102 | u8 sample_wait; 103 | u8 sample_tries; 104 | u8 sample_count; 105 | u8 sample_slow; 106 | 107 | /* current MCS group to be sampled */ 108 | u8 sample_group; 109 | 110 | /* MCS rate group info and statistics */ 111 | struct minstrel_mcs_group_data groups[MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS]; 112 | }; 113 | 114 | struct minstrel_ht_sta_priv { 115 | union { 116 | struct minstrel_ht_sta ht; 117 | struct minstrel_sta_info legacy; 118 | }; 119 | #ifdef CONFIG_MAC80211_SSTAR_DEBUGFS 120 | struct dentry *dbg_stats; 121 | #endif 122 | void *ratelist; 123 | void *sample_table; 124 | bool is_ht; 125 | }; 126 | 127 | void minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); 128 | void minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta); 129 | 130 | #endif 131 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/rc80211_minstrel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 Felix Fietkau 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 2 as 6 | * published by the Free Software Foundation. 7 | */ 8 | #ifndef __RC_MINSTREL_H 9 | #define __RC_MINSTREL_H 10 | 11 | 12 | #ifdef MINSTREL_RSSI_USED 13 | //#define MINSTREL_PHY_DEBUG_PRINT 14 | #endif 15 | struct minstrel_rate { 16 | int bitrate; 17 | int rix; 18 | 19 | unsigned int perfect_tx_time; 20 | unsigned int ack_time; 21 | 22 | int sample_limit; 23 | unsigned int retry_count; 24 | unsigned int retry_count_cts; 25 | unsigned int retry_count_rtscts; 26 | unsigned int adjusted_retry_count; 27 | 28 | u32 success; 29 | u32 attempts; 30 | u32 last_attempts; 31 | u32 last_success; 32 | 33 | /* parts per thousand */ 34 | u32 cur_prob; 35 | u32 probability; 36 | 37 | /* per-rate throughput */ 38 | u32 cur_tp; 39 | #ifdef MINSTREL_RSSI_USED 40 | u64 succ_hist1; 41 | u64 att_hist1; 42 | u32 succ_hist2; 43 | u32 att_hist2; 44 | u32 success_prob1; 45 | #endif 46 | u64 succ_hist; 47 | u64 att_hist; 48 | }; 49 | 50 | struct minstrel_sta_info { 51 | unsigned long stats_update; 52 | #ifdef MINSTREL_RSSI_USED 53 | unsigned long stats_update1; 54 | unsigned int initial_flag; 55 | #endif 56 | unsigned int sp_ack_dur; 57 | unsigned int rate_avg; 58 | 59 | unsigned int lowest_rix; 60 | 61 | unsigned int max_tp_rate; 62 | unsigned int max_tp_rate2; 63 | unsigned int max_prob_rate; 64 | unsigned int packet_count; 65 | unsigned int sample_count; 66 | int sample_deferred; 67 | 68 | unsigned int sample_idx; 69 | unsigned int sample_column; 70 | 71 | #ifdef MINSTREL_PHY_DEBUG_PRINT 72 | unsigned short high_not_sample_cnt; 73 | unsigned short high_sample_cnt; 74 | unsigned short low_sample_cnt; 75 | unsigned short not_sample_cnt; 76 | #endif 77 | int n_rates; 78 | struct minstrel_rate *r; 79 | bool prev_sample; 80 | #ifdef MINSTREL_RSSI_USED 81 | int mean_rssi; //add rx rssi 82 | int max_rssi; 83 | int min_rssi; 84 | int total_rssi; //add rx rssi 85 | int rssi_count; 86 | int table_flag; 87 | int table_count; 88 | #endif 89 | /* sampling table */ 90 | u8 *sample_table; 91 | 92 | #ifdef CONFIG_MAC80211_SSTAR_DEBUGFS 93 | struct dentry *dbg_stats; 94 | #endif 95 | }; 96 | 97 | struct minstrel_priv { 98 | struct ieee80211_hw *hw; 99 | bool has_mrr; 100 | unsigned int cw_min; 101 | unsigned int cw_max; 102 | unsigned int max_retry; 103 | unsigned int ewma_level; 104 | unsigned int segment_size; 105 | unsigned int update_interval; 106 | unsigned int lookaround_rate; 107 | unsigned int lookaround_rate_mrr; 108 | 109 | #ifdef CONFIG_MAC80211_SSTAR_DEBUGFS 110 | /* 111 | * enable fixed rate processing per RC 112 | * - write static index to debugfs:ieee80211/phyX/rc/fixed_rate_idx 113 | * - write -1 to enable RC processing again 114 | * - setting will be applied on next update 115 | */ 116 | u32 fixed_rate_idx; 117 | struct dentry *dbg_fixed_rate; 118 | #endif 119 | 120 | }; 121 | 122 | struct minstrel_debugfs_info { 123 | size_t len; 124 | char buf[]; 125 | }; 126 | 127 | extern struct rate_control_ops mac80211_minstrel; 128 | void minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); 129 | void minstrel_remove_sta_debugfs(void *priv, void *priv_sta); 130 | 131 | /* debugfs */ 132 | int minstrel_stats_open(struct inode *inode, struct file *file); 133 | ssize_t minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos); 134 | int minstrel_stats_release(struct inode *inode, struct file *file); 135 | 136 | #endif 137 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/chan.c: -------------------------------------------------------------------------------- 1 | /* 2 | * mac80211 - channel management 3 | */ 4 | 5 | #include 6 | #include "ieee80211_i.h" 7 | 8 | static enum ieee80211_chan_mode 9 | __ieee80211_get_channel_mode(struct ieee80211_local *local, 10 | struct ieee80211_sub_if_data *ignore) 11 | { 12 | struct ieee80211_sub_if_data *sdata; 13 | 14 | lockdep_assert_held(&local->iflist_mtx); 15 | 16 | list_for_each_entry(sdata, &local->interfaces, list) { 17 | if (sdata == ignore) 18 | continue; 19 | 20 | if (!ieee80211_sdata_running(sdata)) 21 | continue; 22 | 23 | if (sdata->vif.type == NL80211_IFTYPE_MONITOR) 24 | continue; 25 | 26 | if (sdata->vif.type == NL80211_IFTYPE_STATION && 27 | !sdata->u.mgd.associated) 28 | continue; 29 | 30 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { 31 | if (!sdata->u.ibss.ssid_len) 32 | continue; 33 | if (!sdata->u.ibss.fixed_channel) 34 | return CHAN_MODE_HOPPING; 35 | } 36 | 37 | if (sdata->vif.type == NL80211_IFTYPE_AP && 38 | !sdata->u.ap.beacon) 39 | continue; 40 | 41 | return CHAN_MODE_FIXED; 42 | } 43 | 44 | return CHAN_MODE_UNDEFINED; 45 | } 46 | 47 | enum ieee80211_chan_mode 48 | ieee80211_get_channel_mode(struct ieee80211_local *local, 49 | struct ieee80211_sub_if_data *ignore) 50 | { 51 | enum ieee80211_chan_mode mode; 52 | 53 | mutex_lock(&local->iflist_mtx); 54 | mode = __ieee80211_get_channel_mode(local, ignore); 55 | mutex_unlock(&local->iflist_mtx); 56 | 57 | return mode; 58 | } 59 | 60 | bool ieee80211_set_channel_type(struct ieee80211_local *local, 61 | struct ieee80211_sub_if_data *sdata, 62 | enum nl80211_channel_type chantype) 63 | { 64 | struct ieee80211_channel_state *chan_state; 65 | struct ieee80211_sub_if_data *tmp; 66 | enum nl80211_channel_type superchan = NL80211_CHAN_NO_HT; 67 | bool result; 68 | 69 | mutex_lock(&local->iflist_mtx); 70 | 71 | if (local->hw.flags & IEEE80211_HW_SUPPORTS_MULTI_CHANNEL) { 72 | /* XXX: COMBO: TBD - is this ok? */ 73 | BUG_ON(!sdata); 74 | sdata->chan_state._oper_channel_type = chantype; 75 | sdata->vif.bss_conf.channel_type = chantype; 76 | result = true; 77 | goto out; 78 | } 79 | 80 | chan_state = ieee80211_get_channel_state(local, sdata); 81 | 82 | list_for_each_entry(tmp, &local->interfaces, list) { 83 | if (tmp == sdata) 84 | continue; 85 | 86 | if (!ieee80211_sdata_running(tmp)) 87 | continue; 88 | 89 | switch (tmp->vif.bss_conf.channel_type) { 90 | case NL80211_CHAN_NO_HT: 91 | case NL80211_CHAN_HT20: 92 | if (superchan > tmp->vif.bss_conf.channel_type) 93 | break; 94 | 95 | superchan = tmp->vif.bss_conf.channel_type; 96 | break; 97 | case NL80211_CHAN_HT40PLUS: 98 | WARN_ON(superchan == NL80211_CHAN_HT40MINUS); 99 | superchan = NL80211_CHAN_HT40PLUS; 100 | break; 101 | case NL80211_CHAN_HT40MINUS: 102 | WARN_ON(superchan == NL80211_CHAN_HT40PLUS); 103 | superchan = NL80211_CHAN_HT40MINUS; 104 | break; 105 | } 106 | } 107 | 108 | switch (superchan) { 109 | case NL80211_CHAN_NO_HT: 110 | case NL80211_CHAN_HT20: 111 | /* 112 | * allow any change that doesn't go to no-HT 113 | * (if it already is no-HT no change is needed) 114 | */ 115 | if (chantype == NL80211_CHAN_NO_HT) 116 | break; 117 | superchan = chantype; 118 | break; 119 | case NL80211_CHAN_HT40PLUS: 120 | case NL80211_CHAN_HT40MINUS: 121 | /* allow smaller bandwidth and same */ 122 | if (chantype == NL80211_CHAN_NO_HT) 123 | break; 124 | if (chantype == NL80211_CHAN_HT20) 125 | break; 126 | if (superchan == chantype) 127 | break; 128 | result = false; 129 | goto out; 130 | } 131 | 132 | chan_state->_oper_channel_type = superchan; 133 | if (sdata) 134 | { 135 | sdata->vif.bss_conf.channel_type = chantype; 136 | } 137 | result = true; 138 | out: 139 | mutex_unlock(&local->iflist_mtx); 140 | 141 | return result; 142 | } 143 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/rc80211_minstrel_ht_debugfs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 Felix Fietkau 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 2 as 6 | * published by the Free Software Foundation. 7 | */ 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include "rc80211_minstrel.h" 16 | #include "rc80211_minstrel_ht.h" 17 | 18 | static int 19 | minstrel_ht_stats_open(struct inode *inode, struct file *file) 20 | { 21 | struct minstrel_ht_sta_priv *msp = inode->i_private; 22 | struct minstrel_ht_sta *mi = &msp->ht; 23 | struct minstrel_debugfs_info *ms; 24 | unsigned int i, j, tp, prob, eprob; 25 | char *p; 26 | int ret; 27 | 28 | if (!msp->is_ht) { 29 | inode->i_private = &msp->legacy; 30 | ret = minstrel_stats_open(inode, file); 31 | inode->i_private = msp; 32 | return ret; 33 | } 34 | 35 | ms = Sstar_kmalloc(sizeof(*ms) + 8192, GFP_KERNEL); 36 | if (!ms) 37 | return -ENOMEM; 38 | 39 | file->private_data = ms; 40 | p = ms->buf; 41 | p += sprintf(p, "type rate throughput ewma prob this prob " 42 | "this succ/attempt success attempts\n"); 43 | for (i = 0; i < MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS; i++) { 44 | char htmode = '2'; 45 | char gimode = 'L'; 46 | 47 | if (!mi->groups[i].supported) 48 | continue; 49 | 50 | if (minstrel_mcs_groups[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH) 51 | htmode = '4'; 52 | if (minstrel_mcs_groups[i].flags & IEEE80211_TX_RC_SHORT_GI) 53 | gimode = 'S'; 54 | 55 | for (j = 0; j < MCS_GROUP_RATES; j++) { 56 | struct minstrel_rate_stats *mr = &mi->groups[i].rates[j]; 57 | int idx = i * MCS_GROUP_RATES + j; 58 | 59 | if (!(mi->groups[i].supported & BIT(j))) 60 | continue; 61 | 62 | p += sprintf(p, "HT%c0/%cGI ", htmode, gimode); 63 | 64 | *(p++) = (idx == mi->max_tp_rate) ? 'T' : ' '; 65 | *(p++) = (idx == mi->max_tp_rate2) ? 't' : ' '; 66 | *(p++) = (idx == mi->max_prob_rate) ? 'P' : ' '; 67 | p += sprintf(p, "MCS%-2u", (minstrel_mcs_groups[i].streams - 1) * 68 | MCS_GROUP_RATES + j); 69 | 70 | tp = mr->cur_tp / 10; 71 | prob = MINSTREL_TRUNC(mr->cur_prob * 1000); 72 | eprob = MINSTREL_TRUNC(mr->probability * 1000); 73 | 74 | p += sprintf(p, " %6u.%1u %6u.%1u %6u.%1u " 75 | "%3u(%3u) %8llu %8llu\n", 76 | tp / 10, tp % 10, 77 | eprob / 10, eprob % 10, 78 | prob / 10, prob % 10, 79 | mr->last_success, 80 | mr->last_attempts, 81 | (unsigned long long)mr->succ_hist, 82 | (unsigned long long)mr->att_hist); 83 | } 84 | } 85 | p += sprintf(p, "\nTotal packet count:: ideal %d " 86 | "lookaround %d\n", 87 | max(0, (int) mi->total_packets - (int) mi->sample_packets), 88 | mi->sample_packets); 89 | p += sprintf(p, "Average A-MPDU length: %d.%d\n", 90 | MINSTREL_TRUNC(mi->avg_ampdu_len), 91 | MINSTREL_TRUNC(mi->avg_ampdu_len * 10) % 10); 92 | ms->len = p - ms->buf; 93 | 94 | return nonseekable_open(inode, file); 95 | } 96 | 97 | static const struct file_operations minstrel_ht_stat_fops = { 98 | .owner = THIS_MODULE, 99 | .open = minstrel_ht_stats_open, 100 | .read = minstrel_stats_read, 101 | .release = minstrel_stats_release, 102 | .llseek = no_llseek, 103 | }; 104 | 105 | void 106 | minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir) 107 | { 108 | struct minstrel_ht_sta_priv *msp = priv_sta; 109 | 110 | msp->dbg_stats = debugfs_create_file("rc_stats", S_IRUGO, dir, msp, 111 | &minstrel_ht_stat_fops); 112 | } 113 | 114 | void 115 | minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta) 116 | { 117 | struct minstrel_ht_sta_priv *msp = priv_sta; 118 | 119 | debugfs_remove(msp->dbg_stats); 120 | } 121 | -------------------------------------------------------------------------------- /include/linux/crc8.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Broadcom Corporation 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 13 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | #ifndef __CRC8_H_ 17 | #define __CRC8_H_ 18 | 19 | #include 20 | 21 | /* see usage of this value in crc8() description */ 22 | #define CRC8_INIT_VALUE 0xFF 23 | 24 | /* 25 | * Return value of crc8() indicating valid message+crc. This is true 26 | * if a CRC is inverted before transmission. The CRC computed over the 27 | * whole received bitstream is _table[x], where x is the bit pattern 28 | * of the modification (almost always 0xff). 29 | */ 30 | #define CRC8_GOOD_VALUE(_table) (_table[0xFF]) 31 | 32 | /* required table size for crc8 algorithm */ 33 | #define CRC8_TABLE_SIZE 256 34 | 35 | /* helper macro assuring right table size is used */ 36 | #define DECLARE_CRC8_TABLE(_table) \ 37 | static u8 _table[CRC8_TABLE_SIZE] 38 | 39 | /** 40 | * crc8_populate_lsb - fill crc table for given polynomial in regular bit order. 41 | * 42 | * @table: table to be filled. 43 | * @polynomial: polynomial for which table is to be filled. 44 | * 45 | * This function fills the provided table according the polynomial provided for 46 | * regular bit order (lsb first). Polynomials in CRC algorithms are typically 47 | * represented as shown below. 48 | * 49 | * poly = x^8 + x^7 + x^6 + x^4 + x^2 + 1 50 | * 51 | * For lsb first direction x^7 maps to the lsb. So the polynomial is as below. 52 | * 53 | * - lsb first: poly = 10101011(1) = 0xAB 54 | */ 55 | void crc8_populate_lsb(u8 table[CRC8_TABLE_SIZE], u8 polynomial); 56 | 57 | /** 58 | * crc8_populate_msb - fill crc table for given polynomial in reverse bit order. 59 | * 60 | * @table: table to be filled. 61 | * @polynomial: polynomial for which table is to be filled. 62 | * 63 | * This function fills the provided table according the polynomial provided for 64 | * reverse bit order (msb first). Polynomials in CRC algorithms are typically 65 | * represented as shown below. 66 | * 67 | * poly = x^8 + x^7 + x^6 + x^4 + x^2 + 1 68 | * 69 | * For msb first direction x^7 maps to the msb. So the polynomial is as below. 70 | * 71 | * - msb first: poly = (1)11010101 = 0xD5 72 | */ 73 | void crc8_populate_msb(u8 table[CRC8_TABLE_SIZE], u8 polynomial); 74 | 75 | /** 76 | * crc8() - calculate a crc8 over the given input data. 77 | * 78 | * @table: crc table used for calculation. 79 | * @pdata: pointer to data buffer. 80 | * @nbytes: number of bytes in data buffer. 81 | * @crc: previous returned crc8 value. 82 | * 83 | * The CRC8 is calculated using the polynomial given in crc8_populate_msb() 84 | * or crc8_populate_lsb(). 85 | * 86 | * The caller provides the initial value (either %CRC8_INIT_VALUE 87 | * or the previous returned value) to allow for processing of 88 | * discontiguous blocks of data. When generating the CRC the 89 | * caller is responsible for complementing the final return value 90 | * and inserting it into the byte stream. When validating a byte 91 | * stream (including CRC8), a final return value of %CRC8_GOOD_VALUE 92 | * indicates the byte stream data can be considered valid. 93 | * 94 | * Reference: 95 | * "A Painless Guide to CRC Error Detection Algorithms", ver 3, Aug 1993 96 | * Williams, Ross N., rossross.net 97 | * (see URL http://www.ross.net/crc/download/crc_v3.txt). 98 | */ 99 | u8 crc8(const u8 table[CRC8_TABLE_SIZE], u8 *pdata, size_t nbytes, u8 crc); 100 | 101 | #endif /* __CRC8_H_ */ 102 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/aes_ccm.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003-2004, Instant802 Networks, Inc. 3 | * Copyright 2005-2006, Devicescape Software, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | */ 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | #include "key.h" 18 | #include "aes_ccm.h" 19 | 20 | static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *scratch, u8 *a) 21 | { 22 | int i; 23 | u8 *b_0, *aad, *b, *s_0; 24 | 25 | b_0 = scratch + 3 * AES_BLOCK_SIZE; 26 | aad = scratch + 4 * AES_BLOCK_SIZE; 27 | b = scratch; 28 | s_0 = scratch + AES_BLOCK_SIZE; 29 | 30 | crypto_cipher_encrypt_one(tfm, b, b_0); 31 | 32 | /* Extra Authenticate-only data (always two AES blocks) */ 33 | for (i = 0; i < AES_BLOCK_SIZE; i++) 34 | aad[i] ^= b[i]; 35 | crypto_cipher_encrypt_one(tfm, b, aad); 36 | 37 | aad += AES_BLOCK_SIZE; 38 | 39 | for (i = 0; i < AES_BLOCK_SIZE; i++) 40 | aad[i] ^= b[i]; 41 | crypto_cipher_encrypt_one(tfm, a, aad); 42 | 43 | /* Mask out bits from auth-only-b_0 */ 44 | b_0[0] &= 0x07; 45 | 46 | /* S_0 is used to encrypt T (= MIC) */ 47 | b_0[14] = 0; 48 | b_0[15] = 0; 49 | crypto_cipher_encrypt_one(tfm, s_0, b_0); 50 | } 51 | 52 | 53 | void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch, 54 | u8 *data, size_t data_len, 55 | u8 *cdata, u8 *mic) 56 | { 57 | int i, j, last_len, num_blocks; 58 | u8 *pos, *cpos, *b, *s_0, *e, *b_0; 59 | 60 | b = scratch; 61 | s_0 = scratch + AES_BLOCK_SIZE; 62 | e = scratch + 2 * AES_BLOCK_SIZE; 63 | b_0 = scratch + 3 * AES_BLOCK_SIZE; 64 | 65 | num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE); 66 | last_len = data_len % AES_BLOCK_SIZE; 67 | aes_ccm_prepare(tfm, scratch, b); 68 | 69 | /* Process payload blocks */ 70 | pos = data; 71 | cpos = cdata; 72 | for (j = 1; j <= num_blocks; j++) { 73 | int blen = (j == num_blocks && last_len) ? 74 | last_len : AES_BLOCK_SIZE; 75 | 76 | /* Authentication followed by encryption */ 77 | for (i = 0; i < blen; i++) 78 | b[i] ^= pos[i]; 79 | crypto_cipher_encrypt_one(tfm, b, b); 80 | 81 | b_0[14] = (j >> 8) & 0xff; 82 | b_0[15] = j & 0xff; 83 | crypto_cipher_encrypt_one(tfm, e, b_0); 84 | for (i = 0; i < blen; i++) 85 | *cpos++ = *pos++ ^ e[i]; 86 | } 87 | 88 | for (i = 0; i < CCMP_MIC_LEN; i++) 89 | mic[i] = b[i] ^ s_0[i]; 90 | } 91 | 92 | 93 | int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch, 94 | u8 *cdata, size_t data_len, u8 *mic, u8 *data) 95 | { 96 | int i, j, last_len, num_blocks; 97 | u8 *pos, *cpos, *b, *s_0, *a, *b_0; 98 | 99 | b = scratch; 100 | s_0 = scratch + AES_BLOCK_SIZE; 101 | a = scratch + 2 * AES_BLOCK_SIZE; 102 | b_0 = scratch + 3 * AES_BLOCK_SIZE; 103 | 104 | num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE); 105 | last_len = data_len % AES_BLOCK_SIZE; 106 | aes_ccm_prepare(tfm, scratch, a); 107 | 108 | /* Process payload blocks */ 109 | cpos = cdata; 110 | pos = data; 111 | for (j = 1; j <= num_blocks; j++) { 112 | int blen = (j == num_blocks && last_len) ? 113 | last_len : AES_BLOCK_SIZE; 114 | 115 | /* Decryption followed by authentication */ 116 | b_0[14] = (j >> 8) & 0xff; 117 | b_0[15] = j & 0xff; 118 | crypto_cipher_encrypt_one(tfm, b, b_0); 119 | for (i = 0; i < blen; i++) { 120 | *pos = *cpos++ ^ b[i]; 121 | a[i] ^= *pos++; 122 | } 123 | crypto_cipher_encrypt_one(tfm, a, a); 124 | } 125 | 126 | for (i = 0; i < CCMP_MIC_LEN; i++) { 127 | if ((mic[i] ^ s_0[i]) != a[i]) 128 | return -1; 129 | } 130 | 131 | return 0; 132 | } 133 | 134 | 135 | struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[]) 136 | { 137 | struct crypto_cipher *tfm; 138 | 139 | tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); 140 | if (!IS_ERR(tfm)) 141 | crypto_cipher_setkey(tfm, key, ALG_CCMP_KEY_LEN); 142 | 143 | return tfm; 144 | } 145 | 146 | 147 | void ieee80211_aes_key_free(struct crypto_cipher *tfm) 148 | { 149 | crypto_free_cipher(tfm); 150 | } 151 | -------------------------------------------------------------------------------- /include/linux/compat-2.6.37.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_26_37_COMPAT_H 2 | #define LINUX_26_37_COMPAT_H 3 | 4 | #include 5 | 6 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) 7 | 8 | #include 9 | #include 10 | 11 | #define SDIO_CLASS_BT_AMP 0x09 /* Type-A Bluetooth AMP interface */ 12 | 13 | extern struct kobj_ns_type_operations net_ns_type_operations; 14 | 15 | /** 16 | * skb_checksum_none_assert - make sure skb ip_summed is CHECKSUM_NONE 17 | * @skb: skb to check 18 | * 19 | * fresh skbs have their ip_summed set to CHECKSUM_NONE. 20 | * Instead of forcing ip_summed to CHECKSUM_NONE, we can 21 | * use this helper, to document places where we make this assertion. 22 | */ 23 | static inline void skb_checksum_none_assert(struct sk_buff *skb) 24 | { 25 | #ifdef DEBUG 26 | BUG_ON(skb->ip_summed != CHECKSUM_NONE); 27 | #endif 28 | } 29 | 30 | #define pcmcia_enable_device(link) pcmcia_request_configuration(link, &link->conf) 31 | 32 | #include 33 | 34 | struct compat_genl_info { 35 | struct genl_info *info; 36 | 37 | u32 snd_seq; 38 | u32 snd_pid; 39 | struct genlmsghdr *genlhdr; 40 | struct nlattr **attrs; 41 | void *user_ptr[2]; 42 | }; 43 | #define genl_info compat_genl_info 44 | 45 | struct compat_genl_ops { 46 | struct genl_ops ops; 47 | 48 | u8 cmd; 49 | u8 internal_flags; 50 | unsigned int flags; 51 | const struct nla_policy *policy; 52 | 53 | int (*doit)(struct sk_buff *skb, struct genl_info *info); 54 | int (*dumpit)(struct sk_buff *skb, struct netlink_callback *cb); 55 | int (*done)(struct netlink_callback *cb); 56 | }; 57 | #define genl_ops compat_genl_ops 58 | 59 | struct compat_genl_family { 60 | struct genl_family family; 61 | 62 | struct list_head list; 63 | 64 | unsigned int id, hdrsize, version, maxattr; 65 | const char *name; 66 | bool netnsok; 67 | 68 | struct nlattr **attrbuf; 69 | 70 | int (*pre_doit)(struct genl_ops *ops, struct sk_buff *skb, 71 | struct genl_info *info); 72 | 73 | void (*post_doit)(struct genl_ops *ops, struct sk_buff *skb, 74 | struct genl_info *info); 75 | }; 76 | 77 | #define genl_family compat_genl_family 78 | 79 | #define genl_register_family_with_ops compat_genl_register_family_with_ops 80 | 81 | int genl_register_family_with_ops(struct genl_family *family, 82 | struct genl_ops *ops, size_t n_ops); 83 | 84 | #define genl_unregister_family compat_genl_unregister_family 85 | 86 | int genl_unregister_family(struct genl_family *family); 87 | 88 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) 89 | #define genl_info_net(_info) genl_info_net((_info)->info) 90 | #endif 91 | 92 | #define genlmsg_reply(_msg, _info) genlmsg_reply(_msg, (_info)->info) 93 | #define genlmsg_put(_skb, _pid, _seq, _fam, _flags, _cmd) genlmsg_put(_skb, _pid, _seq, &(_fam)->family, _flags, _cmd) 94 | #define genl_register_mc_group(_fam, _grp) genl_register_mc_group(&(_fam)->family, _grp) 95 | #define genl_unregister_mc_group(_fam, _grp) genl_unregister_mc_group(&(_fam)->family, _grp) 96 | 97 | 98 | extern void led_blink_set(struct led_classdev *led_cdev, 99 | unsigned long *delay_on, 100 | unsigned long *delay_off); 101 | 102 | #define led_classdev_unregister compat_led_classdev_unregister 103 | extern void compat_led_classdev_unregister(struct led_classdev *led_cdev); 104 | 105 | #define led_brightness_set compat_led_brightness_set 106 | extern void compat_led_brightness_set(struct led_classdev *led_cdev, 107 | enum led_brightness brightness); 108 | 109 | #define alloc_ordered_workqueue(name, flags) create_singlethread_workqueue(name) 110 | 111 | #define netdev_refcnt_read(a) atomic_read(&a->refcnt) 112 | 113 | extern void *vzalloc(unsigned long size); 114 | 115 | #define rtnl_dereference(p) \ 116 | rcu_dereference_protected(p, lockdep_rtnl_is_held()) 117 | 118 | /** 119 | * RCU_INIT_POINTER() - initialize an RCU protected pointer 120 | * 121 | * Initialize an RCU-protected pointer in such a way to avoid RCU-lockdep 122 | * splats. 123 | */ 124 | #define RCU_INIT_POINTER(p, v) \ 125 | p = (typeof(*v) __force __rcu *)(v) 126 | 127 | static inline bool skb_has_frag_list(const struct sk_buff *skb) 128 | { 129 | return skb_shinfo(skb)->frag_list != NULL; 130 | } 131 | 132 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) */ 133 | 134 | #endif /* LINUX_26_37_COMPAT_H */ 135 | -------------------------------------------------------------------------------- /include/linux/compat-2.6.32.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_26_32_COMPAT_H 2 | #define LINUX_26_32_COMPAT_H 3 | 4 | #include 5 | 6 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)) 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #define SDIO_VENDOR_ID_INTEL 0x0089 15 | #define SDIO_DEVICE_ID_INTEL_IWMC3200WIMAX 0x1402 16 | #define SDIO_DEVICE_ID_INTEL_IWMC3200WIFI 0x1403 17 | #define SDIO_DEVICE_ID_INTEL_IWMC3200TOP 0x1404 18 | #define SDIO_DEVICE_ID_INTEL_IWMC3200GPS 0x1405 19 | #define SDIO_DEVICE_ID_INTEL_IWMC3200BT 0x1406 20 | 21 | static inline void flush_delayed_work(struct delayed_work *dwork) 22 | { 23 | if (del_timer_sync(&dwork->timer)) { 24 | /* 25 | * This is what would happen on 2.6.32 but since we don't have 26 | * access to the singlethread_cpu we can't really backport this, 27 | * so avoid really *flush*ing the work... Oh well. Any better ideas? 28 | 29 | struct cpu_workqueue_struct *cwq; 30 | cwq = wq_per_cpu(keventd_wq, get_cpu()); 31 | __queue_work(cwq, &dwork->work); 32 | put_cpu(); 33 | 34 | */ 35 | } 36 | flush_work(&dwork->work); 37 | } 38 | 39 | /* 40 | * struct genl_multicast_group was made netns aware through 41 | * patch "genetlink: make netns aware" by johannes, we just 42 | * force this to always use the default init_net 43 | */ 44 | #define genl_info_net(x) &init_net 45 | /* Just use init_net for older kernels */ 46 | #define get_net_ns_by_pid(x) &init_net 47 | 48 | /* net namespace is lost */ 49 | #define genlmsg_multicast_netns(a, b, c, d, e) genlmsg_multicast(b, c, d, e) 50 | #define genlmsg_multicast_allns(a, b, c, d) genlmsg_multicast(a, b, c, d) 51 | #define genlmsg_unicast(net, skb, pid) genlmsg_unicast(skb, pid) 52 | 53 | #define dev_change_net_namespace(a, b, c) (-EOPNOTSUPP) 54 | 55 | #define SET_NETDEV_DEVTYPE(netdev, type) 56 | 57 | #ifdef __KERNEL__ 58 | /* Driver transmit return codes */ 59 | enum netdev_tx { 60 | BACKPORT_NETDEV_TX_OK = NETDEV_TX_OK, /* driver took care of packet */ 61 | BACKPORT_NETDEV_TX_BUSY = NETDEV_TX_BUSY, /* driver tx path was busy*/ 62 | BACKPORT_NETDEV_TX_LOCKED = NETDEV_TX_LOCKED, /* driver tx lock was already taken */ 63 | }; 64 | typedef enum netdev_tx netdev_tx_t; 65 | #endif /* __KERNEL__ */ 66 | 67 | /* 68 | * dev_pm_ops is only available on kernels >= 2.6.29, for 69 | * older kernels we rely on reverting the work to old 70 | * power management style stuff. 71 | */ 72 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) 73 | /* 74 | * Use this if you want to use the same suspend and resume callbacks for suspend 75 | * to RAM and hibernation. 76 | */ 77 | #define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ 78 | struct dev_pm_ops name = { \ 79 | .suspend = suspend_fn, \ 80 | .resume = resume_fn, \ 81 | .freeze = suspend_fn, \ 82 | .thaw = resume_fn, \ 83 | .poweroff = suspend_fn, \ 84 | .restore = resume_fn, \ 85 | } 86 | #else 87 | #define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) 88 | #endif /* >= 2.6.29 */ 89 | 90 | #define wireless_send_event(a, b, c, d) wireless_send_event(a, b, c, (char * ) d) 91 | 92 | /* The export symbol in changed in compat/patches/15-symbol-export-conflicts.patch */ 93 | #define ieee80211_rx(hw, skb) mac80211_ieee80211_rx(hw, skb) 94 | 95 | #define dev_to_sdio_func(d) container_of(d, struct sdio_func, dev) 96 | 97 | #define lockdep_assert_held(l) do { } while (0) 98 | 99 | /* 100 | * Similar to the struct tm in userspace , but it needs to be here so 101 | * that the kernel source is self contained. 102 | */ 103 | struct tm { 104 | /* 105 | * the number of seconds after the minute, normally in the range 106 | * 0 to 59, but can be up to 60 to allow for leap seconds 107 | */ 108 | int tm_sec; 109 | /* the number of minutes after the hour, in the range 0 to 59*/ 110 | int tm_min; 111 | /* the number of hours past midnight, in the range 0 to 23 */ 112 | int tm_hour; 113 | /* the day of the month, in the range 1 to 31 */ 114 | int tm_mday; 115 | /* the number of months since January, in the range 0 to 11 */ 116 | int tm_mon; 117 | /* the number of years since 1900 */ 118 | long tm_year; 119 | /* the number of days since Sunday, in the range 0 to 6 */ 120 | int tm_wday; 121 | /* the number of days since January 1, in the range 0 to 365 */ 122 | int tm_yday; 123 | }; 124 | 125 | void time_to_tm(time_t totalsecs, int offset, struct tm *result); 126 | 127 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)) */ 128 | 129 | #endif /* LINUX_26_32_COMPAT_H */ 130 | -------------------------------------------------------------------------------- /include/linux/compat-2.6.23.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_26_23_COMPAT_H 2 | #define LINUX_26_23_COMPAT_H 3 | 4 | #include 5 | 6 | /* Compat work for < 2.6.23 */ 7 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)) 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | /* 16 | * Tell gcc if a function is cold. The compiler will assume any path 17 | * directly leading to the call is unlikely. 18 | */ 19 | 20 | #if !(__GNUC__ == 4 && __GNUC_MINOR__ < 3) 21 | /* Mark functions as cold. gcc will assume any path leading to a call 22 | * to them will be unlikely. This means a lot of manual unlikely()s 23 | * are unnecessary now for any paths leading to the usual suspects 24 | * like BUG(), printk(), panic() etc. [but let's keep them for now for 25 | * older compilers] 26 | * 27 | * Early snapshots of gcc 4.3 don't support this and we can't detect this 28 | * in the preprocessor, but we can live with this because they're unreleased. 29 | * Maketime probing would be overkill here. 30 | * 31 | * gcc also has a __attribute__((__hot__)) to move hot functions into 32 | * a special section, but I don't see any sense in this right now in 33 | * the kernel context */ 34 | #define __cold __attribute__((__cold__)) 35 | #endif /* gcc 4.3 check */ 36 | 37 | #ifndef __cold 38 | #define __cold 39 | #endif 40 | 41 | /* Added as of 2.6.23 in include/linux/netdevice.h */ 42 | #define alloc_netdev_mq(sizeof_priv, name, setup, queue) \ 43 | alloc_netdev(sizeof_priv, name, setup) 44 | #define NETIF_F_MULTI_QUEUE 16384 45 | 46 | /* Added as of 2.6.23 on include/linux/netdevice.h */ 47 | static inline int netif_is_multiqueue(const struct net_device *dev) 48 | { 49 | return (!!(NETIF_F_MULTI_QUEUE & dev->features)); 50 | } 51 | 52 | /* 2.6.23 fixed a bug in tcf_destroy_chain and the parameter changed */ 53 | static inline void tcf_destroy_chain_compat(struct tcf_proto **fl) 54 | { 55 | struct tcf_proto *tp; 56 | 57 | while ((tp = *fl) != NULL) { 58 | *fl = tp->next; 59 | tp->ops->destroy(tp); 60 | module_put(tp->ops->owner); 61 | Sstar_kfree(tp); 62 | } 63 | } 64 | 65 | /* dev_mc_list was replaced with dev_addr_list as of 2.6.23, 66 | * only new member added is da_synced. */ 67 | #define dev_addr_list dev_mc_list 68 | #define da_addr dmi_addr 69 | #define da_addrlen dmi_addrlen 70 | #define da_users dmi_users 71 | #define da_gusers dmi_gusers 72 | 73 | /* dev_set_promiscuity() was moved to __dev_set_promiscuity() on 2.6.23 and 74 | * dev_set_promiscuity() became a wrapper. */ 75 | #define __dev_set_promiscuity dev_set_promiscuity 76 | 77 | /* Our own 2.6.22 port on compat.c */ 78 | extern void dev_mc_unsync(struct net_device *to, struct net_device *from); 79 | extern int dev_mc_sync(struct net_device *to, struct net_device *from); 80 | 81 | /* Our own 2.6.22 port on compat.c */ 82 | extern void __dev_set_rx_mode(struct net_device *dev); 83 | 84 | /* Simple to add this */ 85 | extern int cancel_delayed_work_sync(struct delayed_work *work); 86 | 87 | #define cancel_delayed_work_sync cancel_rearming_delayed_work 88 | 89 | #define debugfs_rename(a, b, c, d) 1 90 | 91 | /* nl80211 requires multicast group support which is new and added on 92 | * 2.6.23. We can't add support for it for older kernels to support it 93 | * genl_family structure was changed. Lets just let through the 94 | * genl_register_mc_group call. This means no multicast group suppport */ 95 | 96 | #define genl_register_mc_group(a, b) 0 97 | 98 | /** 99 | * struct genl_multicast_group - generic netlink multicast group 100 | * @name: name of the multicast group, names are per-family 101 | * @id: multicast group ID, assigned by the core, to use with 102 | * genlmsg_multicast(). 103 | * @list: list entry for linking 104 | * @family: pointer to family, need not be set before registering 105 | */ 106 | struct genl_multicast_group 107 | { 108 | struct genl_family *family; /* private */ 109 | struct list_head list; /* private */ 110 | char name[GENL_NAMSIZ]; 111 | u32 id; 112 | }; 113 | 114 | 115 | /* Added as of 2.6.23 */ 116 | int pci_try_set_mwi(struct pci_dev *dev); 117 | 118 | /* Added as of 2.6.23 */ 119 | #ifdef CONFIG_PM_SLEEP 120 | /* 121 | * Tell the freezer that the current task should be frozen by it 122 | */ 123 | static inline void set_freezable(void) 124 | { 125 | current->flags &= ~PF_NOFREEZE; 126 | } 127 | 128 | #else 129 | static inline void set_freezable(void) {} 130 | #endif /* CONFIG_PM_SLEEP */ 131 | 132 | #else 133 | #define tcf_destroy_chain_compat tcf_destroy_chain 134 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)) */ 135 | 136 | #endif /* LINUX_26_23_COMPAT_H */ 137 | -------------------------------------------------------------------------------- /include/linux/compat-2.6.36.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_26_36_COMPAT_H 2 | #define LINUX_26_36_COMPAT_H 3 | 4 | #include 5 | 6 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #define kparam_block_sysfs_write(a) 15 | #define kparam_unblock_sysfs_write(a) 16 | 17 | struct va_format { 18 | const char *fmt; 19 | va_list *va; 20 | }; 21 | 22 | #define device_rename(dev, new_name) device_rename(dev, (char *)new_name) 23 | 24 | #ifdef CONFIG_COMPAT_USB_URB_THREAD_FIX 25 | #define usb_scuttle_anchored_urbs(anchor) compat_usb_scuttle_anchored_urbs(anchor) 26 | #define usb_get_from_anchor(anchor) compat_usb_get_from_anchor(anchor) 27 | #define usb_unlink_anchored_urbs(anchor) compat_usb_unlink_anchored_urbs(anchor) 28 | 29 | extern void compat_usb_unlink_anchored_urbs(struct usb_anchor *anchor); 30 | extern struct urb *compat_usb_get_from_anchor(struct usb_anchor *anchor); 31 | extern void compat_usb_scuttle_anchored_urbs(struct usb_anchor *anchor); 32 | #endif 33 | 34 | /** 35 | * pcmcia_read_config_byte() - read a byte from a card configuration register 36 | * 37 | * pcmcia_read_config_byte() reads a byte from a configuration register in 38 | * attribute memory. 39 | */ 40 | static inline int pcmcia_read_config_byte(struct pcmcia_device *p_dev, off_t where, u8 *val) 41 | { 42 | int ret; 43 | conf_reg_t reg = { 0, CS_READ, where, 0 }; 44 | ret = pcmcia_access_configuration_register(p_dev, ®); 45 | *val = reg.Value; 46 | return ret; 47 | } 48 | 49 | /** 50 | * pcmcia_write_config_byte() - write a byte to a card configuration register 51 | * 52 | * pcmcia_write_config_byte() writes a byte to a configuration register in 53 | * attribute memory. 54 | */ 55 | static inline int pcmcia_write_config_byte(struct pcmcia_device *p_dev, off_t where, u8 val) 56 | { 57 | conf_reg_t reg = { 0, CS_WRITE, where, val }; 58 | return pcmcia_access_configuration_register(p_dev, ®); 59 | } 60 | 61 | struct pm_qos_request_list { 62 | u32 qos; 63 | void *request; 64 | }; 65 | 66 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)) 67 | 68 | #define pm_qos_add_request(_req, _class, _value) do { \ 69 | (_req)->request = #_req; \ 70 | (_req)->qos = _class; \ 71 | pm_qos_add_requirement((_class), (_req)->request, (_value)); \ 72 | } while(0) 73 | 74 | #define pm_qos_update_request(_req, _value) \ 75 | pm_qos_update_requirement((_req)->qos, (_req)->request, (_value)) 76 | 77 | #define pm_qos_remove_request(_req) \ 78 | pm_qos_remove_requirement((_req)->qos, (_req)->request) 79 | 80 | #else 81 | 82 | #define pm_qos_add_request(_req, _class, _value) do { \ 83 | (_req)->request = pm_qos_add_request((_class), (_value)); \ 84 | } while (0) 85 | 86 | #define pm_qos_update_request(_req, _value) \ 87 | pm_qos_update_request((_req)->request, (_value)) 88 | 89 | #define pm_qos_remove_request(_req) \ 90 | pm_qos_remove_request((_req)->request) 91 | 92 | #endif 93 | 94 | /* 95 | * Dummy printk for disabled debugging statements to use whilst maintaining 96 | * gcc's format and side-effect checking. 97 | */ 98 | static inline __attribute__ ((format (printf, 1, 2))) 99 | int no_printk(const char *s, ...) { return 0; } 100 | 101 | #ifndef alloc_workqueue 102 | #define alloc_workqueue(name, flags, max_active) __create_workqueue(name, flags, max_active, 0) 103 | #endif 104 | 105 | #define EXTPROC 0200000 106 | #define TIOCPKT_IOCTL 64 107 | 108 | static inline void tty_lock(void) __acquires(kernel_lock) 109 | { 110 | #ifdef CONFIG_LOCK_KERNEL 111 | /* kernel_locked is 1 for !CONFIG_LOCK_KERNEL */ 112 | WARN_ON(kernel_locked()); 113 | #endif 114 | lock_kernel(); 115 | } 116 | static inline void tty_unlock(void) __releases(kernel_lock) 117 | { 118 | unlock_kernel(); 119 | } 120 | #define tty_locked() (kernel_locked()) 121 | 122 | #define usleep_range(_min, _max) msleep((_max) / 1000) 123 | 124 | #define __rcu 125 | 126 | static inline void pm_wakeup_event(struct device *dev, unsigned int msec) {} 127 | 128 | static inline bool skb_defer_rx_timestamp(struct sk_buff *skb) 129 | { 130 | return false; 131 | } 132 | 133 | static inline void skb_tx_timestamp(struct sk_buff *skb) 134 | { 135 | } 136 | 137 | extern struct workqueue_struct *system_nrt_wq; 138 | 139 | void compat_system_workqueue_create(void); 140 | void compat_system_workqueue_destroy(void); 141 | 142 | #else 143 | 144 | static inline void compat_system_workqueue_create(void) 145 | { 146 | } 147 | 148 | static inline void compat_system_workqueue_destroy(void) 149 | { 150 | } 151 | 152 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) */ 153 | 154 | #endif /* LINUX_26_36_COMPAT_H */ 155 | -------------------------------------------------------------------------------- /hal_apollo/Sstar_testmode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * * 3 | * Copyright (c) 2016, sigmastar 4 | * Author: 5 | * 6 | * Based on apollo code 7 | * Copyright (C) STE SA 2012 8 | * Author: Piotr Nakraszewicz for ST-Ericsson 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License version 2 as 12 | * published by the Free Software Foundation. 13 | */ 14 | 15 | #ifndef SSTAR_NL80211_TESTMODE_MSG_COPY_H 16 | #define SSTAR_NL80211_TESTMODE_MSG_COPY_H 17 | 18 | /* example command structure for test purposes */ 19 | struct Sstar_msg_test_t { 20 | int dummy; 21 | }; 22 | 23 | /* example reply structure for test purposes */ 24 | struct Sstar_reply_test_t { 25 | int dummy; 26 | }; 27 | 28 | /* example event structure for test purposes */ 29 | struct Sstar_event_test_t { 30 | int dummy; 31 | }; 32 | 33 | enum Sstar_msg_id { 34 | SSTAR_MSG_TEST = 0, /* for test purposes */ 35 | SSTAR_MSG_EVENT_TEST, /* for test purposes */ 36 | SSTAR_MSG_SET_SNAP_FRAME, 37 | SSTAR_MSG_EVENT_FRAME_DATA, 38 | SSTAR_MSG_GET_TX_POWER_LEVEL, 39 | SSTAR_MSG_GET_TX_POWER_RANGE, 40 | SSTAR_MSG_SET_ADVANCE_SCAN_ELEMS, 41 | SSTAR_MSG_SET_TX_QUEUE_PARAMS, 42 | SSTAR_MSG_SET_POWER_SAVE, 43 | /* Add new IDs here */ 44 | 45 | SSTAR_MSG_ID_MAX, 46 | }; 47 | 48 | enum Sstar_nl80211_testmode_data_attributes { 49 | SSTAR_TM_MSG_ID = 0x0001, /* u32 type containing the SSTAR message ID */ 50 | SSTAR_TM_MSG_DATA, /* message payload */ 51 | 52 | /* Max indicator so module test may add its own attributes */ 53 | SSTAR_TM_MSG_ATTR_MAX, 54 | }; 55 | 56 | /** 57 | * Sstar_msg_set_snap_frame - set SNAP frame format 58 | * @len: length of SNAP frame, if 0 SNAP frame disabled 59 | * @frame: SNAP frame format 60 | * 61 | * In this structure is difference between user space because 62 | * format and length have to be hidden 63 | * 64 | */ 65 | struct Sstar_msg_set_snap_frame { 66 | u8 len; 67 | u8 frame[0]; 68 | }; 69 | 70 | /** 71 | * Sstar_msg_set_txqueue_params - store Tx queue params 72 | * @user_priority: User priority for which TSPEC negotiated 73 | * @medium_time: Allowed medium time 74 | * @expiry_time: The expiry time of MSDU 75 | * 76 | */ 77 | struct Sstar_msg_set_txqueue_params { 78 | u8 user_priority; 79 | u16 medium_time; 80 | u16 expiry_time; 81 | }; 82 | #ifdef CONFIG_SSTAR_APOLLO_TESTMODE 83 | /** 84 | * Sstar_tsm_stats - To retrieve the Transmit Stream Measurement stats 85 | * @actual_msrmt_start_time: The TSF at the time at which the measurement 86 | * started 87 | * @msrmt_duration: Duration for measurement 88 | * @peer_sta_addr: Peer STA address 89 | * @tid: TID for which measurements were made 90 | * @reporting_reason: Reason for report sent 91 | * @txed_msdu_count: The number of MSDUs transmitted for the specified TID 92 | * @msdu_discarded_count: The number of discarded MSDUs for the specified TID 93 | * @msdu_failed_count: The number of failed MSDUs for the specified TID 94 | * @multi_retry_count: The number of MSDUs which were retried 95 | * @qos_cfpolls_lost_count: The number of QOS CF polls frames lost 96 | * @avg_q_delay: Average queue delay 97 | * @avg_transmit_delay: Average transmit delay 98 | * @bin0_range: Delay range of the first bin (Bin 0) 99 | * @bin0: bin0 transmit delay histogram 100 | * @bin1: bin1 transmit delay histogram 101 | * @bin2: bin2 transmit delay histogram 102 | * @bin3: bin3 transmit delay histogram 103 | * @bin4: bin4 transmit delay histogram 104 | * @bin5: bin5 transmit delay histogram 105 | * 106 | */ 107 | struct Sstar_tsm_stats { 108 | u64 actual_msrmt_start_time; 109 | u16 msrmt_duration; 110 | u8 peer_sta_addr[6]; 111 | u8 tid; 112 | u8 reporting_reason; 113 | u32 txed_msdu_count; 114 | u32 msdu_discarded_count; 115 | u32 msdu_failed_count; 116 | u32 multi_retry_count; 117 | u32 qos_cfpolls_lost_count; 118 | u32 avg_q_delay; 119 | u32 avg_transmit_delay; 120 | u8 bin0_range; 121 | u32 bin0; 122 | u32 bin1; 123 | u32 bin2; 124 | u32 bin3; 125 | u32 bin00; 126 | u32 bin01; 127 | u32 bin02; 128 | u32 bin03; 129 | u32 bin04; 130 | u32 bin05; 131 | u32 bin06; 132 | } __packed; 133 | 134 | #endif 135 | /** 136 | * Sstar_msg_set_start_stop_tsm - To start or stop collecting TSM metrics in 137 | * apollo driver 138 | * @start: To start or stop collecting TSM metrics 139 | * @up: up for which metrics to be collected 140 | * @packetization_delay: Packetization period for this TID 141 | * 142 | */ 143 | struct Sstar_msg_start_stop_tsm { 144 | u8 start; /*1: To start, 0: To stop*/ 145 | u8 up; 146 | u16 packetization_delay; 147 | }; 148 | 149 | /** 150 | * power_save_elems - To enable/disable legacy power Save 151 | */ 152 | struct power_save_elems { 153 | int powerSave; 154 | }; 155 | 156 | 157 | #define SSTAR_TM_MAX_ATTRIB_SIZE 1024 158 | 159 | #endif /* SSTAR_NL80211_TESTMODE_MSG_COPY_H*/ 160 | -------------------------------------------------------------------------------- /include/linux/compat-3.5.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_3_5_COMPAT_H 2 | #define LINUX_3_5_COMPAT_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) 10 | 11 | #include 12 | #include 13 | 14 | /* 15 | * This backports: 16 | * 17 | * From 76e3cc126bb223013a6b9a0e2a51238d1ef2e409 Mon Sep 17 00:00:00 2001 18 | * From: Eric Dumazet 19 | * Date: Thu, 10 May 2012 07:51:25 +0000 20 | * Subject: [PATCH] codel: Controlled Delay AQM 21 | */ 22 | 23 | /* CODEL */ 24 | 25 | enum { 26 | TCA_CODEL_UNSPEC, 27 | TCA_CODEL_TARGET, 28 | TCA_CODEL_LIMIT, 29 | TCA_CODEL_INTERVAL, 30 | TCA_CODEL_ECN, 31 | __TCA_CODEL_MAX 32 | }; 33 | 34 | #define TCA_CODEL_MAX (__TCA_CODEL_MAX - 1) 35 | 36 | struct tc_codel_xstats { 37 | __u32 maxpacket; /* largest packet we've seen so far */ 38 | __u32 count; /* how many drops we've done since the last time we 39 | * entered dropping state 40 | */ 41 | __u32 lastcount; /* count at entry to dropping state */ 42 | __u32 ldelay; /* in-queue delay seen by most recently dequeued packet */ 43 | __s32 drop_next; /* time to drop next packet */ 44 | __u32 drop_overlimit; /* number of time max qdisc packet limit was hit */ 45 | __u32 ecn_mark; /* number of packets we ECN marked instead of dropped */ 46 | __u32 dropping; /* are we in dropping state ? */ 47 | }; 48 | 49 | /* This backports: 50 | * 51 | * commit 4b549a2ef4bef9965d97cbd992ba67930cd3e0fe 52 | * Author: Eric Dumazet 53 | * Date: Fri May 11 09:30:50 2012 +0000 54 | * fq_codel: Fair Queue Codel AQM 55 | */ 56 | 57 | /* FQ_CODEL */ 58 | 59 | enum { 60 | TCA_FQ_CODEL_UNSPEC, 61 | TCA_FQ_CODEL_TARGET, 62 | TCA_FQ_CODEL_LIMIT, 63 | TCA_FQ_CODEL_INTERVAL, 64 | TCA_FQ_CODEL_ECN, 65 | TCA_FQ_CODEL_FLOWS, 66 | TCA_FQ_CODEL_QUANTUM, 67 | __TCA_FQ_CODEL_MAX 68 | }; 69 | 70 | #define TCA_FQ_CODEL_MAX (__TCA_FQ_CODEL_MAX - 1) 71 | 72 | enum { 73 | TCA_FQ_CODEL_XSTATS_QDISC, 74 | TCA_FQ_CODEL_XSTATS_CLASS, 75 | }; 76 | 77 | struct tc_fq_codel_qd_stats { 78 | __u32 maxpacket; /* largest packet we've seen so far */ 79 | __u32 drop_overlimit; /* number of time max qdisc 80 | * packet limit was hit 81 | */ 82 | __u32 ecn_mark; /* number of packets we ECN marked 83 | * instead of being dropped 84 | */ 85 | __u32 new_flow_count; /* number of time packets 86 | * created a 'new flow' 87 | */ 88 | __u32 new_flows_len; /* count of flows in new list */ 89 | __u32 old_flows_len; /* count of flows in old list */ 90 | }; 91 | 92 | struct tc_fq_codel_cl_stats { 93 | __s32 deficit; 94 | __u32 ldelay; /* in-queue delay seen by most recently 95 | * dequeued packet 96 | */ 97 | __u32 count; 98 | __u32 lastcount; 99 | __u32 dropping; 100 | __s32 drop_next; 101 | }; 102 | 103 | struct tc_fq_codel_xstats { 104 | __u32 type; 105 | union { 106 | struct tc_fq_codel_qd_stats qdisc_stats; 107 | struct tc_fq_codel_cl_stats class_stats; 108 | }; 109 | }; 110 | 111 | 112 | /* Backports tty_lock: Localise the lock */ 113 | #define tty_lock(__tty) tty_lock() 114 | #define tty_unlock(__tty) tty_unlock() 115 | 116 | /* Backport ether_addr_equal */ 117 | static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2) 118 | { 119 | return !Sstar_compare_ether_addr(addr1, addr2); 120 | } 121 | 122 | #define net_ratelimited_function(function, ...) \ 123 | do { \ 124 | if (net_ratelimit()) \ 125 | function(__VA_ARGS__); \ 126 | } while (0) 127 | 128 | #define net_emerg_ratelimited(fmt, ...) \ 129 | net_ratelimited_function(pr_emerg, fmt, ##__VA_ARGS__) 130 | #define net_alert_ratelimited(fmt, ...) \ 131 | net_ratelimited_function(pr_alert, fmt, ##__VA_ARGS__) 132 | #define net_crit_ratelimited(fmt, ...) \ 133 | net_ratelimited_function(pr_crit, fmt, ##__VA_ARGS__) 134 | #define net_err_ratelimited(fmt, ...) \ 135 | net_ratelimited_function(pr_err, fmt, ##__VA_ARGS__) 136 | #define net_notice_ratelimited(fmt, ...) \ 137 | net_ratelimited_function(pr_notice, fmt, ##__VA_ARGS__) 138 | #define net_warn_ratelimited(fmt, ...) \ 139 | net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__) 140 | #define net_info_ratelimited(fmt, ...) \ 141 | net_ratelimited_function(pr_info, fmt, ##__VA_ARGS__) 142 | #define net_dbg_ratelimited(fmt, ...) \ 143 | net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__) 144 | 145 | /*code not present in wireless community. included to resolve error*/ 146 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) 147 | #define br_port_exists(dev) (dev->priv_flags & IFF_BRIDGE_PORT) 148 | #else 149 | #define br_port_exists(dev) (dev->br_port) 150 | #endif 151 | 152 | 153 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) */ 154 | 155 | #endif /* LINUX_3_5_COMPAT_H */ 156 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/key.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2004, Instant802 Networks, Inc. 3 | * Copyright 2005, Devicescape Software, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation. 8 | */ 9 | 10 | #ifndef IEEE80211_KEY_H 11 | #define IEEE80211_KEY_H 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define NUM_DEFAULT_KEYS 4 20 | #define NUM_DEFAULT_MGMT_KEYS 2 21 | 22 | #define WEP_IV_LEN 4 23 | #define WEP_ICV_LEN 4 24 | #define ALG_CCMP_KEY_LEN 16 25 | #define CCMP_HDR_LEN 8 26 | #define CCMP_MIC_LEN 8 27 | #define CCMP_TK_LEN 16 28 | #define CCMP_PN_LEN 6 29 | #define TKIP_IV_LEN 8 30 | #define TKIP_ICV_LEN 4 31 | #define CMAC_PN_LEN 6 32 | #define WAPI_IV_LEN 18 33 | #define WAPI_ICV_LEN 16 34 | 35 | #define NUM_RX_DATA_QUEUES 16 36 | 37 | struct ieee80211_local; 38 | struct ieee80211_sub_if_data; 39 | struct sta_info; 40 | 41 | /** 42 | * enum ieee80211_internal_key_flags - internal key flags 43 | * 44 | * @KEY_FLAG_UPLOADED_TO_HARDWARE: Indicates that this key is present 45 | * in the hardware for TX crypto hardware acceleration. 46 | * @KEY_FLAG_TAINTED: Key is tainted and packets should be dropped. 47 | */ 48 | enum ieee80211_internal_key_flags { 49 | KEY_FLAG_UPLOADED_TO_HARDWARE = BIT(0), 50 | KEY_FLAG_TAINTED = BIT(1), 51 | }; 52 | 53 | enum ieee80211_internal_tkip_state { 54 | TKIP_STATE_NOT_INIT, 55 | TKIP_STATE_PHASE1_DONE, 56 | TKIP_STATE_PHASE1_HW_UPLOADED, 57 | }; 58 | 59 | struct tkip_ctx { 60 | u32 iv32; /* current iv32 */ 61 | u16 iv16; /* current iv16 */ 62 | u16 p1k[5]; /* p1k cache */ 63 | u32 p1k_iv32; /* iv32 for which p1k computed */ 64 | enum ieee80211_internal_tkip_state state; 65 | }; 66 | 67 | struct ieee80211_key { 68 | struct ieee80211_local *local; 69 | struct ieee80211_sub_if_data *sdata; 70 | struct sta_info *sta; 71 | 72 | /* for sdata list */ 73 | struct list_head list; 74 | 75 | /* protected by key mutex */ 76 | unsigned int flags; 77 | 78 | union { 79 | struct { 80 | /* protects tx context */ 81 | spinlock_t txlock; 82 | 83 | /* last used TSC */ 84 | struct tkip_ctx tx; 85 | 86 | /* last received RSC */ 87 | struct tkip_ctx rx[NUM_RX_DATA_QUEUES]; 88 | } tkip; 89 | struct { 90 | atomic64_t tx_pn; 91 | /* 92 | * Last received packet number. The first 93 | * NUM_RX_DATA_QUEUES counters are used with Data 94 | * frames and the last counter is used with Robust 95 | * Management frames. 96 | */ 97 | u8 rx_pn[NUM_RX_DATA_QUEUES + 1][CCMP_PN_LEN]; 98 | u8 prev_rx_pn[NUM_RX_DATA_QUEUES + 1][6]; 99 | struct crypto_cipher *tfm; 100 | u32 replays; /* dot11RSNAStatsCCMPReplays */ 101 | } ccmp; 102 | struct { 103 | atomic64_t tx_pn; 104 | u8 rx_pn[CMAC_PN_LEN]; 105 | struct crypto_cipher *tfm; 106 | u32 replays; /* dot11RSNAStatsCMACReplays */ 107 | u32 icverrors; /* dot11RSNAStatsCMACICVErrors */ 108 | } aes_cmac; 109 | } u; 110 | 111 | /* number of times this key has been used */ 112 | int tx_rx_count; 113 | 114 | #ifdef CONFIG_MAC80211_SSTAR_DEBUGFS 115 | struct { 116 | struct dentry *stalink; 117 | struct dentry *dir; 118 | int cnt; 119 | } debugfs; 120 | #endif 121 | 122 | #ifdef CONFIG_MAC80211_SSTAR_ROAMING_CHANGES 123 | /* rcu: used for non blocking key freeing */ 124 | struct rcu_head rcu; 125 | #endif 126 | /* 127 | * key config, must be last because it contains key 128 | * material as variable length member 129 | */ 130 | struct ieee80211_key_conf conf; 131 | }; 132 | 133 | struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len, 134 | const u8 *key_data, 135 | size_t seq_len, const u8 *seq); 136 | /* 137 | * Insert a key into data structures (sdata, sta if necessary) 138 | * to make it used, free old key. 139 | */ 140 | int __must_check ieee80211_key_link(struct ieee80211_key *key, 141 | struct ieee80211_sub_if_data *sdata, 142 | struct sta_info *sta); 143 | void __ieee80211_key_free(struct ieee80211_key *key); 144 | void ieee80211_key_free(struct ieee80211_local *local, 145 | struct ieee80211_key *key); 146 | void ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx, 147 | bool uni, bool multi); 148 | void ieee80211_set_default_mgmt_key(struct ieee80211_sub_if_data *sdata, 149 | int idx); 150 | void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata); 151 | void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata); 152 | void ieee80211_disable_keys(struct ieee80211_sub_if_data *sdata); 153 | 154 | #define key_mtx_dereference(local, ref) \ 155 | rcu_dereference_protected(ref, lockdep_is_held(&((local)->key_mtx))) 156 | 157 | #endif /* IEEE80211_KEY_H */ 158 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/wme.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004, Instant802 Networks, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 2 as 6 | * published by the Free Software Foundation. 7 | */ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | #include "ieee80211_i.h" 19 | #include "wme.h" 20 | 21 | /* Default mapping in classifier to work with default 22 | * queue setup. 23 | */ 24 | const int ieee802_1d_to_ac[8] = { 25 | IEEE80211_AC_BE, 26 | IEEE80211_AC_BK, 27 | IEEE80211_AC_BK, 28 | IEEE80211_AC_BE, 29 | IEEE80211_AC_VI, 30 | IEEE80211_AC_VI, 31 | IEEE80211_AC_VO, 32 | IEEE80211_AC_VO 33 | }; 34 | 35 | static int wme_downgrade_ac(struct sk_buff *skb) 36 | { 37 | switch (skb->priority) { 38 | case 6: 39 | case 7: 40 | skb->priority = 5; /* VO -> VI */ 41 | return 0; 42 | case 4: 43 | case 5: 44 | skb->priority = 3; /* VI -> BE */ 45 | return 0; 46 | case 0: 47 | case 3: 48 | skb->priority = 2; /* BE -> BK */ 49 | return 0; 50 | default: 51 | return -1; 52 | } 53 | } 54 | 55 | 56 | /* Indicate which queue to use. */ 57 | u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, 58 | struct sk_buff *skb) 59 | { 60 | struct ieee80211_local *local = sdata->local; 61 | struct sta_info *sta = NULL; 62 | const u8 *ra = NULL; 63 | bool qos = false; 64 | 65 | if (local->hw.queues < IEEE80211_NUM_ACS || skb->len < 6) { 66 | skb->priority = 0; /* required for correct WPA/11i MIC */ 67 | return 0; 68 | } 69 | 70 | rcu_read_lock(); 71 | switch (sdata->vif.type) { 72 | case NL80211_IFTYPE_AP_VLAN: 73 | sta = rcu_dereference(sdata->u.vlan.sta); 74 | if (sta) { 75 | qos = test_sta_flag(sta, WLAN_STA_WME); 76 | break; 77 | } 78 | case NL80211_IFTYPE_AP: 79 | ra = skb->data; 80 | break; 81 | case NL80211_IFTYPE_WDS: 82 | ra = sdata->u.wds.remote_addr; 83 | break; 84 | #ifdef CONFIG_MAC80211_SSTAR_MESH 85 | case NL80211_IFTYPE_MESH_POINT: 86 | ra = skb->data; 87 | break; 88 | #endif 89 | case NL80211_IFTYPE_STATION: 90 | ra = sdata->u.mgd.bssid; 91 | break; 92 | case NL80211_IFTYPE_ADHOC: 93 | ra = skb->data; 94 | break; 95 | default: 96 | break; 97 | } 98 | 99 | if (!sta && ra && !is_multicast_ether_addr(ra)) { 100 | sta = sta_info_get(sdata, ra); 101 | if (sta) 102 | qos = test_sta_flag(sta, WLAN_STA_WME); 103 | } 104 | rcu_read_unlock(); 105 | 106 | if (!qos) { 107 | skb->priority = 0; /* required for correct WPA/11i MIC */ 108 | return IEEE80211_AC_BE; 109 | } 110 | 111 | /* use the data classifier to determine what 802.1d tag the 112 | * data frame has */ 113 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)) 114 | skb->priority = cfg80211_classify8021d(skb); 115 | #else 116 | skb->priority = cfg80211_classify8021d(skb,NULL); 117 | #endif 118 | 119 | return ieee80211_downgrade_queue(local, skb); 120 | } 121 | 122 | u16 ieee80211_downgrade_queue(struct ieee80211_local *local, 123 | struct sk_buff *skb) 124 | { 125 | /* in case we are a client verify acm is not set for this ac */ 126 | #ifdef CONFIG_SSTAR_APOLLO_TESTMODE 127 | /*And if acm is set check whether the ac has been admitted */ 128 | while (unlikely((local->wmm_acm & BIT(skb->priority)) && 129 | !(local->wmm_admitted_ups & BIT(skb->priority)))) { 130 | #else 131 | while (unlikely(local->wmm_acm & BIT(skb->priority))) { 132 | #endif /*CONFIG_SSTAR_APOLLO_TESTMODE*/ 133 | if (wme_downgrade_ac(skb)) { 134 | /* 135 | * This should not really happen. The AP has marked all 136 | * lower ACs to require admission control which is not 137 | * a reasonable configuration. Allow the frame to be 138 | * transmitted using AC_BK as a workaround. 139 | */ 140 | break; 141 | } 142 | } 143 | 144 | /* look up which queue to use for frames with this 1d tag */ 145 | return ieee802_1d_to_ac[skb->priority]; 146 | } 147 | 148 | void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata, 149 | struct sk_buff *skb) 150 | { 151 | struct ieee80211_hdr *hdr = (void *)skb->data; 152 | 153 | /* Fill in the QoS header if there is one. */ 154 | if (ieee80211_is_data_qos(hdr->frame_control)) { 155 | u8 *p = ieee80211_get_qos_ctl(hdr); 156 | u8 ack_policy, tid; 157 | 158 | tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; 159 | 160 | /* preserve EOSP bit */ 161 | ack_policy = *p & IEEE80211_QOS_CTL_EOSP; 162 | 163 | if (unlikely(sdata->local->wifi_wme_noack_test)) 164 | ack_policy |= IEEE80211_QOS_CTL_ACK_POLICY_NOACK; 165 | /* qos header is 2 bytes */ 166 | *p++ = ack_policy | tid; 167 | *p = ieee80211_vif_is_mesh(&sdata->vif) ? 168 | (IEEE80211_QOS_CTL_MESH_CONTROL_PRESENT >> 8) : 0; 169 | } 170 | } 171 | -------------------------------------------------------------------------------- /hal_apollo/bh.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Device handling thread interface for mac80211 sigmastar APOLLO drivers 3 | * 4 | * Copyright (c) 2016, sigmastar 5 | * Author: 6 | * 7 | * Copyright (c) 2010, ST-Ericsson 8 | * Author: Dmitry Tarnyagin 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License version 2 as 12 | * published by the Free Software Foundation. 13 | */ 14 | 15 | #ifndef SSTAR_APOLLO_BH_H 16 | #define SSTAR_APOLLO_BH_H 17 | 18 | /* extern */ struct Sstar_common; 19 | 20 | #define SDIO_BLOCK_SIZE 256 21 | 22 | /* Suspend state privates */ 23 | enum Sstar_bh_pm_state { 24 | SSTAR_APOLLO_BH_RESUMED = 0, 25 | SSTAR_APOLLO_BH_SUSPEND, 26 | SSTAR_APOLLO_BH_SUSPENDED, 27 | SSTAR_APOLLO_BH_RESUME, 28 | }; 29 | enum Sstar_rx_frame_type{ 30 | SSTAR_RX_RAW_FRAME = 1, 31 | SSTAR_RX_DERICTLY_DATA_FRAME, 32 | SSTAR_RX_SLOW_MGMT_FRAME, 33 | SSTAR_RX_WSM_CMD_FRAME, 34 | SSTAR_RX_WSM_DATA_FRAME, 35 | }; 36 | #include "bh_usb.h" 37 | 38 | int Sstar_register_bh(struct Sstar_common *hw_priv); 39 | void Sstar_unregister_bh(struct Sstar_common *hw_priv); 40 | void Sstar_irq_handler(struct Sstar_common *hw_priv); 41 | void Sstar_bh_wakeup(struct Sstar_common *hw_priv); 42 | int Sstar_bh_suspend(struct Sstar_common *hw_priv); 43 | int Sstar_bh_resume(struct Sstar_common *hw_priv); 44 | /* Must be called from BH thread. */ 45 | void Sstar_enable_powersave(struct Sstar_vif *priv, 46 | bool enable); 47 | int wsm_release_tx_buffer(struct Sstar_common *hw_priv, int count); 48 | void wsm_alloc_tx_buffer(struct Sstar_common *hw_priv); 49 | int wsm_release_vif_tx_buffer(struct Sstar_common *hw_priv, int if_id, 50 | int count); 51 | void Sstar_put_skb(struct Sstar_common *hw_priv, struct sk_buff *skb); 52 | 53 | int Sstar_powerave_sdio_sync(struct Sstar_common *hw_priv); 54 | int Sstar_device_wakeup(struct Sstar_common *hw_priv); 55 | void Sstar_get_cca_work(struct work_struct *work); 56 | #ifdef SSTAR_SDIO_PATCH 57 | u16 Sstar_CalCheckSum(const u8 *data,u16 len); 58 | void Sstar_packetId_to_seq(struct Sstar_common *hw_priv,u32 packetId); 59 | int Sstar_seq_to_packetId(struct Sstar_common *hw_priv,u32 seq); 60 | #endif 61 | #ifdef SSTAR_PRIVATE_IE 62 | void Sstar_set_channel_work(struct work_struct *work); 63 | void Sstar_channel_timer(unsigned long arg); 64 | #endif 65 | static inline int Sstar_bh_is_term(struct Sstar_common *hw_priv){ 66 | if((hw_priv->bh_thread==NULL) || (hw_priv->bh_error==1)||(atomic_read(&hw_priv->Sstar_pluged)==0)){ 67 | return 1; 68 | } 69 | else { 70 | return 0; 71 | } 72 | } 73 | #define can_not_queue_work(hw_priv) \ 74 | (((hw_priv)->workqueue==NULL)) 75 | #define Sstar_hw_priv_queue_work(hw_priv,work) \ 76 | (can_not_queue_work(hw_priv) ? -1:queue_work((hw_priv)->workqueue,work)) 77 | #define Sstar_hw_priv_queue_delayed_work(hw_priv,dwork,delay) \ 78 | (can_not_queue_work(hw_priv) ? -1:queue_delayed_work((hw_priv)->workqueue,dwork,delay)) 79 | static inline bool Sstar_cancle_queue_work(struct work_struct *work,bool sync) 80 | { 81 | bool retval = false; 82 | if((sync == true) || work_pending(work)) 83 | { 84 | retval = cancel_work_sync(work); 85 | } 86 | 87 | return retval; 88 | } 89 | 90 | static inline bool Sstar_cancle_delayed_work(struct delayed_work *dwork,bool sync) 91 | { 92 | bool retval = false; 93 | if(sync == true) 94 | { 95 | retval = cancel_delayed_work_sync(dwork); 96 | } 97 | else 98 | { 99 | retval = cancel_delayed_work(dwork); 100 | } 101 | 102 | return retval; 103 | } 104 | #ifdef CONFIG_PM 105 | #define Sstar_hold_suspend(__hw_priv) Sstar_pm_stay_awake_lock(&((__hw_priv)->pm_state)) 106 | #define Sstar_release_suspend(__hw_priv) Sstar_pm_stay_awake_unlock(&((__hw_priv)->pm_state)) 107 | #else 108 | #define Sstar_hold_suspend(__hw_priv) BUG_ON(__hw_priv==NULL) 109 | #define Sstar_release_suspend(__hw_priv) BUG_ON(__hw_priv==NULL) 110 | #endif 111 | 112 | #define Sstar_wait_event_timeout_stay_awake(_hw_priv,_wait_q,_cond,_timeout,_awake) \ 113 | ({ \ 114 | long ret_timeout = _timeout; \ 115 | if(_awake == true) Sstar_hold_suspend(_hw_priv); \ 116 | ret_timeout = wait_event_timeout(_wait_q,_cond,ret_timeout); \ 117 | if(_awake == true) Sstar_release_suspend(_hw_priv); \ 118 | ret_timeout; \ 119 | }) 120 | static inline void Sstar_ieee80211_rx(struct ieee80211_hw *hw,struct sk_buff *skb) 121 | { 122 | #ifdef IEEE80211_TASKLET 123 | ieee80211_rx_irqsafe(hw,skb); 124 | #else 125 | if(skb->pkt_type == SSTAR_RX_DERICTLY_DATA_FRAME){ 126 | ieee80211_rx_irqsafe(hw,skb); 127 | }else if(softirq_count() == 0){ 128 | skb->pkt_type = 0; 129 | ieee80211_rx_ni(hw,skb); 130 | }else { 131 | skb->pkt_type = 0; 132 | ieee80211_rx(hw,skb); 133 | } 134 | #endif 135 | } 136 | 137 | static inline void Sstar_ieee80211_tx_status(struct ieee80211_hw *hw,struct sk_buff *skb) 138 | { 139 | ieee80211_tx_status_ni(hw,skb); 140 | } 141 | #endif /* SSTAR_APOLLO_BH_H */ 142 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/rate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2005, Instant802 Networks, Inc. 3 | * Copyright 2005, Devicescape Software, Inc. 4 | * Copyright (c) 2006 Jiri Benc 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 2 as 8 | * published by the Free Software Foundation. 9 | */ 10 | 11 | #ifndef IEEE80211_RATE_H 12 | #define IEEE80211_RATE_H 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include "ieee80211_i.h" 20 | #include "sta_info.h" 21 | 22 | struct rate_control_ref { 23 | struct ieee80211_local *local; 24 | struct rate_control_ops *ops; 25 | void *priv; 26 | struct kref kref; 27 | }; 28 | 29 | void rate_control_get_rate(struct ieee80211_sub_if_data *sdata, 30 | struct sta_info *sta, 31 | struct ieee80211_tx_rate_control *txrc); 32 | struct rate_control_ref *rate_control_get(struct rate_control_ref *ref); 33 | void rate_control_put(struct rate_control_ref *ref); 34 | 35 | static inline void rate_control_tx_status(struct ieee80211_local *local, 36 | struct ieee80211_supported_band *sband, 37 | struct sta_info *sta, 38 | struct sk_buff *skb) 39 | { 40 | struct rate_control_ref *ref = local->rate_ctrl; 41 | struct ieee80211_sta *ista = &sta->sta; 42 | void *priv_sta = sta->rate_ctrl_priv; 43 | 44 | if (!ref) 45 | return; 46 | 47 | ref->ops->tx_status(ref->priv, sband, ista, priv_sta, skb); 48 | } 49 | 50 | 51 | static inline void rate_control_rate_init(struct sta_info *sta) 52 | { 53 | struct ieee80211_local *local = sta->sdata->local; 54 | struct ieee80211_channel_state *chan_state = ieee80211_get_channel_state(local, sta->sdata); 55 | struct rate_control_ref *ref = sta->rate_ctrl; 56 | struct ieee80211_sta *ista = &sta->sta; 57 | void *priv_sta = sta->rate_ctrl_priv; 58 | struct ieee80211_supported_band *sband; 59 | 60 | if (!ref) 61 | return; 62 | 63 | sband = local->hw.wiphy->bands[chan_state->conf.channel->band]; 64 | 65 | ref->ops->rate_init(ref->priv, sband, ista, priv_sta); 66 | } 67 | 68 | static inline void rate_control_rate_update(struct ieee80211_local *local, 69 | struct ieee80211_supported_band *sband, 70 | struct sta_info *sta, u32 changed, 71 | enum nl80211_channel_type oper_chan_type) 72 | { 73 | struct rate_control_ref *ref = local->rate_ctrl; 74 | struct ieee80211_sta *ista = &sta->sta; 75 | void *priv_sta = sta->rate_ctrl_priv; 76 | 77 | if (ref && ref->ops->rate_update) 78 | ref->ops->rate_update(ref->priv, sband, ista, 79 | priv_sta, changed, oper_chan_type); 80 | } 81 | 82 | static inline void *rate_control_alloc_sta(struct rate_control_ref *ref, 83 | struct ieee80211_sta *sta, 84 | gfp_t gfp) 85 | { 86 | return ref->ops->alloc_sta(ref->priv, sta, gfp); 87 | } 88 | 89 | static inline void rate_control_free_sta(struct sta_info *sta) 90 | { 91 | struct rate_control_ref *ref = sta->rate_ctrl; 92 | struct ieee80211_sta *ista = &sta->sta; 93 | void *priv_sta = sta->rate_ctrl_priv; 94 | 95 | ref->ops->free_sta(ref->priv, ista, priv_sta); 96 | } 97 | 98 | static inline void rate_control_add_sta_debugfs(struct sta_info *sta) 99 | { 100 | #ifdef CONFIG_MAC80211_SSTAR_DEBUGFS 101 | struct rate_control_ref *ref = sta->rate_ctrl; 102 | if (ref && sta->debugfs.dir && ref->ops->add_sta_debugfs) 103 | ref->ops->add_sta_debugfs(ref->priv, sta->rate_ctrl_priv, 104 | sta->debugfs.dir); 105 | #endif 106 | } 107 | 108 | static inline void rate_control_remove_sta_debugfs(struct sta_info *sta) 109 | { 110 | #ifdef CONFIG_MAC80211_SSTAR_DEBUGFS 111 | struct rate_control_ref *ref = sta->rate_ctrl; 112 | if (ref && ref->ops->remove_sta_debugfs) 113 | ref->ops->remove_sta_debugfs(ref->priv, sta->rate_ctrl_priv); 114 | #endif 115 | } 116 | 117 | /* Get a reference to the rate control algorithm. If `name' is NULL, get the 118 | * first available algorithm. */ 119 | int Sstar_ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local, 120 | const char *name); 121 | void rate_control_deinitialize(struct ieee80211_local *local); 122 | 123 | 124 | /* Rate control algorithms */ 125 | #ifdef CONFIG_MAC80211_SSTAR_RC_PID 126 | extern int rc80211_pid_init(void); 127 | extern void Sstar_rc80211_pid_exit(void); 128 | #else 129 | static inline int rc80211_pid_init(void) 130 | { 131 | return 0; 132 | } 133 | static inline void Sstar_rc80211_pid_exit(void) 134 | { 135 | } 136 | #endif 137 | 138 | #ifdef CONFIG_MAC80211_SSTAR_RC_MINSTREL 139 | extern int rc80211_minstrel_init(void); 140 | extern void rc80211_minstrel_exit(void); 141 | #else 142 | static inline int rc80211_minstrel_init(void) 143 | { 144 | return 0; 145 | } 146 | static inline void rc80211_minstrel_exit(void) 147 | { 148 | } 149 | #endif 150 | 151 | #ifdef CONFIG_MAC80211_SSTAR_RC_MINSTREL_HT 152 | extern int rc80211_minstrel_ht_init(void); 153 | extern void Sstar_rc80211_minstrel_ht_exit(void); 154 | #else 155 | static inline int rc80211_minstrel_ht_init(void) 156 | { 157 | return 0; 158 | } 159 | static inline void Sstar_rc80211_minstrel_ht_exit(void) 160 | { 161 | } 162 | #endif 163 | 164 | struct tagsstarRateControl{ 165 | u8 my_index[2]; 166 | u8 my_flags[2]; 167 | u32 rate_fix[2]; 168 | int use_cts_prot; 169 | int use_short_preamble; 170 | int usr_short_slot; 171 | }; 172 | 173 | #endif /* IEEE80211_RATE_H */ 174 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/rc80211_minstrel_debugfs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 Felix Fietkau 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 2 as 6 | * published by the Free Software Foundation. 7 | * 8 | * Based on minstrel.c: 9 | * Copyright (C) 2005-2007 Derek Smithies 10 | * Sponsored by Indranet Technologies Ltd 11 | * 12 | * Based on sample.c: 13 | * Copyright (c) 2005 John Bicket 14 | * All rights reserved. 15 | * 16 | * Redistribution and use in source and binary forms, with or without 17 | * modification, are permitted provided that the following conditions 18 | * are met: 19 | * 1. Redistributions of source code must retain the above copyright 20 | * notice, this list of conditions and the following disclaimer, 21 | * without modification. 22 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer 23 | * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 24 | * redistribution must be conditioned upon including a substantially 25 | * similar Disclaimer requirement for further binary redistribution. 26 | * 3. Neither the names of the above-listed copyright holders nor the names 27 | * of any contributors may be used to endorse or promote products derived 28 | * from this software without specific prior written permission. 29 | * 30 | * Alternatively, this software may be distributed under the terms of the 31 | * GNU General Public License ("GPL") version 2 as published by the Free 32 | * Software Foundation. 33 | * 34 | * NO WARRANTY 35 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 38 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 39 | * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 40 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 41 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 42 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 43 | * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 44 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 45 | * THE POSSIBILITY OF SUCH DAMAGES. 46 | */ 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include "rc80211_minstrel.h" 56 | 57 | int 58 | minstrel_stats_open(struct inode *inode, struct file *file) 59 | { 60 | struct minstrel_sta_info *mi = inode->i_private; 61 | struct minstrel_debugfs_info *ms; 62 | unsigned int i, tp, prob, eprob; 63 | char *p; 64 | 65 | ms = Sstar_kmalloc(sizeof(*ms) + 4096, GFP_KERNEL); 66 | if (!ms) 67 | return -ENOMEM; 68 | 69 | file->private_data = ms; 70 | p = ms->buf; 71 | p += sprintf(p, "rate throughput ewma prob this prob " 72 | "this succ/attempt success attempts\n"); 73 | for (i = 0; i < mi->n_rates; i++) { 74 | struct minstrel_rate *mr = &mi->r[i]; 75 | 76 | *(p++) = (i == mi->max_tp_rate) ? 'T' : ' '; 77 | *(p++) = (i == mi->max_tp_rate2) ? 't' : ' '; 78 | *(p++) = (i == mi->max_prob_rate) ? 'P' : ' '; 79 | p += sprintf(p, "%3u%s", mr->bitrate / 2, 80 | (mr->bitrate & 1 ? ".5" : " ")); 81 | 82 | tp = mr->cur_tp / ((18000 << 10) / 96); 83 | prob = mr->cur_prob / 18; 84 | eprob = mr->probability / 18; 85 | 86 | p += sprintf(p, " %6u.%1u %6u.%1u %6u.%1u " 87 | "%3u(%3u) %8llu %8llu\n", 88 | tp / 10, tp % 10, 89 | eprob / 10, eprob % 10, 90 | prob / 10, prob % 10, 91 | mr->last_success, 92 | mr->last_attempts, 93 | (unsigned long long)mr->succ_hist, 94 | (unsigned long long)mr->att_hist); 95 | } 96 | p += sprintf(p, "\nTotal packet count:: ideal %d " 97 | "lookaround %d\n\n", 98 | mi->packet_count - mi->sample_count, 99 | mi->sample_count); 100 | ms->len = p - ms->buf; 101 | 102 | return 0; 103 | } 104 | 105 | ssize_t 106 | minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos) 107 | { 108 | struct minstrel_debugfs_info *ms; 109 | 110 | ms = file->private_data; 111 | return simple_read_from_buffer(buf, len, ppos, ms->buf, ms->len); 112 | } 113 | 114 | int 115 | minstrel_stats_release(struct inode *inode, struct file *file) 116 | { 117 | Sstar_kfree(file->private_data); 118 | return 0; 119 | } 120 | 121 | static const struct file_operations minstrel_stat_fops = { 122 | .owner = THIS_MODULE, 123 | .open = minstrel_stats_open, 124 | .read = minstrel_stats_read, 125 | .release = minstrel_stats_release, 126 | .llseek = default_llseek, 127 | }; 128 | 129 | void 130 | minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir) 131 | { 132 | struct minstrel_sta_info *mi = priv_sta; 133 | 134 | mi->dbg_stats = debugfs_create_file("rc_stats", S_IRUGO, dir, mi, 135 | &minstrel_stat_fops); 136 | } 137 | 138 | void 139 | minstrel_remove_sta_debugfs(void *priv, void *priv_sta) 140 | { 141 | struct minstrel_sta_info *mi = priv_sta; 142 | 143 | debugfs_remove(mi->dbg_stats); 144 | } 145 | -------------------------------------------------------------------------------- /hal_apollo/queue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * O(1) TX queue with built-in allocator for sigmastar APOLLO drivers 3 | * * 4 | * Copyright (c) 2016, sigmastar 5 | * Author: 6 | * 7 | * Based on apollo code 8 | * Copyright (c) 2010, ST-Ericsson 9 | * Author: Dmitry Tarnyagin 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License version 2 as 13 | * published by the Free Software Foundation. 14 | */ 15 | 16 | #ifndef SSTAR_APOLLO_QUEUE_H_INCLUDED 17 | #define SSTAR_APOLLO_QUEUE_H_INCLUDED 18 | #include "mac80211/ieee80211_i.h" 19 | 20 | /* private */ struct Sstar_queue_item; 21 | 22 | /* extern */ struct sk_buff; 23 | /* extern */ struct wsm_tx; 24 | /* extern */ struct Sstar_common; 25 | /* extern */ struct Sstar_vif; 26 | /* extern */ struct ieee80211_tx_queue_stats; 27 | /* extern */ struct Sstar_txpriv; 28 | 29 | /* forward */ struct Sstar_queue_stats; 30 | 31 | typedef void (*Sstar_queue_skb_dtor_t)(struct Sstar_common *priv, 32 | struct sk_buff *skb, 33 | const struct Sstar_txpriv *txpriv); 34 | 35 | struct Sstar_queue { 36 | struct Sstar_queue_stats *stats; 37 | u32 capacity; 38 | u32 num_queued; 39 | u32 num_queued_vif[SSTAR_WIFI_MAX_VIFS]; 40 | u32 num_pending; 41 | u32 num_pending_vif[SSTAR_WIFI_MAX_VIFS]; 42 | u32 num_sent; 43 | u32 num_put; 44 | struct Sstar_queue_item *pool; 45 | struct list_head queue; 46 | struct list_head free_pool; 47 | struct list_head pending; 48 | #ifndef SSTAR_WIFI_QUEUE_LOCK_BUG 49 | int tx_locked_cnt; 50 | #else 51 | int tx_locked_cnt[SSTAR_WIFI_MAX_VIFS]; 52 | #endif 53 | int *link_map_cache[SSTAR_WIFI_MAX_VIFS]; 54 | #ifndef SSTAR_WIFI_QUEUE_LOCK_BUG 55 | bool overfull; 56 | #else 57 | bool overfull[SSTAR_WIFI_MAX_VIFS]; 58 | #endif 59 | spinlock_t lock; 60 | u8 queue_id; 61 | u8 generation; 62 | #ifndef SSTAR_WIFI_QUEUE_LOCK_BUG 63 | struct timer_list gc; 64 | #else 65 | struct timer_list gc[SSTAR_WIFI_MAX_VIFS]; 66 | u8 timer_to_if_id[SSTAR_WIFI_MAX_VIFS]; 67 | #endif 68 | unsigned long ttl; 69 | struct sk_buff *skb_last; 70 | }; 71 | 72 | struct Sstar_queue_stats { 73 | spinlock_t lock; 74 | int *link_map_cache[SSTAR_WIFI_MAX_VIFS]; 75 | int num_queued[SSTAR_WIFI_MAX_VIFS]; 76 | int map_capacity; 77 | wait_queue_head_t wait_link_id_empty; 78 | Sstar_queue_skb_dtor_t skb_dtor; 79 | struct Sstar_common *hw_priv; 80 | }; 81 | 82 | struct Sstar_txpriv { 83 | u8 link_id; 84 | u8 raw_link_id; 85 | u8 tid; 86 | u8 rate_id; 87 | u8 offset; 88 | u8 if_id; 89 | #ifndef P2P_MULTIVIF 90 | u8 offchannel_if_id; 91 | #else 92 | u8 raw_if_id; 93 | #endif 94 | }; 95 | 96 | int Sstar_queue_stats_init(struct Sstar_queue_stats *stats, 97 | size_t map_capacity, 98 | Sstar_queue_skb_dtor_t skb_dtor, 99 | struct Sstar_common *priv); 100 | int Sstar_queue_init(struct Sstar_queue *queue, 101 | struct Sstar_queue_stats *stats, 102 | u8 queue_id, 103 | size_t capacity, 104 | unsigned long ttl); 105 | int Sstar_queue_clear(struct Sstar_queue *queue, int if_id); 106 | void Sstar_queue_stats_deinit(struct Sstar_queue_stats *stats); 107 | void Sstar_queue_deinit(struct Sstar_queue *queue); 108 | 109 | size_t Sstar_queue_get_num_queued(struct Sstar_vif *priv, 110 | struct Sstar_queue *queue, 111 | u32 link_id_map); 112 | int Sstar_queue_put(struct Sstar_queue *queue, 113 | struct sk_buff *skb, 114 | struct Sstar_txpriv *txpriv); 115 | int Sstar_queue_get(struct Sstar_queue *queue, 116 | int if_id, 117 | u32 link_id_map, 118 | struct wsm_tx **tx, 119 | struct ieee80211_tx_info **tx_info, 120 | struct Sstar_txpriv **txpriv); 121 | #ifdef CONFIG_SSTAR_APOLLO_TESTMODE 122 | int Sstar_queue_requeue(struct Sstar_common *hw_priv, 123 | struct Sstar_queue *queue, 124 | u32 packetID, bool check); 125 | #else 126 | int Sstar_queue_requeue(struct Sstar_queue *queue, u32 packetID, bool check); 127 | #endif 128 | int Sstar_queue_requeue_all(struct Sstar_queue *queue); 129 | #ifdef CONFIG_SSTAR_APOLLO_TESTMODE 130 | int Sstar_queue_remove(struct Sstar_common *hw_priv, 131 | struct Sstar_queue *queue, 132 | u32 packetID); 133 | #else 134 | int Sstar_queue_remove(struct Sstar_queue *queue, 135 | u32 packetID); 136 | #endif /*CONFIG_SSTAR_APOLLO_TESTMODE*/ 137 | int Sstar_queue_get_skb(struct Sstar_queue *queue, u32 packetID, 138 | struct sk_buff **skb, 139 | const struct Sstar_txpriv **txpriv); 140 | #ifndef SSTAR_WIFI_QUEUE_LOCK_BUG 141 | void Sstar_queue_lock(struct Sstar_queue *queue); 142 | void Sstar_queue_unlock(struct Sstar_queue *queue); 143 | #else 144 | void Sstar_queue_lock(struct Sstar_queue *queue,int if_id); 145 | void Sstar_queue_unlock(struct Sstar_queue *queue,int if_id); 146 | #endif 147 | bool Sstar_queue_get_xmit_timestamp(struct Sstar_queue *queue, 148 | unsigned long *timestamp, int if_id, 149 | u32 pending_frameID); 150 | 151 | 152 | bool Sstar_queue_stats_is_empty(struct Sstar_queue_stats *stats, 153 | u32 link_id_map, int if_id); 154 | 155 | static inline u8 Sstar_queue_get_queue_id(u32 packetID) 156 | { 157 | return (packetID >> 16) & 0xF; 158 | } 159 | 160 | static inline u8 Sstar_queue_get_if_id(u32 packetID) 161 | { 162 | return (packetID >> 20) & 0xF; 163 | } 164 | 165 | static inline u8 Sstar_queue_get_link_id(u32 packetID) 166 | { 167 | return (packetID >> 24) & 0xF; 168 | } 169 | 170 | static inline u8 Sstar_queue_get_generation(u32 packetID) 171 | { 172 | return (packetID >> 8) & 0xFF; 173 | } 174 | 175 | #endif /* SSTAR_APOLLO_QUEUE_H_INCLUDED */ 176 | -------------------------------------------------------------------------------- /include/linux/compat-2.6.39.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_26_39_COMPAT_H 2 | #define LINUX_26_39_COMPAT_H 3 | 4 | #include 5 | 6 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #define tiocmget(tty) tiocmget(tty, NULL) 13 | #define tiocmset(tty, set, clear) tiocmset(tty, NULL, set, clear) 14 | 15 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)) 16 | extern int tty_set_termios(struct tty_struct *tty, struct ktermios *kt); 17 | #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)) */ 18 | 19 | static inline int irq_set_irq_wake(unsigned int irq, unsigned int on) 20 | { 21 | return set_irq_wake(irq, on); 22 | } 23 | static inline int irq_set_chip(unsigned int irq, struct irq_chip *chip) 24 | { 25 | return set_irq_chip(irq, chip); 26 | } 27 | static inline int irq_set_handler_data(unsigned int irq, void *data) 28 | { 29 | return set_irq_data(irq, data); 30 | } 31 | static inline int irq_set_chip_data(unsigned int irq, void *data) 32 | { 33 | return set_irq_chip_data(irq, data); 34 | } 35 | static inline int irq_set_irq_type(unsigned int irq, unsigned int type) 36 | { 37 | return set_irq_type(irq, type); 38 | } 39 | static inline int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry) 40 | { 41 | return set_irq_msi(irq, entry); 42 | } 43 | static inline struct irq_chip *irq_get_chip(unsigned int irq) 44 | { 45 | return get_irq_chip(irq); 46 | } 47 | static inline void *irq_get_chip_data(unsigned int irq) 48 | { 49 | return get_irq_chip_data(irq); 50 | } 51 | static inline void *irq_get_handler_data(unsigned int irq) 52 | { 53 | return get_irq_data(irq); 54 | } 55 | 56 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) 57 | static inline void *irq_data_get_irq_handler_data(struct irq_data *d) 58 | { 59 | return irq_data_get_irq_data(d); 60 | } 61 | #endif 62 | 63 | static inline struct msi_desc *irq_get_msi_desc(unsigned int irq) 64 | { 65 | return get_irq_msi(irq); 66 | } 67 | 68 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)) 69 | static inline void irq_set_noprobe(unsigned int irq) 70 | { 71 | set_irq_noprobe(irq); 72 | } 73 | static inline void irq_set_probe(unsigned int irq) 74 | { 75 | set_irq_probe(irq); 76 | } 77 | #endif 78 | 79 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) 80 | static inline struct irq_chip *irq_desc_get_chip(struct irq_desc *desc) 81 | { 82 | return get_irq_desc_chip(desc); 83 | } 84 | static inline void *irq_desc_get_handler_data(struct irq_desc *desc) 85 | { 86 | return get_irq_desc_data(desc); 87 | } 88 | 89 | static inline void *irq_desc_get_chip_data(struct irq_desc *desc) 90 | { 91 | return get_irq_desc_chip_data(desc); 92 | } 93 | 94 | static inline struct msi_desc *irq_desc_get_msi_desc(struct irq_desc *desc) 95 | { 96 | return get_irq_desc_msi(desc); 97 | } 98 | #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) */ 99 | 100 | /* 101 | * kstrto* was included in kernel 2.6.38.4 and causes conflicts with the 102 | * version included in compat-wireless. We use strict_strtol to check if 103 | * kstrto* is already available. 104 | */ 105 | #ifndef strict_strtol 106 | /* Internal, do not use. */ 107 | int __must_check _kstrtoul(const char *s, unsigned int base, unsigned long *res); 108 | int __must_check _kstrtol(const char *s, unsigned int base, long *res); 109 | 110 | int __must_check kstrtoull(const char *s, unsigned int base, unsigned long long *res); 111 | int __must_check kstrtoll(const char *s, unsigned int base, long long *res); 112 | static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res) 113 | { 114 | /* 115 | * We want to shortcut function call, but 116 | * __builtin_types_compatible_p(unsigned long, unsigned long long) = 0. 117 | */ 118 | if (sizeof(unsigned long) == sizeof(unsigned long long) && 119 | __alignof__(unsigned long) == __alignof__(unsigned long long)) 120 | return kstrtoull(s, base, (unsigned long long *)res); 121 | else 122 | return _kstrtoul(s, base, res); 123 | } 124 | 125 | static inline int __must_check kstrtol(const char *s, unsigned int base, long *res) 126 | { 127 | /* 128 | * We want to shortcut function call, but 129 | * __builtin_types_compatible_p(long, long long) = 0. 130 | */ 131 | if (sizeof(long) == sizeof(long long) && 132 | __alignof__(long) == __alignof__(long long)) 133 | return kstrtoll(s, base, (long long *)res); 134 | else 135 | return _kstrtol(s, base, res); 136 | } 137 | 138 | int __must_check kstrtouint(const char *s, unsigned int base, unsigned int *res); 139 | int __must_check kstrtoint(const char *s, unsigned int base, int *res); 140 | 141 | static inline int __must_check kstrtou64(const char *s, unsigned int base, u64 *res) 142 | { 143 | return kstrtoull(s, base, res); 144 | } 145 | 146 | static inline int __must_check kstrtos64(const char *s, unsigned int base, s64 *res) 147 | { 148 | return kstrtoll(s, base, res); 149 | } 150 | 151 | static inline int __must_check kstrtou32(const char *s, unsigned int base, u32 *res) 152 | { 153 | return kstrtouint(s, base, res); 154 | } 155 | 156 | static inline int __must_check kstrtos32(const char *s, unsigned int base, s32 *res) 157 | { 158 | return kstrtoint(s, base, res); 159 | } 160 | 161 | int __must_check kstrtou16(const char *s, unsigned int base, u16 *res); 162 | int __must_check kstrtos16(const char *s, unsigned int base, s16 *res); 163 | int __must_check kstrtou8(const char *s, unsigned int base, u8 *res); 164 | int __must_check kstrtos8(const char *s, unsigned int base, s8 *res); 165 | #endif /* ifndef strict_strtol */ 166 | 167 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */ 168 | 169 | #endif /* LINUX_26_39_COMPAT_H */ 170 | -------------------------------------------------------------------------------- /include/linux/compat-2.6.33.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_26_33_COMPAT_H 2 | #define LINUX_26_33_COMPAT_H 3 | 4 | #include 5 | 6 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) 7 | 8 | #include 9 | #include 10 | #if defined(CONFIG_PCCARD) || defined(CONFIG_PCCARD_MODULE) 11 | #include 12 | #include 13 | #include 14 | #endif 15 | #include 16 | 17 | #define release_firmware compat_release_firmware 18 | #define request_firmware compat_request_firmware 19 | #define request_firmware_nowait compat_request_firmware_nowait 20 | 21 | #if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE) 22 | int compat_request_firmware(const struct firmware **fw, const char *name, 23 | struct device *device); 24 | int compat_request_firmware_nowait( 25 | struct module *module, int uevent, 26 | const char *name, struct device *device, gfp_t gfp, void *context, 27 | void (*cont)(const struct firmware *fw, void *context)); 28 | 29 | void compat_release_firmware(const struct firmware *fw); 30 | #else 31 | static inline int compat_request_firmware(const struct firmware **fw, 32 | const char *name, 33 | struct device *device) 34 | { 35 | return -EINVAL; 36 | } 37 | static inline int request_firmware_nowait( 38 | struct module *module, int uevent, 39 | const char *name, struct device *device, gfp_t gfp, void *context, 40 | void (*cont)(const struct firmware *fw, void *context)) 41 | { 42 | return -EINVAL; 43 | } 44 | 45 | static inline void compat_release_firmware(const struct firmware *fw) 46 | { 47 | } 48 | #endif 49 | 50 | #define KEY_RFKILL 247 /* Key that controls all radios */ 51 | 52 | #define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */ 53 | /* source: include/linux/if.h */ 54 | 55 | /* this will never happen on older kernels */ 56 | #define NETDEV_POST_INIT 0xffff 57 | 58 | /* mask netdev_alloc_skb_ip_align as debian squeeze also backports this */ 59 | #define netdev_alloc_skb_ip_align(a, b) compat_netdev_alloc_skb_ip_align(a, b) 60 | 61 | static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev, 62 | unsigned int length) 63 | { 64 | struct sk_buff *skb = netdev_alloc_skb(dev, length + NET_IP_ALIGN); 65 | 66 | if (NET_IP_ALIGN && skb) 67 | skb_reserve(skb, NET_IP_ALIGN); 68 | return skb; 69 | } 70 | 71 | #if defined(CONFIG_PCCARD) || defined(CONFIG_PCCARD_MODULE) 72 | 73 | #if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) 74 | 75 | #define pcmcia_request_window(a, b, c) pcmcia_request_window(&a, b, c) 76 | 77 | #define pcmcia_map_mem_page(a, b, c) pcmcia_map_mem_page(b, c) 78 | 79 | /* loop over CIS entries */ 80 | int pcmcia_loop_tuple(struct pcmcia_device *p_dev, cisdata_t code, 81 | int (*loop_tuple) (struct pcmcia_device *p_dev, 82 | tuple_t *tuple, 83 | void *priv_data), 84 | void *priv_data); 85 | 86 | #endif /* CONFIG_PCMCIA */ 87 | 88 | /* loop over CIS entries */ 89 | int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function, 90 | cisdata_t code, cisparse_t *parse, void *priv_data, 91 | int (*loop_tuple) (tuple_t *tuple, 92 | cisparse_t *parse, 93 | void *priv_data)); 94 | 95 | #endif /* CONFIG_PCCARD */ 96 | 97 | /** 98 | * list_for_each_entry_continue_rcu - continue iteration over list of given type 99 | * @pos: the type * to use as a loop cursor. 100 | * @head: the head for your list. 101 | * @member: the name of the list_struct within the struct. 102 | * 103 | * Continue to iterate over list of given type, continuing after 104 | * the current position. 105 | */ 106 | #define list_for_each_entry_continue_rcu(pos, head, member) \ 107 | for (pos = list_entry_rcu(pos->member.next, typeof(*pos), member); \ 108 | prefetch(pos->member.next), &pos->member != (head); \ 109 | pos = list_entry_rcu(pos->member.next, typeof(*pos), member)) 110 | 111 | #define sock_recv_ts_and_drops(msg, sk, skb) sock_recv_timestamp(msg, sk, skb) 112 | 113 | /* mask pci_pcie_cap as debian squeeze also backports this */ 114 | #define pci_pcie_cap(a) compat_pci_pcie_cap(a) 115 | 116 | /** 117 | * pci_pcie_cap - get the saved PCIe capability offset 118 | * @dev: PCI device 119 | * 120 | * PCIe capability offset is calculated at PCI device initialization 121 | * time and saved in the data structure. This function returns saved 122 | * PCIe capability offset. Using this instead of pci_find_capability() 123 | * reduces unnecessary search in the PCI configuration space. If you 124 | * need to calculate PCIe capability offset from raw device for some 125 | * reasons, please use pci_find_capability() instead. 126 | */ 127 | static inline int pci_pcie_cap(struct pci_dev *dev) 128 | { 129 | return pci_find_capability(dev, PCI_CAP_ID_EXP); 130 | } 131 | 132 | /** 133 | * pci_is_pcie - check if the PCI device is PCI Express capable 134 | * @dev: PCI device 135 | * 136 | * Retrun true if the PCI device is PCI Express capable, false otherwise. 137 | */ 138 | static inline bool pci_is_pcie(struct pci_dev *dev) 139 | { 140 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)) 141 | return dev->is_pcie; 142 | #else 143 | return !!pci_pcie_cap(dev); 144 | #endif 145 | } 146 | 147 | #ifdef __GNUC__ 148 | #define __always_unused __attribute__((unused)) 149 | #else 150 | #define __always_unused /* unimplemented */ 151 | #endif 152 | 153 | /* mask IS_ERR_OR_NULL as debian squeeze also backports this */ 154 | #define IS_ERR_OR_NULL(a) compat_IS_ERR_OR_NULL(a) 155 | 156 | static inline long __must_check IS_ERR_OR_NULL(const void *ptr) 157 | { 158 | return !ptr || IS_ERR_VALUE((unsigned long)ptr); 159 | } 160 | 161 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) */ 162 | 163 | #endif /* LINUX_26_33_COMPAT_H */ 164 | -------------------------------------------------------------------------------- /hal_apollo/sbus.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Common sbus abstraction layer interface for apollo wireless driver 3 | * * 4 | * Copyright (c) 2016, sigmastar 5 | * Author: 6 | * 7 | * Based on apollo code 8 | * Copyright (c) 2010, ST-Ericsson 9 | * Author: Dmitry Tarnyagin 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License version 2 as 13 | * published by the Free Software Foundation. 14 | */ 15 | 16 | #ifndef SSTAR_APOLLO_SBUS_H 17 | #define SSTAR_APOLLO_SBUS_H 18 | #include "apollo_plat.h" 19 | /* 20 | * sbus priv forward definition. 21 | * Implemented and instantiated in particular modules. 22 | */ 23 | struct sbus_priv; 24 | 25 | typedef void (*sbus_irq_handler)(void *priv); 26 | typedef void (*sbus_callback_handler)(void *priv,void * arg); 27 | 28 | 29 | struct sbus_ops { 30 | #ifndef SPI_BUS 31 | int (*sbus_memcpy_fromio)(struct sbus_priv *self, unsigned int addr,void *dst, int count);/*rx queue mode*/ 32 | int (*sbus_memcpy_toio)(struct sbus_priv *self, unsigned int addr,const void *src, int count);/*tx queue mode*/ 33 | int (*sbus_read_async)(struct sbus_priv *self, unsigned int addr,void *dst, int count,sbus_callback_handler hander);/*rx queue mode*/ 34 | int (*sbus_write_async)(struct sbus_priv *self, unsigned int addr,const void *src, int count,sbus_callback_handler hander);/*tx queue mode*/ 35 | int (*sbus_read_sync)(struct sbus_priv *self, unsigned int addr, void *dst, int len);/*read register,download firmware,len <=256*/ 36 | int (*sbus_write_sync)(struct sbus_priv *self, unsigned int addr, const void *src, int len);/*write register,download firmware,len <=256*/ 37 | void (*lock)(struct sbus_priv *self); 38 | void (*unlock)(struct sbus_priv *self); 39 | int (*irq_subscribe)(struct sbus_priv *self, sbus_irq_handler handler, 40 | void *priv); 41 | int (*irq_unsubscribe)(struct sbus_priv *self); 42 | int (*reset)(struct sbus_priv *self); 43 | u32 (*align_size)(struct sbus_priv *self, u32 size); 44 | int (*power_mgmt)(struct sbus_priv *self, bool suspend); 45 | int (*set_block_size)(struct sbus_priv *self, u32 size); 46 | void (*wtd_wakeup)( struct sbus_priv *self); 47 | int (*usb_lock_reset)(struct sbus_priv *self); 48 | #ifdef SSTAR_USB_RESET 49 | int (*usb_reset)(struct sbus_priv *self); 50 | #endif 51 | int (*lmac_restart)(struct sbus_priv *self); 52 | int (*bootloader_debug_config)(struct sbus_priv *self,u16 enable); 53 | int (*lmac_start)(struct sbus_priv *self); 54 | int (*ep0_cmd)(struct sbus_priv *self); 55 | int (*sbus_reset_chip)(struct sbus_priv *self); 56 | int (*abort)(struct sbus_priv *self); 57 | int (*sbus_wsm_write)(struct sbus_priv *self); 58 | int (*sbus_data_write)(struct sbus_priv *self); 59 | int (*sbus_init)(struct sbus_priv *self); 60 | int (*sbus_deinit)(struct sbus_priv *self); 61 | int (*sbus_wait_data_xmited)(struct sbus_priv *self); 62 | int (*sbus_xmit_func_init)(struct sbus_priv *self); 63 | int (*sbus_xmit_func_deinit)(struct sbus_priv *self); 64 | int (*sbus_xmit_schedule)(struct sbus_priv *self); 65 | int (*sbus_rev_func_init)(struct sbus_priv *self); 66 | int (*sbus_rev_func_deinit)(struct sbus_priv *self); 67 | int (*sbus_rev_schedule)(struct sbus_priv *self); 68 | int (*sbus_rev_giveback)(struct sbus_priv *self,void *giveback); 69 | #else 70 | u32 (*align_size)(struct sbus_priv *self, u32 size); 71 | int (*set_block_size)(struct sbus_priv *self, u32 size); 72 | int (*irq_subscribe)(struct sbus_priv *self, sbus_irq_handler handler, 73 | void *priv); 74 | int (*irq_unsubscribe)(struct sbus_priv *self); 75 | int (*reset)(struct sbus_priv *self); 76 | void (*lock)(struct sbus_priv *self); 77 | void (*unlock)(struct sbus_priv *self); 78 | int (*power_mgmt)(struct sbus_priv *self, bool suspend); 79 | 80 | int (*sbus_read_data)(struct sbus_priv *self, void *rx, size_t rx_len); 81 | int (*sbus_write_data)(struct sbus_priv *self,const void *tx, size_t tx_len); 82 | int (*sbus_write_firmware)(struct sbus_priv *self,unsigned int addr, const void *src, int count); 83 | int (*sbus_read_status)(struct sbus_priv *self, u32 *status, size_t tx_len); 84 | int (*sbus_read_channelflag)(struct sbus_priv *self, u32 *channelflag); 85 | int (*sbus_update_channelflag)(struct sbus_priv *self); 86 | int (*sbus_read_ready)(struct sbus_priv *self, u32 *ready); 87 | int (*sbus_reset_cpu)(struct sbus_priv *self); 88 | int (*sbus_shutdown_wlan)(struct sbus_priv *self); 89 | int (*sbus_reset_chip)(struct sbus_priv *self); 90 | int (*bootloader_debug_config)(struct sbus_priv *self,u16 enable); 91 | int (*sbus_wsm_write)(struct sbus_priv *self); 92 | int (*sbus_data_write)(struct sbus_priv *self); 93 | int (*sbus_init)(struct sbus_priv *self); 94 | int (*sbus_deinit)(struct sbus_priv *self); 95 | int (*sbus_xmit_func_init)(struct sbus_priv *self); 96 | int (*sbus_xmit_func_deinit)(struct sbus_priv *self); 97 | int (*sbus_xmit_schedule)(struct sbus_priv *self); 98 | int (*sbus_rev_func_init)(struct sbus_priv *self); 99 | int (*sbus_rev_func_deinit)(struct sbus_priv *self); 100 | int (*sbus_rev_schedule)(struct sbus_priv *self); 101 | int (*sbus_rev_giveback)(struct sbus_priv *self,void *giveback); 102 | #endif 103 | }; 104 | 105 | 106 | 107 | #if (PROJ_TYPE>=ARES_B) 108 | enum HW_RESET_TYPE{ 109 | HW_RESET_HIF,//clean channels 110 | HW_RESET_HIF_SYSTEM, 111 | HW_RESET_HIF_SYSTEM_USB, 112 | HW_HOLD_CPU, 113 | HW_RUN_CPU, 114 | HW_RESET_HIF_SYSTEM_CPU, 115 | }; 116 | #define HW_RESET_REG_CPU BIT(16) 117 | #define HW_RESET_REG_HIF BIT(17) 118 | #define HW_RESET_REG_SYS BIT(18) 119 | #define HW_RESRT_REG_CHIP BIT(19) 120 | #define HW_RESET_REG_NEED_IRQ_TO_LMAC BIT(20) 121 | int Sstar_usb_ep0_hw_reset_cmd(struct sbus_priv *self,enum HW_RESET_TYPE type,bool irq_lmac); 122 | #endif //(PROJ_TYPE>=ARES_B) 123 | void Sstar_usb_kill_all_rxurb(struct sbus_priv *self); 124 | void Sstar_usb_kill_all_txurb(struct sbus_priv *self); 125 | int __Sstar_usb_suspend(struct sbus_priv *self); 126 | int __Sstar_usb_resume(struct sbus_priv *self); 127 | 128 | #endif /* SSTAR_APOLLO_SBUS_H */ 129 | --------------------------------------------------------------------------------