├── hal_apollo ├── util.h ├── svn_version.h ├── Makefile ├── dev_ioctl.h ├── mac80211 │ ├── scan.c │ ├── bridge.c │ ├── driver-trace.c │ ├── wext_cfg.h │ ├── debugfs_sta.h │ ├── debugfs.h │ ├── cfg.h │ ├── michael.h │ ├── wapi.h │ ├── debugfs_netdev.h │ ├── wme.h │ ├── aes_cmac.h │ ├── mac80211_bridge.h │ ├── aes_ccm.h │ ├── event.c │ ├── wpa.h │ ├── debugfs_key.h │ ├── ieee80211_atbm_mem.h │ ├── tkip.h │ ├── wep.h │ ├── wapi.c │ ├── atbm_common.h │ ├── led.h │ ├── michael.c │ ├── spectmgmt.c │ ├── aes_cmac.c │ ├── rc80211_minstrel_ht.h │ ├── rc80211_minstrel.h │ ├── rc80211_minstrel_ht_debugfs.c │ ├── chan.c │ ├── aes_ccm.c │ ├── key.h │ ├── wme.c │ └── rate.h ├── bh_spi.h ├── test.c ├── atbm_p2p.h ├── module_fs.h ├── bh_usb.h ├── dcxo_dpll.h ├── ht.h ├── dbg_event.h ├── fwio.h ├── hwio_usb.h ├── hwio_spi.h ├── pm.h ├── smartconfig.h ├── hwio.h ├── apollo_plat.h ├── ap.h ├── dbg_event.c ├── txrx.h ├── internal_cmd.h ├── scan.h ├── atbm_testmode.h └── bh.h ├── README.md ├── atbm_kconf ├── Kconfig.conf ├── Kconfig ├── Makefile ├── lxdialog │ ├── check-lxdialog.sh │ └── yesno.c ├── lkc_proto.h ├── list.h └── util.c ├── firmware ├── Ares_B_Chip_IPC_SDIO_svn14195_24M_6031_6031B.bin └── Ares_B_Chip_NVR_IPC_USB_svn14195_24M_6012B_6032.bin ├── 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 └── crypto │ └── aes.h ├── README ├── LICENSE ├── .config ├── Makefile.build.kernel └── Makefile.build /hal_apollo/util.h: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # atbm_60xx 2 | AltoBeam atbm WiFi driver 3 | -------------------------------------------------------------------------------- /hal_apollo/svn_version.h: -------------------------------------------------------------------------------- 1 | #define DRIVER_VER 20811 2 | -------------------------------------------------------------------------------- /hal_apollo/Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/atbm_60xx/master/hal_apollo/Makefile -------------------------------------------------------------------------------- /hal_apollo/dev_ioctl.h: -------------------------------------------------------------------------------- 1 | #ifndef __DEV_IOCTL_H__ 2 | #define __DEV_IOCTL_H__ 3 | 4 | 5 | #endif 6 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/scan.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/atbm_60xx/master/hal_apollo/mac80211/scan.c -------------------------------------------------------------------------------- /hal_apollo/mac80211/bridge.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/atbm_60xx/master/hal_apollo/mac80211/bridge.c -------------------------------------------------------------------------------- /atbm_kconf/Kconfig.conf: -------------------------------------------------------------------------------- 1 | config WIRELESS_CONIFG 2 | tristate "Atbm Wireless " 3 | depends on ATBM_APOLLO&&m 4 | -------------------------------------------------------------------------------- /firmware/Ares_B_Chip_IPC_SDIO_svn14195_24M_6031_6031B.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/atbm_60xx/master/firmware/Ares_B_Chip_IPC_SDIO_svn14195_24M_6031_6031B.bin -------------------------------------------------------------------------------- /firmware/Ares_B_Chip_NVR_IPC_USB_svn14195_24M_6012B_6032.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenIPC/atbm_60xx/master/firmware/Ares_B_Chip_NVR_IPC_USB_svn14195_24M_6012B_6032.bin -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /atbm_kconf/Kconfig: -------------------------------------------------------------------------------- 1 | menuconfig ATBM_MENUCONFIG 2 | tristate "Atbm Wireless Lan" 3 | default m 4 | 5 | if ATBM_MENUCONFIG 6 | config DRIVER_PATH 7 | string 8 | option env="DRIVER_PATH" 9 | source "$DRIVER_PATH/Kconfig" 10 | endif 11 | -------------------------------------------------------------------------------- /hal_apollo/bh_spi.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef ATBM_APOLLO_BH_USB_H 3 | #define ATBM_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//ATBM_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 | -------------------------------------------------------------------------------- /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 register_wext_common(struct ieee80211_local *local); 10 | 11 | extern struct iw_handler_def atbm_handlers_def; 12 | 13 | #endif /*__WEXT_CFG_H__*/ 14 | 15 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/atbm_p2p.h: -------------------------------------------------------------------------------- 1 | #ifndef _ATBM_P2P_H_ 2 | #define _ATBM_P2P_H_ 3 | #ifdef CONFIG_ATBM_SUPPORT_P2P 4 | int TxRxPublicActionFrame(u8 *pframe ,u32 len,int bTx); 5 | 6 | #ifdef ATBM_P2P_CHANGE 7 | void atbm_parase_p2p_scan_resp(struct atbm_vif *priv,struct sk_buff *skb); 8 | bool atbm_parase_p2p_action_frame(struct atbm_vif *priv,struct sk_buff *skb,bool tx); 9 | bool atbm_parase_p2p_mgmt_frame(struct atbm_vif *priv,struct sk_buff *skb,bool tx); 10 | #endif 11 | #endif 12 | #endif //_ATBM_P2P_H_ 13 | 14 | -------------------------------------------------------------------------------- /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_ATBM_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/module_fs.h: -------------------------------------------------------------------------------- 1 | #ifndef __MODULE_FS_H__ 2 | #define __MODULE_FS_H__ 3 | #include 4 | #include "mac80211/ieee80211_i.h" 5 | #ifdef CONFIG_ATBM_MOULE_FS 6 | extern int atbm_module_attribute_init(void); 7 | extern void atbm_module_attribute_exit(void); 8 | struct atbm_module_scan_node{ 9 | struct ieee80211_internal_scan_sta sta; 10 | struct hlist_node hnode; 11 | }; 12 | #else 13 | #define atbm_module_attribute_init() 14 | #define atbm_module_attribute_exit() 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/debugfs.h: -------------------------------------------------------------------------------- 1 | #ifndef __MAC80211_DEBUGFS_H 2 | #define __MAC80211_DEBUGFS_H 3 | 4 | #ifdef CONFIG_MAC80211_ATBM_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/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 | -------------------------------------------------------------------------------- /hal_apollo/bh_usb.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef ATBM_APOLLO_BH_USB_H 3 | #define ATBM_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//ATBM_APOLLO_BH_USB_H 22 | -------------------------------------------------------------------------------- /atbm_kconf/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS=-Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer 2 | 3 | LXDIALOG := lxdialog/checklist.o lxdialog/inputbox.o lxdialog/menubox.o lxdialog/textbox.o lxdialog/util.o lxdialog/yesno.o 4 | 5 | conf: conf.o zconf.tab.o 6 | mconf_CFLAGS := $(shell ./lxdialog/check-lxdialog.sh -ccflags) -DLOCALE 7 | mconf_LDFLAGS := $(shell ./lxdialog/check-lxdialog.sh -ldflags $(CC)) 8 | mconf: CFLAGS += $(mconf_CFLAGS) 9 | 10 | mconf: mconf.o zconf.tab.o $(LXDIALOG) 11 | $(CC) -o mconf $^ $(mconf_LDFLAGS) 12 | 13 | .PHONY: clean 14 | clean: 15 | @rm -f mconf conf *.o lxdialog/*.o 16 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | AltoBeam 60xx wifi driver 2 | 3 | 1. Setup path to kernel source and toolchan. Select ATBM601x, ATBM602x or ATBM603x and platform. Run make 4 | 5 | 2. Install driver 6 | (1) copy atbm603x_wifi.ko from output dir to board 7 | (2) insmod atbm603x_wifi.ko 8 | 9 | 3. STA mode: 10 | (1) insmod atbm603x_wifi.ko 11 | (2) ifconfig wlan0 up 12 | (3) ./wpa_supplicant -Dnl80211 -iwlan0 -c ./wpa_supplicant.conf -B 13 | (4) udhcpc -i wlan0 14 | 15 | 4. AP mode (not tested): 16 | (1) insmod atbm603x_wifi.ko fw=/PATH/fw.bin 17 | (2) ifconfig wlan0 193.169.4.10 up 18 | (3) ./hostapd ./hostapd.conf -B 19 | (4) udhcpd ./udhcpd.conf 20 | -------------------------------------------------------------------------------- /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/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 atbm_config_dpll(struct atbm_common *hw_priv,char* value,int prjType,int dpllClock); 7 | int atbm_config_dcxo(struct atbm_common *hw_priv,char *value,int prjType,int dcxoType,int dpllClock); 8 | int atbm_wait_wlan_rdy(struct atbm_common *hw_priv); 9 | int atbm_system_done(struct atbm_common *hw_priv); 10 | int atbm_config_jtag_mode(struct atbm_common *hw_priv); 11 | void atbm_set_config_to_smu_apolloC(struct atbm_common *hw_priv,int dpllClock); 12 | void atbm_set_config_to_smu_apolloB(struct atbm_common *hw_priv,int dpllClock); 13 | -------------------------------------------------------------------------------- /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 ATBM_IEEE80211_BAND_5GHZ IEEE80211_BAND_5GHZ 7 | #define ATBM_IEEE80211_BAND_2GHZ IEEE80211_BAND_2GHZ 8 | #define ATBM_IEEE80211_NUM_BANDS IEEE80211_NUM_BANDS 9 | #define atbm_ieee80211_band ieee80211_band 10 | #else 11 | 12 | #define ATBM_IEEE80211_BAND_5GHZ NL80211_BAND_5GHZ 13 | #define ATBM_IEEE80211_BAND_2GHZ NL80211_BAND_2GHZ 14 | #define ATBM_IEEE80211_NUM_BANDS NUM_NL80211_BANDS 15 | #define atbm_ieee80211_band nl80211_band 16 | #endif //(LINUX_VERSION_CODE < KERNEL_VERSION(4,9,0)) 17 | #endif/* LINUX_4_9_COMPAT_H */ -------------------------------------------------------------------------------- /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 | #ifdef CONFIG_ATBM_USE_SW_ENC 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 | #endif 24 | #endif /* MICHAEL_H */ 25 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/wapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Software WAPI encryption implementation 3 | * Copyright (c) 2011, altobeam 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 | #ifdef CONFIG_ATBM_USE_SW_ENC 14 | 15 | #include 16 | #include 17 | #include "ieee80211_i.h" 18 | #include "key.h" 19 | 20 | #ifndef ETH_P_WAPI 21 | #define ETH_P_WAPI 0x88B4 22 | #endif 23 | 24 | 25 | ieee80211_rx_result 26 | ieee80211_crypto_wapi_decrypt(struct ieee80211_rx_data *rx); 27 | #endif 28 | #endif /* WAPI_H */ 29 | -------------------------------------------------------------------------------- /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_ATBM_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/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 | #ifdef CONFIG_ATBM_USE_SW_ENC 12 | 13 | #include 14 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 10, 60)) 15 | #include 16 | #include 17 | #include 18 | #endif 19 | struct crypto_cipher * ieee80211_aes_cmac_key_setup(const u8 key[]); 20 | void ieee80211_aes_cmac(struct crypto_cipher *tfm, const u8 *aad, 21 | const u8 *data, size_t data_len, u8 *mic); 22 | void ieee80211_aes_cmac_key_free(struct crypto_cipher *tfm); 23 | #endif 24 | #endif /* AES_CMAC_H */ 25 | -------------------------------------------------------------------------------- /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 **pskb); 13 | struct ieee80211_sub_if_data *ieee80211_brigde_sdata_check(struct ieee80211_local *local,struct sk_buff **pskb,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 | -------------------------------------------------------------------------------- /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/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 | #ifdef CONFIG_ATBM_USE_SW_ENC 13 | #include 14 | 15 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 10, 60)) 16 | #include 17 | #include 18 | #include 19 | #endif 20 | 21 | struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[]); 22 | void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch, 23 | u8 *data, size_t data_len, 24 | u8 *cdata, u8 *mic); 25 | int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch, 26 | u8 *cdata, size_t data_len, 27 | u8 *mic, u8 *data); 28 | void ieee80211_aes_key_free(struct crypto_cipher *tfm); 29 | #endif 30 | #endif /* AES_CCM_H */ 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 OpenIPC 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /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/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 | #if 0 23 | //#ifndef ATBM_PRIVATE_IE 24 | cfg80211_michael_mic_failure(sdata->dev, hdr->addr2, 25 | (hdr->addr1[0] & 0x01) ? 26 | NL80211_KEYTYPE_GROUP : 27 | NL80211_KEYTYPE_PAIRWISE, 28 | keyidx, tsc, gfp); 29 | #else 30 | #pragma message "IPC not support mic failure" 31 | atbm_printk_err( "IPC not support mic failure\n"); 32 | #endif 33 | } 34 | -------------------------------------------------------------------------------- /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 | #ifdef CONFIG_ATBM_USE_SW_ENC 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 | #endif 36 | #endif /* WPA_H */ 37 | -------------------------------------------------------------------------------- /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 atbm_genl_info 22 | struct atbm_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 atbm_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_ATBM_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 | -------------------------------------------------------------------------------- /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/ht.h: -------------------------------------------------------------------------------- 1 | /* 2 | * HT-related code for altobeam APOLLO driver 3 | * * 4 | * Copyright (c) 2016, altobeam 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 ATBM_APOLLO_HT_H_INCLUDED 17 | #define ATBM_APOLLO_HT_H_INCLUDED 18 | 19 | #include 20 | 21 | struct atbm_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 atbm_is_ht(const struct atbm_ht_info *ht_info) 28 | { 29 | return ht_info->channel_type != NL80211_CHAN_NO_HT; 30 | } 31 | 32 | static inline int atbm_ht_greenfield(const struct atbm_ht_info *ht_info) 33 | { 34 | return atbm_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 atbm_ht_ampdu_density(const struct atbm_ht_info *ht_info) 41 | { 42 | if (!atbm_is_ht(ht_info)) 43 | return 0; 44 | return ht_info->ht_cap.ampdu_density; 45 | } 46 | 47 | #endif /* ATBM_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/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/mac80211/ieee80211_atbm_mem.h: -------------------------------------------------------------------------------- 1 | #ifndef _IEEE80211_ATBM_MEM_H_ 2 | #define _IEEE80211_ATBM_MEM_H_ 3 | #if defined (ATBM_ALLOC_MEM_DEBUG) 4 | extern void *ieee80211_atbm_kzalloc(size_t s, gfp_t gfp,const char *func); 5 | extern void *ieee80211_atbm_kmalloc(size_t s, gfp_t gfp,const char *func); 6 | extern void *ieee80211_atbm_kcalloc(size_t n, size_t size, gfp_t gfp,const char *func); 7 | extern void *ieee80211_atbm_krealloc(void *p, size_t new_size, gfp_t gfp,const char *func); 8 | extern void ieee80211_atbm_kfree(void *p); 9 | extern void ieee80211_atbm_mem_exit(void); 10 | extern void ieee80211_atbm_mem_int(void); 11 | 12 | 13 | #define atbm_kzalloc(_s,_gfp) ieee80211_atbm_kzalloc(_s,_gfp,__func__) 14 | #define atbm_kmalloc(_s,_gfp) ieee80211_atbm_kmalloc(_s,_gfp,__func__) 15 | #define atbm_kcalloc(_n,_size,_gfp) ieee80211_atbm_kcalloc(_n,_size,_gfp,__func__) 16 | #define atbm_krealloc(_p,_new_size,_gfp) ieee80211_atbm_krealloc(_p,_new_size,_gfp,__func__) 17 | #define atbm_kfree(_p) ieee80211_atbm_kfree(_p) 18 | #else 19 | #define atbm_kzalloc(_s,_gfp) kzalloc(_s,_gfp) 20 | #define atbm_kmalloc(_s,_gfp) kmalloc(_s,_gfp) 21 | #define atbm_kcalloc(_n,_size,_gfp) kcalloc(_n,_size,_gfp) 22 | #define atbm_krealloc(_p,_new_size,_gfp) krealloc(_p,_new_size,_gfp) 23 | #define atbm_kfree(_p) kfree(_p) 24 | #define ieee80211_atbm_mem_exit() 25 | #define ieee80211_atbm_mem_int() 26 | #endif 27 | 28 | #endif //_ATBM_P2P_H_ 29 | 30 | -------------------------------------------------------------------------------- /hal_apollo/fwio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Firmware API for mac80211 altobeam APOLLO drivers 3 | * * 4 | * Copyright (c) 2016, altobeam 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 ((ATBM_WIFI_PLATFORM == 13/*PLATFORM_AMLOGIC_S805*/) || (ATBM_WIFI_PLATFORM == 8)) 26 | #define FIRMWARE_DEFAULT_PATH "../wifi/atbm/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 ATBM_APOLLO_REV_1601 (1601) 36 | 37 | struct atbm_common; 38 | 39 | 40 | int atbm_get_hw_type(u32 config_reg_val, int *major_revision); 41 | 42 | int atbm_load_firmware(struct atbm_common *hw_priv); 43 | void atbm_release_firmware(void); 44 | int atbm_init_firmware(void); 45 | #ifdef CONFIG_PM_SLEEP 46 | int atbm_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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | #ifdef CONFIG_ATBM_USE_SW_ENC 12 | #include 13 | #include 14 | #include "key.h" 15 | 16 | u8 *ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key *key); 17 | 18 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(5, 4, 0)) 19 | int ieee80211_tkip_encrypt_data(struct crypto_cipher *tfm, 20 | struct ieee80211_key *key, 21 | struct sk_buff *skb, 22 | u8 *payload, size_t payload_len); 23 | 24 | enum { 25 | TKIP_DECRYPT_OK = 0, 26 | TKIP_DECRYPT_NO_EXT_IV = -1, 27 | TKIP_DECRYPT_INVALID_KEYIDX = -2, 28 | TKIP_DECRYPT_REPLAY = -3, 29 | }; 30 | int ieee80211_tkip_decrypt_data(struct crypto_cipher *tfm, 31 | struct ieee80211_key *key, 32 | u8 *payload, size_t payload_len, u8 *ta, 33 | u8 *ra, int only_iv, int queue, 34 | u32 *out_iv32, u16 *out_iv16); 35 | #else 36 | int ieee80211_tkip_encrypt_data(struct arc4_ctx *ctx, 37 | struct ieee80211_key *key, 38 | struct sk_buff *skb, 39 | u8 *payload, size_t payload_len); 40 | 41 | enum { 42 | TKIP_DECRYPT_OK = 0, 43 | TKIP_DECRYPT_NO_EXT_IV = -1, 44 | TKIP_DECRYPT_INVALID_KEYIDX = -2, 45 | TKIP_DECRYPT_REPLAY = -3, 46 | }; 47 | int ieee80211_tkip_decrypt_data(struct arc4_ctx *ctx, 48 | struct ieee80211_key *key, 49 | u8 *payload, size_t payload_len, u8 *ta, 50 | u8 *ra, int only_iv, int queue, 51 | u32 *out_iv32, u16 *out_iv16); 52 | #endif 53 | #endif /* CONFIG_ATBM_USE_SW_ENC */ 54 | #endif /* TKIP_H */ 55 | -------------------------------------------------------------------------------- /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 ATBM_APOLLO_HWIO_USB_H_INCLUDED 7 | #define ATBM_APOLLO_HWIO_USB_H_INCLUDED 8 | #include "apollo_plat.h" 9 | 10 | #define ALTOBEAM_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 atbm_direct_write_reg_32(struct atbm_common *hw_priv, u32 addr, u32 val); 28 | int atbm_direct_read_reg_32(struct atbm_common *hw_priv, u32 addr, u32 *val); 29 | int atbm_fw_write(struct atbm_common *priv, u32 addr, const void *buf, 30 | u32 buf_len); 31 | int atbm_ep0_read(struct atbm_common *hw_priv, u32 addr, 32 | void *buf, u32 buf_len); 33 | int atbm_ep0_write(struct atbm_common *hw_priv, u32 addr, 34 | const void *buf, u32 buf_len); 35 | #ifdef USB_CMD_UES_EP0 36 | int atbm_ep0_write_cmd(struct atbm_common *hw_priv, struct wsm_hdr_tx * wsm_h); 37 | #endif 38 | /* 39 | *lock for probe dan disconnect 40 | */ 41 | extern void atbm_usb_module_muxlock(void); 42 | extern void atbm_usb_module_muxunlock(void); 43 | 44 | #define atbm_module_muxlock() atbm_usb_module_muxlock() 45 | #define atbm_module_muxunlock() atbm_usb_module_muxunlock() 46 | 47 | #endif //ATBM_APOLLO_HWIO_USB_H_INCLUDED 48 | -------------------------------------------------------------------------------- /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/hwio_spi.h: -------------------------------------------------------------------------------- 1 | 2 | #define HW_DOWN_FW 3 | #define DOWNLOAD_BLOCK_SIZE (50) 4 | 5 | 6 | #ifndef ATBM_APOLLO_HWIO_SPI_H_INCLUDED 7 | #define ATBM_APOLLO_HWIO_SPI_H_INCLUDED 8 | #include "apollo_plat.h" 9 | 10 | #define ALTOBEAM_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 atbm_read_data(struct atbm_common *priv, void *buf, u32 buf_len); 39 | int atbm_write_data(struct atbm_common *priv, const void *buf, u32 buf_len); 40 | int atbm_read_status(struct atbm_common *priv, u32 *status); 41 | int atbm_read_status_ready(struct atbm_common *priv, u32 *ready); 42 | int atbm_update_status_channelflag(struct atbm_common *priv); 43 | int atbm_read_status_channelflag(struct atbm_common *priv, u32 *channelflag); 44 | int atbm_direct_write_reg_32(struct atbm_common *hw_priv, u32 addr, u32 val); 45 | int atbm_direct_read_reg_32(struct atbm_common *hw_priv, u32 addr, u32 *val); 46 | 47 | int atbm_fw_write(struct atbm_common *priv, u32 addr, const void *buf, 48 | u32 buf_len); 49 | #endif //ATBM_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 altobeam APOLLO mac80211 drivers 3 | * * 4 | * Copyright (c) 2016, altobeam 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 atbm_common; 29 | /* private */ struct atbm_suspend_state; 30 | struct atbm_pm_stayawake_lock{ 31 | struct atbm_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 atbm_pm_state { 39 | struct platform_driver pm_driver; 40 | #ifdef CONFIG_WAKELOCK 41 | struct wake_lock wakelock; 42 | #else 43 | struct atbm_timer_list stay_awake; 44 | #endif 45 | struct platform_device *pm_dev; 46 | spinlock_t lock; 47 | struct atbm_pm_stayawake_lock stayawake_lock; 48 | int b_init; 49 | }; 50 | 51 | struct atbm_pm_state_vif { 52 | struct atbm_suspend_state *suspend_state; 53 | }; 54 | 55 | int atbm_pm_init(struct atbm_pm_state *pm, 56 | struct atbm_common *priv); 57 | void atbm_pm_deinit(struct atbm_pm_state *pm); 58 | void atbm_pm_stay_awake(struct atbm_pm_state *pm, 59 | unsigned long tmo); 60 | int atbm_wow_suspend(struct ieee80211_hw *hw, 61 | struct cfg80211_wowlan *wowlan); 62 | int atbm_wow_resume(struct ieee80211_hw *hw); 63 | void atbm_pm_stay_awake_lock(struct atbm_pm_state *pm); 64 | void atbm_pm_stay_awake_unlock(struct atbm_pm_state *pm); 65 | #endif 66 | #endif 67 | -------------------------------------------------------------------------------- /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 | #ifdef CONFIG_ATBM_USE_SW_ENC 14 | #include 15 | #include 16 | #include "ieee80211_i.h" 17 | #include "key.h" 18 | 19 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(5, 4, 0)) 20 | int ieee80211_wep_init(struct ieee80211_local *local); 21 | void ieee80211_wep_free(struct ieee80211_local *local); 22 | bool ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key); 23 | int ieee80211_wep_encrypt_data(struct crypto_cipher *tfm, u8 *rc4key, 24 | size_t klen, u8 *data, size_t data_len); 25 | int ieee80211_wep_encrypt(struct ieee80211_local *local, 26 | struct sk_buff *skb, 27 | const u8 *key, int keylen, int keyidx); 28 | int ieee80211_wep_decrypt_data(struct crypto_cipher *tfm, u8 *rc4key, 29 | size_t klen, u8 *data, size_t data_len); 30 | #else 31 | void ieee80211_wep_init(struct ieee80211_local *local); 32 | bool ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key); 33 | int ieee80211_wep_encrypt_data(struct arc4_ctx *ctx, u8 *rc4key, 34 | size_t klen, u8 *data, size_t data_len); 35 | int ieee80211_wep_encrypt(struct ieee80211_local *local, 36 | struct sk_buff *skb, 37 | const u8 *key, int keylen, int keyidx); 38 | int ieee80211_wep_decrypt_data(struct arc4_ctx *ctx, u8 *rc4key, 39 | size_t klen, u8 *data, size_t data_len); 40 | #endif 41 | //bool ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key); 42 | 43 | ieee80211_rx_result 44 | ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx); 45 | ieee80211_tx_result 46 | ieee80211_crypto_wep_encrypt(struct ieee80211_tx_data *tx); 47 | #endif 48 | #endif /* WEP_H */ 49 | -------------------------------------------------------------------------------- /hal_apollo/mac80211/wapi.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Software WAPI encryption implementation 3 | * Copyright (c) 2011, altobeam 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 | atbm_skb_trim(skb, skb->len - WAPI_ICV_LEN); 50 | 51 | /* Remove IV */ 52 | memmove(skb->data + WAPI_IV_LEN, skb->data, hdrlen); 53 | atbm_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/mac80211/atbm_common.h: -------------------------------------------------------------------------------- 1 | #ifndef __ATBM_COMMON_H__ 2 | #define __ATBM_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 atbm_private_data{ 35 | int set_flag; 36 | int data_len; 37 | char user_data[USER_DATE_LEN+1]; 38 | }ATBM_PRIVATE_DATA; 39 | 40 | 41 | #define AP_SCAN_NUM_MAX 32 //ap number per channel 42 | #ifdef CONFIG_ATBM_5G_PRETEND_2G 43 | #define CHANNEL_NUM 18 //channel 44 | #else 45 | #define CHANNEL_NUM 14 //channel 46 | 47 | #endif 48 | 49 | typedef struct _best_channel_info_ 50 | { 51 | u8 ssid[32]; 52 | u8 mac_addr[ETH_ALEN]; 53 | u8 rssi; 54 | u8 flag; 55 | u8 enc_type; 56 | u8 enc_type_name; 57 | }BEST_CHANNEL_INFO; 58 | typedef struct _best_ch_busy_ratio_ 59 | { 60 | unsigned int best_ch_busy_ratio[CHANNEL_NUM]; 61 | unsigned int total_cnt; 62 | }BEST_CHANNEL_BUSY_RATIO; 63 | 64 | typedef struct _best_ch_scan_result_ 65 | { 66 | unsigned int channel_ap_num[CHANNEL_NUM]; 67 | unsigned int busy_ratio[CHANNEL_NUM]; 68 | unsigned int weight[CHANNEL_NUM]; 69 | unsigned char suggest_ch; 70 | }Best_Channel_Scan_Result; 71 | 72 | typedef struct _special_ch_freq_{ 73 | //unsigned int special_ch; 74 | unsigned int special_freq;//2380MHz or 2504MHz 75 | unsigned int flag; 76 | }SPECIAL_CH_FREQ; 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /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_ATBM_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 atbm_smartconfig_start(struct atbm_common *hw_priv,int enable); 47 | int atbm_smartconfig_stop(struct atbm_common *hw_priv); 48 | int smartconfig_start(struct atbm_common *hw_priv,struct smartconfig_config * st_cfg); 49 | int smartconfig_stop(struct atbm_common *hw_priv); 50 | int smartconfig_status(struct atbm_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 atbm_smart_scan_work(struct atbm_work_struct *work); 59 | void atbm_smart_setchan_work(struct atbm_work_struct *work); 60 | void atbm_smart_stop_work(struct atbm_work_struct *work); 61 | void atbm_smartconfig_expire_timer(unsigned long arg); 62 | 63 | 64 | 65 | 66 | 67 | #endif /*__SMART_CONFIG_H__*/ 68 | -------------------------------------------------------------------------------- /hal_apollo/hwio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Low-level API for mac80211 altobeam apollo wifi drivers 3 | * 4 | * Copyright (c) 2016, altobeam 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 ATBM_APOLLO_HWIO_H_INCLUDED 21 | #define ATBM_APOLLO_HWIO_H_INCLUDED 22 | 23 | 24 | /* extern */ struct atbm_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 atbm_fw_write(struct atbm_common *priv, u32 addr, const void *buf,u32 buf_len); 58 | int atbm_before_load_firmware(struct atbm_common *hw_priv); 59 | int atbm_after_load_firmware(struct atbm_common *hw_priv); 60 | void atbm_firmware_init_check(struct atbm_common *hw_priv); 61 | int atbm_reset_lmc_cpu(struct atbm_common *hw_priv); 62 | int atbm_reset_chip(struct atbm_common *hw_priv); 63 | 64 | #ifndef atbm_module_muxlock 65 | #define atbm_module_muxlock() 66 | #endif 67 | 68 | #ifndef atbm_module_muxunlock 69 | #define atbm_module_muxunlock() 70 | #endif 71 | #endif //ATBM_APOLLO_HWIO_H_INCLUDED 72 | -------------------------------------------------------------------------------- /atbm_kconf/lxdialog/check-lxdialog.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Check ncurses compatibility 3 | 4 | # What library to link 5 | ldflags() 6 | { 7 | for ext in so a dll.a dylib ; do 8 | for lib in ncursesw ncurses curses ; do 9 | $cc -print-file-name=lib${lib}.${ext} | grep -q / 10 | if [ $? -eq 0 ]; then 11 | echo "-l${lib}" 12 | exit 13 | fi 14 | done 15 | done 16 | exit 1 17 | } 18 | 19 | # Where is ncurses.h? 20 | ccflags() 21 | { 22 | if [ -f /usr/include/ncursesw/curses.h ]; then 23 | echo '-I/usr/include/ncursesw -DCURSES_LOC=""' 24 | echo ' -DNCURSES_WIDECHAR=1' 25 | elif [ -f /usr/include/ncurses/ncurses.h ]; then 26 | echo '-I/usr/include/ncurses -DCURSES_LOC=""' 27 | elif [ -f /usr/include/ncurses/curses.h ]; then 28 | echo '-I/usr/include/ncurses -DCURSES_LOC=""' 29 | elif [ -f /usr/include/ncurses.h ]; then 30 | echo '-DCURSES_LOC=""' 31 | else 32 | echo '-DCURSES_LOC=""' 33 | fi 34 | } 35 | 36 | # Temp file, try to clean up after us 37 | tmp=.lxdialog.tmp 38 | trap "rm -f $tmp" 0 1 2 3 15 39 | 40 | # Check if we can link to ncurses 41 | check() { 42 | $cc -x c - -o $tmp 2>/dev/null <<'EOF' 43 | #include CURSES_LOC 44 | main() {} 45 | EOF 46 | if [ $? != 0 ]; then 47 | echo " *** Unable to find the ncurses libraries or the" 1>&2 48 | echo " *** required header files." 1>&2 49 | echo " *** 'make menuconfig' requires the ncurses libraries." 1>&2 50 | echo " *** " 1>&2 51 | echo " *** Install ncurses (ncurses-devel) and try again." 1>&2 52 | echo " *** " 1>&2 53 | exit 1 54 | fi 55 | } 56 | 57 | usage() { 58 | printf "Usage: $0 [-check compiler options|-ccflags|-ldflags compiler options]\n" 59 | } 60 | 61 | if [ $# -eq 0 ]; then 62 | usage 63 | exit 1 64 | fi 65 | 66 | cc="" 67 | case "$1" in 68 | "-check") 69 | shift 70 | cc="$@" 71 | check 72 | ;; 73 | "-ccflags") 74 | ccflags 75 | ;; 76 | "-ldflags") 77 | shift 78 | cc="$@" 79 | ldflags 80 | ;; 81 | "*") 82 | usage 83 | exit 1 84 | ;; 85 | esac 86 | -------------------------------------------------------------------------------- /.config: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated file; DO NOT EDIT. 3 | # Atbm Wifi Driver Configuration 4 | # 5 | CONFIG_ATBM_MENUCONFIG=y 6 | CONFIG_ATBM_WIRELESS=y 7 | CONFIG_ATBM_WEXT=y 8 | # CONFIG_ATBM601x is not set 9 | # CONFIG_ATBM602x is not set 10 | CONFIG_ATBM603x=y 11 | # CONFIG_ATBM6041 is not set 12 | # CONFIG_ATBM_USB_BUS is not set 13 | CONFIG_ATBM_SDIO_BUS=y 14 | # CONFIG_ATBM_SPI_BUS is not set 15 | # CONFIG_ATBM_USE_FIRMWARE_BIN is not set 16 | CONFIG_ATBM_USE_FIRMWARE_H=y 17 | 18 | # 19 | # Driver Extern Function Select 20 | # 21 | CONFIG_ATBM_SUPPORT_BRIDGE=y 22 | CONFIG_ATBM_FUNC_NOTXCONFIRM=y 23 | # CONFIG_ATBM_FUNC_EARLYSUSPEND is not set 24 | CONFIG_ATBM_FUNC_MONITOR=y 25 | # CONFIG_ATBM_FUNC_MONITOR_HDR_PRISM is not set 26 | # CONFIG_ATBM_FUNC_SKB_DEBUG is not set 27 | # CONFIG_ATBM_FUNC_MEM_DEBUG is not set 28 | # CONFIG_ATBM_FUNC_CHANNEL_5G_PRETEND_2G is not set 29 | # CONFIG_ATBM_WITHBAND_ONLY_HT20 is not set 30 | # CONFIG_ATBM_FUNC_HW_CHSUM is not set 31 | CONFIG_ATBM_FUNC_P2P_ENABLE=y 32 | CONFIG_ATBM_FUNC_SW_ENC=y 33 | CONFIG_ATBM_FUNC_DEV_CTRL_API=y 34 | CONFIG_ATBM_FUNC_MODULE_FS=y 35 | # CONFIG_ATBM_FUNC_SMARTCONFIG is not set 36 | CONFIG_ATBM_FUNC_PRIVE_IE=y 37 | # CONFIG_ATBM_FUNC_SAE_AUTHEN is not set 38 | 39 | # 40 | # Driver debug features 41 | # 42 | # CONFIG_ATBM_APOLLO_DEBUGFS is not set 43 | # CONFIG_ATBM_APOLLO_DEBUG_ON_BOOT is not set 44 | # CONFIG_ATBM_APOLLO_BH_DEBUG is not set 45 | # CONFIG_ATBM_APOLLO_WSM_DEBUG is not set 46 | # CONFIG_ATBM_APOLLO_WSM_DUMPS is not set 47 | # CONFIG_ATBM_APOLLO_WSM_DUMPS_SHORT is not set 48 | # CONFIG_ATBM_APOLLO_TXRX_DEBUG is not set 49 | # CONFIG_ATBM_APOLLO_TX_POLICY_DEBUG is not set 50 | # CONFIG_ATBM_APOLLO_STA_DEBUG is not set 51 | # CONFIG_ATBM_APOLLO_DUMP_ON_ERROR is not set 52 | CONFIG_ATBM_SDIO_MMCx="mmc1" 53 | # CONFIG_ATBM_APOLLO_USE_GPIO_IRQ is not set 54 | CONFIG_ATBM_APOLLO_WAPI_SUPPORT=y 55 | CONFIG_ATBM_APOLLO_SUPPORT_SGI=y 56 | CONFIG_ATBM_WIFIIF1_NAME="wlan%d" 57 | # CONFIG_NEED_P2P0_INTERFACE is not set 58 | CONFIG_ATBM_MODULE_PM_STAYAWK="pm_stayawake" 59 | CONFIG_ATBM_MODULE_DRIVER_NAME="atbm_wlan" 60 | CONFIG_ATBM_PLATFORM_DEVICE_NAME="atbm_dev_wifi" 61 | CONFIG_ATBM_SDIO_VID=0x007a 62 | CONFIG_ATBM_SDIO_PID=0x6011 63 | CONFIG_ATBM_MODULE_NAME="atbm603x_wifi_sdio" 64 | CONFIG_MAC80211_ATBM_RC_DEFAULT="" 65 | -------------------------------------------------------------------------------- /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, altobeam 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 ATBM_APOLLO_PLAT_H_INCLUDED 13 | #define ATBM_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 ATBM_WIFI_PLATFORM 35 | #define ATBM_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 | #define ARES_6012B 12 52 | 53 | 54 | #ifndef PROJ_TYPE 55 | #define PROJ_TYPE ATHENA_B 56 | #endif 57 | 58 | #define CRYSTAL_MODE 0 59 | #define EXTERNAL_MODE 1 60 | #ifndef DCXO_TYPE 61 | #define DCXO_TYPE CRYSTAL_MODE 62 | #endif 63 | 64 | #define DPLL_CLOCK_26M 0 65 | #define DPLL_CLOCK_40M 1 66 | #define DPLL_CLOCK_24M 2 67 | 68 | #ifndef DPLL_CLOCK 69 | #define DPLL_CLOCK DPLL_CLOCK_40M 70 | #endif 71 | 72 | #include 73 | 74 | struct atbm_platform_data { 75 | const char *mmc_id; 76 | const int irq_gpio; 77 | const int power_gpio; 78 | const int reset_gpio; 79 | int (*power_ctrl)(const struct atbm_platform_data *pdata, 80 | bool enable); 81 | int (*clk_ctrl)(const struct atbm_platform_data *pdata, 82 | bool enable); 83 | int (*insert_ctrl)(const struct atbm_platform_data *pdata, 84 | bool enable); 85 | }; 86 | 87 | /* Declaration only. Should be implemented in arch/xxx/mach-yyy */ 88 | struct atbm_platform_data *atbm_get_platform_data(void); 89 | 90 | 91 | 92 | #endif /* ATBM_APOLLO_PLAT_H_INCLUDED */ 93 | -------------------------------------------------------------------------------- /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_ATBM_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_ATBM_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_ATBM_LEDS 70 | if (local->tpt_led_trigger && ieee80211_is_data(fc)) 71 | local->tpt_led_trigger->rx_bytes += bytes; 72 | #endif 73 | } 74 | -------------------------------------------------------------------------------- /hal_apollo/ap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * mac80211 STA and AP API for mac80211 altobeam APOLLO drivers 3 | * * 4 | * Copyright (c) 2016, altobeam 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 ATBM_APOLLO_NOA_NOTIFICATION_DELAY 10 20 | 21 | int atbm_set_tim(struct ieee80211_hw *dev, struct ieee80211_sta *sta, 22 | bool set); 23 | int atbm_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 24 | struct ieee80211_sta *sta); 25 | int atbm_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 26 | struct ieee80211_sta *sta); 27 | void atbm_sta_notify(struct ieee80211_hw *dev, struct ieee80211_vif *vif, 28 | enum sta_notify_cmd notify_cmd, 29 | struct ieee80211_sta *sta); 30 | void atbm_bss_info_changed(struct ieee80211_hw *dev, 31 | struct ieee80211_vif *vif, 32 | struct ieee80211_bss_conf *info, 33 | u32 changed); 34 | int atbm_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 atbm_suspend_resume(struct atbm_vif *priv, 41 | struct wsm_suspend_resume *arg); 42 | void atbm_set_tim_work(struct atbm_work_struct *work); 43 | //void atbm_set_cts_work(struct atbm_work_struct *work); 44 | void atbm_multicast_start_work(struct atbm_work_struct *work); 45 | void atbm_multicast_stop_work(struct atbm_work_struct *work); 46 | void atbm_mcast_timeout(unsigned long arg); 47 | int atbm_find_link_id(struct atbm_vif *priv, const u8 *mac); 48 | int atbm_alloc_link_id(struct atbm_vif *priv, const u8 *mac); 49 | void atbm_link_id_work(struct atbm_work_struct *work); 50 | void atbm_link_id_gc_work(struct atbm_work_struct *work); 51 | #ifdef CONFIG_ATBM_SUPPORT_P2P 52 | void atbm_notify_noa(struct atbm_vif *priv, int delay); 53 | #endif 54 | int ABwifi_unmap_link(struct atbm_vif *priv, int link_id); 55 | void atbm_ht_info_update_work(struct atbm_work_struct *work); 56 | int atbm_start_monitor_mode(struct atbm_vif *priv, 57 | struct ieee80211_channel *chan); 58 | int atbm_stop_monitor_mode(struct atbm_vif *priv); 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | atbm_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 | atbm_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 | atbm_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 | atbm_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 | atbm_printk_always("ELOG_Show end\n"); 99 | } 100 | #endif //if DBG_EVENT_LOG 101 | -------------------------------------------------------------------------------- /atbm_kconf/lkc_proto.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* confdata.c */ 4 | P(conf_parse,void,(const char *name)); 5 | P(conf_read,int,(const char *name)); 6 | P(conf_read_simple,int,(const char *name, int)); 7 | P(conf_write_defconfig,int,(const char *name)); 8 | P(conf_write,int,(const char *name)); 9 | P(conf_write_autoconf,int,(void)); 10 | P(conf_get_changed,bool,(void)); 11 | P(conf_set_changed_callback, void,(void (*fn)(void))); 12 | P(conf_set_message_callback, void,(void (*fn)(const char *fmt, va_list ap))); 13 | 14 | /* menu.c */ 15 | P(rootmenu,struct menu,); 16 | 17 | P(menu_is_visible, bool, (struct menu *menu)); 18 | P(menu_has_prompt, bool, (struct menu *menu)); 19 | P(menu_get_prompt,const char *,(struct menu *menu)); 20 | P(menu_get_root_menu,struct menu *,(struct menu *menu)); 21 | P(menu_get_parent_menu,struct menu *,(struct menu *menu)); 22 | P(menu_has_help,bool,(struct menu *menu)); 23 | P(menu_get_help,const char *,(struct menu *menu)); 24 | P(get_symbol_str, void, (struct gstr *r, struct symbol *sym, struct list_head 25 | *head)); 26 | P(get_relations_str, struct gstr, (struct symbol **sym_arr, struct list_head 27 | *head)); 28 | P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help)); 29 | 30 | /* symbol.c */ 31 | P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); 32 | 33 | P(sym_lookup,struct symbol *,(const char *name, int flags)); 34 | P(sym_find,struct symbol *,(const char *name)); 35 | P(sym_expand_string_value,const char *,(const char *in)); 36 | P(sym_escape_string_value, const char *,(const char *in)); 37 | P(sym_re_search,struct symbol **,(const char *pattern)); 38 | P(sym_type_name,const char *,(enum symbol_type type)); 39 | P(sym_calc_value,void,(struct symbol *sym)); 40 | P(sym_get_type,enum symbol_type,(struct symbol *sym)); 41 | P(sym_tristate_within_range,bool,(struct symbol *sym,tristate tri)); 42 | P(sym_set_tristate_value,bool,(struct symbol *sym,tristate tri)); 43 | P(sym_toggle_tristate_value,tristate,(struct symbol *sym)); 44 | P(sym_string_valid,bool,(struct symbol *sym, const char *newval)); 45 | P(sym_string_within_range,bool,(struct symbol *sym, const char *str)); 46 | P(sym_set_string_value,bool,(struct symbol *sym, const char *newval)); 47 | P(sym_is_changable,bool,(struct symbol *sym)); 48 | P(sym_get_choice_prop,struct property *,(struct symbol *sym)); 49 | P(sym_get_default_prop,struct property *,(struct symbol *sym)); 50 | P(sym_get_string_value,const char *,(struct symbol *sym)); 51 | 52 | P(prop_get_type_name,const char *,(enum prop_type type)); 53 | 54 | /* expr.c */ 55 | P(expr_compare_type,int,(enum expr_type t1, enum expr_type t2)); 56 | P(expr_print,void,(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken)); 57 | -------------------------------------------------------------------------------- /atbm_kconf/list.h: -------------------------------------------------------------------------------- 1 | #ifndef LIST_H 2 | #define LIST_H 3 | 4 | /* 5 | * Copied from include/linux/... 6 | */ 7 | 8 | #undef offsetof 9 | #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) 10 | 11 | /** 12 | * container_of - cast a member of a structure out to the containing structure 13 | * @ptr: the pointer to the member. 14 | * @type: the type of the container struct this is embedded in. 15 | * @member: the name of the member within the struct. 16 | * 17 | */ 18 | #define container_of(ptr, type, member) ({ \ 19 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ 20 | (type *)( (char *)__mptr - offsetof(type,member) );}) 21 | 22 | 23 | struct list_head { 24 | struct list_head *next, *prev; 25 | }; 26 | 27 | 28 | #define LIST_HEAD_INIT(name) { &(name), &(name) } 29 | 30 | #define LIST_HEAD(name) \ 31 | struct list_head name = LIST_HEAD_INIT(name) 32 | 33 | /** 34 | * list_entry - get the struct for this entry 35 | * @ptr: the &struct list_head pointer. 36 | * @type: the type of the struct this is embedded in. 37 | * @member: the name of the list_struct within the struct. 38 | */ 39 | #define list_entry(ptr, type, member) \ 40 | container_of(ptr, type, member) 41 | 42 | /** 43 | * list_for_each_entry - iterate over list of given type 44 | * @pos: the type * to use as a loop cursor. 45 | * @head: the head for your list. 46 | * @member: the name of the list_struct within the struct. 47 | */ 48 | #define list_for_each_entry(pos, head, member) \ 49 | for (pos = list_entry((head)->next, typeof(*pos), member); \ 50 | &pos->member != (head); \ 51 | pos = list_entry(pos->member.next, typeof(*pos), member)) 52 | 53 | /** 54 | * list_empty - tests whether a list is empty 55 | * @head: the list to test. 56 | */ 57 | static inline int list_empty(const struct list_head *head) 58 | { 59 | return head->next == head; 60 | } 61 | 62 | /* 63 | * Insert a new entry between two known consecutive entries. 64 | * 65 | * This is only for internal list manipulation where we know 66 | * the prev/next entries already! 67 | */ 68 | static inline void __list_add(struct list_head *_new, 69 | struct list_head *prev, 70 | struct list_head *next) 71 | { 72 | next->prev = _new; 73 | _new->next = next; 74 | _new->prev = prev; 75 | prev->next = _new; 76 | } 77 | 78 | /** 79 | * list_add_tail - add a new entry 80 | * @new: new entry to be added 81 | * @head: list head to add it before 82 | * 83 | * Insert a new entry before the specified head. 84 | * This is useful for implementing queues. 85 | */ 86 | static inline void list_add_tail(struct list_head *_new, struct list_head *head) 87 | { 88 | __list_add(_new, head->prev, head); 89 | } 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /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/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 | #ifdef CONFIG_ATBM_SPECTRUM_MGMT 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 atbm_ieee80211_mgmt *msr_report; 32 | 33 | skb = atbm_dev_alloc_skb(sizeof(*msr_report) + local->hw.extra_tx_headroom + 34 | sizeof(struct ieee80211_msrment_ie)); 35 | if (!skb) 36 | return; 37 | 38 | atbm_skb_reserve(skb, local->hw.extra_tx_headroom); 39 | msr_report = (struct atbm_ieee80211_mgmt *)atbm_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 | atbm_skb_put(skb, 1 + sizeof(msr_report->u.action.u.measurement)); 48 | msr_report->u.action.category = ATBM_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 = ATBM_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 atbm_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 | #endif 84 | -------------------------------------------------------------------------------- /hal_apollo/txrx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Datapath interface for altobeam APOLLO mac80211 drivers 3 | * * 4 | * Copyright (c) 2016, altobeam 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 ATBM_APOLLO_TXRX_H 17 | #define ATBM_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 atbm_txpriv; 27 | /* extern */ struct atbm_vif; 28 | #ifndef CONFIG_RATE_HW_CONTROL 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 | /* TX policy cache */ 54 | /* Intention of TX policy cache is an overcomplicated WSM API. 55 | * Device does not accept per-PDU tx retry sequence. 56 | * It uses "tx retry policy id" instead, so driver code has to sync 57 | * linux tx retry sequences with a retry policy table in the device. 58 | */ 59 | void tx_policy_init(struct atbm_common *hw_priv); 60 | void tx_policy_upload_work(struct atbm_work_struct *work); 61 | #endif 62 | /* ******************************************************************** */ 63 | /* TX implementation */ 64 | 65 | u32 atbm_rate_mask_to_wsm(struct atbm_common *hw_priv, 66 | u32 rates); 67 | void atbm_tx(struct ieee80211_hw *dev, struct sk_buff *skb); 68 | void atbm_skb_dtor(struct atbm_common *hw_priv, 69 | struct sk_buff *skb, 70 | const struct atbm_txpriv *txpriv); 71 | 72 | /* ******************************************************************** */ 73 | /* WSM callbacks */ 74 | 75 | void atbm_tx_confirm_cb(struct atbm_common *hw_priv, 76 | struct wsm_tx_confirm *arg); 77 | void atbm_rx_cb(struct atbm_vif *priv, 78 | struct wsm_rx *arg, 79 | struct sk_buff **skb_p); 80 | 81 | /* ******************************************************************** */ 82 | /* Timeout */ 83 | /* ******************************************************************** */ 84 | /* Security */ 85 | int atbm_alloc_key(struct atbm_common *hw_priv); 86 | void atbm_free_key(struct atbm_common *hw_priv, int idx); 87 | void atbm_free_keys(struct atbm_common *hw_priv); 88 | int atbm_upload_keys(struct atbm_vif *priv); 89 | #if 0 90 | /* ******************************************************************** */ 91 | /* Workaround for WFD test case 6.1.10 */ 92 | void atbm_link_id_reset(struct atbm_work_struct *work); 93 | #endif 94 | #endif /* ATBM_APOLLO_TXRX_H */ 95 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /atbm_kconf/lxdialog/yesno.c: -------------------------------------------------------------------------------- 1 | /* 2 | * yesno.c -- implements the yes/no box 3 | * 4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) 5 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License 9 | * as published by the Free Software Foundation; either version 2 10 | * of the License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 | */ 21 | 22 | #include "dialog.h" 23 | 24 | /* 25 | * Display termination buttons 26 | */ 27 | static void print_buttons(WINDOW * dialog, int height, int width, int selected) 28 | { 29 | int x = width / 2 - 10; 30 | int y = height - 2; 31 | 32 | print_button(dialog, gettext(" Yes "), y, x, selected == 0); 33 | print_button(dialog, gettext(" No "), y, x + 13, selected == 1); 34 | 35 | wmove(dialog, y, x + 1 + 13 * selected); 36 | wrefresh(dialog); 37 | } 38 | 39 | /* 40 | * Display a dialog box with two buttons - Yes and No 41 | */ 42 | int dialog_yesno(const char *title, const char *prompt, int height, int width) 43 | { 44 | int i, x, y, key = 0, button = 0; 45 | WINDOW *dialog; 46 | 47 | do_resize: 48 | if (getmaxy(stdscr) < (height + 4)) 49 | return -ERRDISPLAYTOOSMALL; 50 | if (getmaxx(stdscr) < (width + 4)) 51 | return -ERRDISPLAYTOOSMALL; 52 | 53 | /* center dialog box on screen */ 54 | x = (COLS - width) / 2; 55 | y = (LINES - height) / 2; 56 | 57 | draw_shadow(stdscr, y, x, height, width); 58 | 59 | dialog = newwin(height, width, y, x); 60 | keypad(dialog, TRUE); 61 | 62 | draw_box(dialog, 0, 0, height, width, 63 | dlg.dialog.atr, dlg.border.atr); 64 | wattrset(dialog, dlg.border.atr); 65 | mvwaddch(dialog, height - 3, 0, ACS_LTEE); 66 | for (i = 0; i < width - 2; i++) 67 | waddch(dialog, ACS_HLINE); 68 | wattrset(dialog, dlg.dialog.atr); 69 | waddch(dialog, ACS_RTEE); 70 | 71 | print_title(dialog, title, width); 72 | 73 | wattrset(dialog, dlg.dialog.atr); 74 | print_autowrap(dialog, prompt, width - 2, 1, 3); 75 | 76 | print_buttons(dialog, height, width, 0); 77 | 78 | while (key != KEY_ESC) { 79 | key = wgetch(dialog); 80 | switch (key) { 81 | case 'Y': 82 | case 'y': 83 | delwin(dialog); 84 | return 0; 85 | case 'N': 86 | case 'n': 87 | delwin(dialog); 88 | return 1; 89 | 90 | case TAB: 91 | case KEY_LEFT: 92 | case KEY_RIGHT: 93 | button = ((key == KEY_LEFT ? --button : ++button) < 0) ? 1 : (button > 1 ? 0 : button); 94 | 95 | print_buttons(dialog, height, width, button); 96 | wrefresh(dialog); 97 | break; 98 | case ' ': 99 | case '\n': 100 | delwin(dialog); 101 | return button; 102 | case KEY_ESC: 103 | key = on_key_esc(dialog); 104 | break; 105 | case KEY_RESIZE: 106 | delwin(dialog); 107 | on_key_resize(); 108 | goto do_resize; 109 | } 110 | } 111 | 112 | delwin(dialog); 113 | return key; /* ESC pressed */ 114 | } 115 | -------------------------------------------------------------------------------- /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 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 10, 0)) 134 | MODULE_IMPORT_NS(CRYPTO_INTERNAL); 135 | #endif -------------------------------------------------------------------------------- /hal_apollo/internal_cmd.h: -------------------------------------------------------------------------------- 1 | #ifndef __INTERNAL_CMD__ 2 | #define __INTERNAL_CMD__ 3 | #include 4 | #include "mac80211/ieee80211_i.h" 5 | void send_signal(int sig_num,int user_pid); 6 | bool atbm_internal_cmd_scan_triger(struct ieee80211_sub_if_data *sdata,struct ieee80211_internal_scan_request *req); 7 | bool atbm_internal_cmd_stainfo(struct ieee80211_local *local,struct ieee80211_internal_sta_req *sta_req); 8 | bool atbm_internal_cmd_monitor_req(struct ieee80211_sub_if_data *sdata,struct ieee80211_internal_monitor_req *monitor_req); 9 | bool atbm_internal_cmd_stop_monitor(struct ieee80211_sub_if_data *sdata); 10 | bool atbm_internal_wsm_adaptive(struct atbm_common *hw_priv,struct ieee80211_internal_wsm_adaptive *adaptive); 11 | bool atbm_internal_wsm_txpwr_dcxo(struct atbm_common *hw_priv,struct ieee80211_internal_wsm_txpwr_dcxo *txpwr_dcxo); 12 | bool atbm_internal_wsm_txpwr(struct atbm_common *hw_priv,struct ieee80211_internal_wsm_txpwr *txpwr); 13 | bool atbm_internal_freq_set(struct ieee80211_hw *hw,struct ieee80211_internal_set_freq_req *req); 14 | bool atbm_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 atbm_internal_channel_auto_select_results(struct ieee80211_sub_if_data *sdata, 18 | struct ieee80211_internal_channel_auto_select_results *results); 19 | bool atbm_internal_channel_auto_select(struct ieee80211_sub_if_data *sdata, 20 | struct ieee80211_internal_channel_auto_select_req *req); 21 | bool atbm_internal_request_chip_cap(struct ieee80211_hw *hw,struct ieee80211_internal_req_chip *req); 22 | #ifdef CONFIG_ATBM_SUPPORT_AP_CONFIG 23 | bool atbm_internal_update_ap_conf(struct ieee80211_sub_if_data *sdata,struct ieee80211_internal_ap_conf *conf_req,bool clear); 24 | #endif 25 | bool atbm_internal_wsm_set_rate(struct atbm_common *hw_priv,struct ieee80211_internal_rate_req *req); 26 | bool atbm_internal_wsm_set_rate_power(struct atbm_common *hw_priv,struct ieee80211_internal_rate_power_req *req); 27 | #ifdef CONFIG_ATBM_MONITOR_SPECIAL_MAC 28 | bool atbm_internal_mac_monitor(struct ieee80211_hw *hw,struct ieee80211_internal_mac_monitor *monitor); 29 | #endif 30 | bool atbm_internal_cmd_req_iftype(struct ieee80211_sub_if_data *sdata,struct ieee80211_internal_iftype_req *req); 31 | #define ATBM_GPIO_CONFIG__FUNCTION_CONFIGD BIT(0) 32 | #define ATBM_GPIO_CONFIG__INPUT BIT(1) 33 | #define ATBM_GPIO_CONFIG__OUTPUT BIT(2) 34 | #define ATBM_GPIO_CONFIG__PUP BIT(3) 35 | #define ATBM_GPIO_CONFIG__PUD BIT(4) 36 | 37 | 38 | 39 | struct atbm_ctr_addr{ 40 | unsigned int base_addr; 41 | unsigned int val; 42 | char start_bit; 43 | char width; 44 | }; 45 | struct atbm_gpio_config { 46 | unsigned int gpio; 47 | unsigned int flags; 48 | struct atbm_ctr_addr fun_ctrl; 49 | struct atbm_ctr_addr pup_ctrl; 50 | struct atbm_ctr_addr pdu_ctrl; 51 | struct atbm_ctr_addr dir_ctrl; 52 | struct atbm_ctr_addr out_val; 53 | struct atbm_ctr_addr in_val; 54 | }; 55 | bool atbm_internal_gpio_config(struct atbm_common *hw_priv,int gpio,bool dir ,bool pu,bool default_val); 56 | bool atbm_internal_gpio_output(struct atbm_common *hw_priv,int gpio,bool set); 57 | bool atbm_internal_gpio_input(struct atbm_common *hw_priv,int gpio,bool *set); 58 | bool atbm_internal_edca_update(struct ieee80211_sub_if_data *sdata,int queue,int aifs,int cw_win,int cw_max,int txop); 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /hal_apollo/scan.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Scan interface for altobeam APOLLO mac80211 drivers 3 | * * 4 | * Copyright (c) 2016, altobeam 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 atbm_work_struct; 27 | 28 | struct atbm_scan { 29 | struct semaphore lock; 30 | struct atbm_work_struct work; 31 | #ifdef CONFIG_ATBM_SUPPORT_SCHED_SCAN 32 | #ifdef ROAM_OFFLOAD 33 | struct atbm_work_struct swork; /* scheduled scan work */ 34 | struct cfg80211_sched_scan_request *sched_req; 35 | #endif /*ROAM_OFFLOAD*/ 36 | #endif 37 | struct atbm_delayed_work timeout; 38 | #ifdef CONFIG_ATBM_SCAN_SPLIT 39 | struct atbm_delayed_work scan_spilt; 40 | u8 split; 41 | #endif 42 | struct cfg80211_scan_request *req; 43 | struct ieee80211_scan_req_wrap *req_wrap; 44 | struct ieee80211_channel **begin; 45 | struct ieee80211_channel **curr; 46 | struct ieee80211_channel **end; 47 | struct wsm_ssid ssids[WSM_SCAN_MAX_NUM_OF_SSIDS]; 48 | int output_power; 49 | int n_ssids; 50 | int status; 51 | atomic_t in_progress; 52 | /* Direct probe requests workaround */ 53 | struct atbm_delayed_work probe_work; 54 | int direct_probe; 55 | u8 if_id; 56 | int wait_complete; 57 | struct atbm_work_struct smartwork; 58 | struct atbm_work_struct smartsetChanwork; 59 | struct atbm_work_struct smartstopwork; 60 | u8 scan_smartconfig; 61 | u8 cca; 62 | u8 passive; 63 | }; 64 | 65 | int atbm_hw_scan(struct ieee80211_hw *hw, 66 | struct ieee80211_vif *vif, 67 | struct ieee80211_scan_req_wrap *req_wrap); 68 | #ifdef CONFIG_ATBM_SUPPORT_SCHED_SCAN 69 | #ifdef ROAM_OFFLOAD 70 | int atbm_hw_sched_scan_start(struct ieee80211_hw *hw, 71 | struct ieee80211_vif *vif, 72 | struct cfg80211_sched_scan_request *req, 73 | struct ieee80211_sched_scan_ies *ies); 74 | void atbm_hw_sched_scan_stop(struct atbm_common *priv); 75 | void atbm_sched_scan_work(struct atbm_work_struct *work); 76 | #endif /*ROAM_OFFLOAD*/ 77 | #endif 78 | void atbm_scan_work(struct atbm_work_struct *work); 79 | void atbm_scan_timeout(struct atbm_work_struct *work); 80 | void etf_scan_end_work(struct atbm_work_struct *work); 81 | void atbm_scan_complete_cb(struct atbm_common *priv, 82 | struct wsm_scan_complete *arg); 83 | #ifdef CONFIG_ATBM_SCAN_SPLIT 84 | void atbm_scan_split_work(struct atbm_work_struct *work); 85 | #endif 86 | 87 | /* ******************************************************************** */ 88 | /* Raw probe requests TX workaround */ 89 | void atbm_probe_work(struct atbm_work_struct *work); 90 | #ifdef CONFIG_ATBM_SUPPORT_P2P 91 | void atbm_scan_listenning_restart_delayed(struct atbm_vif *priv); 92 | #endif 93 | 94 | #ifdef CONFIG_ATBM_APOLLO_TESTMODE 95 | /* Advance Scan Timer */ 96 | void atbm_advance_scan_timeout(struct atbm_work_struct *work); 97 | #endif 98 | void atbm_cancel_hw_scan(struct ieee80211_hw *hw,struct ieee80211_vif *vif); 99 | void atbm_wait_scan_complete_sync(struct atbm_common *hw_priv); 100 | 101 | #endif 102 | -------------------------------------------------------------------------------- /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_ATBM_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_ATBM_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_ATBM_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 | -------------------------------------------------------------------------------- /atbm_kconf/util.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2005 Roman Zippel 3 | * Copyright (C) 2002-2005 Sam Ravnborg 4 | * 5 | * Released under the terms of the GNU GPL v2.0. 6 | */ 7 | 8 | #include 9 | #include 10 | #include 11 | #include "lkc.h" 12 | 13 | /* file already present in list? If not add it */ 14 | struct file *file_lookup(const char *name) 15 | { 16 | struct file *file; 17 | const char *file_name = sym_expand_string_value(name); 18 | 19 | for (file = file_list; file; file = file->next) { 20 | if (!strcmp(name, file->name)) { 21 | free((void *)file_name); 22 | return file; 23 | } 24 | } 25 | 26 | file = xmalloc(sizeof(*file)); 27 | memset(file, 0, sizeof(*file)); 28 | file->name = file_name; 29 | file->next = file_list; 30 | file_list = file; 31 | return file; 32 | } 33 | 34 | /* write a dependency file as used by kbuild to track dependencies */ 35 | int file_write_dep(const char *name) 36 | { 37 | struct symbol *sym, *env_sym; 38 | struct expr *e; 39 | struct file *file; 40 | FILE *out; 41 | 42 | if (!name) 43 | name = ".kconfig.d"; 44 | out = fopen("..config.tmp", "w"); 45 | if (!out) 46 | return 1; 47 | fprintf(out, "deps_config := \\\n"); 48 | for (file = file_list; file; file = file->next) { 49 | if (file->next) 50 | fprintf(out, "\t%s \\\n", file->name); 51 | else 52 | fprintf(out, "\t%s\n", file->name); 53 | } 54 | fprintf(out, "\n%s: \\\n" 55 | "\t$(deps_config)\n\n", conf_get_autoconfig_name()); 56 | 57 | expr_list_for_each_sym(sym_env_list, e, sym) { 58 | struct property *prop; 59 | const char *value; 60 | 61 | prop = sym_get_env_prop(sym); 62 | env_sym = prop_get_symbol(prop); 63 | if (!env_sym) 64 | continue; 65 | value = getenv(env_sym->name); 66 | if (!value) 67 | value = ""; 68 | fprintf(out, "ifneq \"$(%s)\" \"%s\"\n", env_sym->name, value); 69 | fprintf(out, "%s: FORCE\n", conf_get_autoconfig_name()); 70 | fprintf(out, "endif\n"); 71 | } 72 | 73 | fprintf(out, "\n$(deps_config): ;\n"); 74 | fclose(out); 75 | rename("..config.tmp", name); 76 | return 0; 77 | } 78 | 79 | 80 | /* Allocate initial growable string */ 81 | struct gstr str_new(void) 82 | { 83 | struct gstr gs; 84 | gs.s = xmalloc(sizeof(char) * 64); 85 | gs.len = 64; 86 | gs.max_width = 0; 87 | strcpy(gs.s, "\0"); 88 | return gs; 89 | } 90 | 91 | /* Allocate and assign growable string */ 92 | struct gstr str_assign(const char *s) 93 | { 94 | struct gstr gs; 95 | gs.s = strdup(s); 96 | gs.len = strlen(s) + 1; 97 | gs.max_width = 0; 98 | return gs; 99 | } 100 | 101 | /* Free storage for growable string */ 102 | void str_free(struct gstr *gs) 103 | { 104 | if (gs->s) 105 | free(gs->s); 106 | gs->s = NULL; 107 | gs->len = 0; 108 | } 109 | 110 | /* Append to growable string */ 111 | void str_append(struct gstr *gs, const char *s) 112 | { 113 | size_t l; 114 | if (s) { 115 | l = strlen(gs->s) + strlen(s) + 1; 116 | if (l > gs->len) { 117 | gs->s = realloc(gs->s, l); 118 | gs->len = l; 119 | } 120 | strcat(gs->s, s); 121 | } 122 | } 123 | 124 | /* Append printf formatted string to growable string */ 125 | void str_printf(struct gstr *gs, const char *fmt, ...) 126 | { 127 | va_list ap; 128 | char s[10000]; /* big enough... */ 129 | va_start(ap, fmt); 130 | vsnprintf(s, sizeof(s), fmt, ap); 131 | str_append(gs, s); 132 | va_end(ap); 133 | } 134 | 135 | /* Retrieve value of growable string */ 136 | const char *str_get(struct gstr *gs) 137 | { 138 | return gs->s; 139 | } 140 | 141 | void *xmalloc(size_t size) 142 | { 143 | void *p = malloc(size); 144 | if (p) 145 | return p; 146 | fprintf(stderr, "Out of memory.\n"); 147 | exit(1); 148 | } 149 | 150 | void *xcalloc(size_t nmemb, size_t size) 151 | { 152 | void *p = calloc(nmemb, size); 153 | if (p) 154 | return p; 155 | fprintf(stderr, "Out of memory.\n"); 156 | exit(1); 157 | } 158 | 159 | 160 | -------------------------------------------------------------------------------- /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 = atbm_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 | -------------------------------------------------------------------------------- /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 | if(local->monitors == 0) 25 | continue; 26 | return CHAN_MODE_HOPPING; 27 | } 28 | if (sdata->vif.type == NL80211_IFTYPE_STATION && 29 | !sdata->u.mgd.associated) 30 | continue; 31 | #ifdef CONFIG_ATBM_SUPPORT_IBSS 32 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { 33 | if (!sdata->u.ibss.ssid_len) 34 | continue; 35 | if (!sdata->u.ibss.fixed_channel) 36 | return CHAN_MODE_HOPPING; 37 | } 38 | #endif 39 | if (sdata->vif.type == NL80211_IFTYPE_AP && 40 | !sdata->u.ap.beacon) 41 | continue; 42 | 43 | return CHAN_MODE_FIXED; 44 | } 45 | 46 | return CHAN_MODE_UNDEFINED; 47 | } 48 | 49 | enum ieee80211_chan_mode 50 | ieee80211_get_channel_mode(struct ieee80211_local *local, 51 | struct ieee80211_sub_if_data *ignore) 52 | { 53 | enum ieee80211_chan_mode mode; 54 | 55 | mutex_lock(&local->iflist_mtx); 56 | mode = __ieee80211_get_channel_mode(local, ignore); 57 | mutex_unlock(&local->iflist_mtx); 58 | 59 | return mode; 60 | } 61 | 62 | bool ieee80211_set_channel_type(struct ieee80211_local *local, 63 | struct ieee80211_sub_if_data *sdata, 64 | enum nl80211_channel_type chantype) 65 | { 66 | struct ieee80211_channel_state *chan_state; 67 | struct ieee80211_sub_if_data *tmp; 68 | enum nl80211_channel_type superchan = NL80211_CHAN_NO_HT; 69 | bool result; 70 | 71 | mutex_lock(&local->iflist_mtx); 72 | #ifdef CONFIG_ATBM_SUPPORT_MULTI_CHANNEL 73 | if (local->hw.flags & IEEE80211_HW_SUPPORTS_MULTI_CHANNEL) { 74 | /* XXX: COMBO: TBD - is this ok? */ 75 | BUG_ON(!sdata); 76 | sdata->chan_state._oper_channel_type = chantype; 77 | sdata->vif.bss_conf.channel_type = chantype; 78 | result = true; 79 | goto out; 80 | } 81 | #endif 82 | chan_state = ieee80211_get_channel_state(local, sdata); 83 | 84 | list_for_each_entry(tmp, &local->interfaces, list) { 85 | if (tmp == sdata) 86 | continue; 87 | 88 | if (!ieee80211_sdata_running(tmp)) 89 | continue; 90 | 91 | switch (tmp->vif.bss_conf.channel_type) { 92 | case NL80211_CHAN_NO_HT: 93 | case NL80211_CHAN_HT20: 94 | if (superchan > tmp->vif.bss_conf.channel_type) 95 | break; 96 | 97 | superchan = tmp->vif.bss_conf.channel_type; 98 | break; 99 | case NL80211_CHAN_HT40PLUS: 100 | WARN_ON(superchan == NL80211_CHAN_HT40MINUS); 101 | superchan = NL80211_CHAN_HT40PLUS; 102 | break; 103 | case NL80211_CHAN_HT40MINUS: 104 | WARN_ON(superchan == NL80211_CHAN_HT40PLUS); 105 | superchan = NL80211_CHAN_HT40MINUS; 106 | break; 107 | } 108 | } 109 | 110 | switch (superchan) { 111 | case NL80211_CHAN_NO_HT: 112 | case NL80211_CHAN_HT20: 113 | /* 114 | * allow any change that doesn't go to no-HT 115 | * (if it already is no-HT no change is needed) 116 | */ 117 | if (chantype == NL80211_CHAN_NO_HT) 118 | break; 119 | superchan = chantype; 120 | break; 121 | case NL80211_CHAN_HT40PLUS: 122 | case NL80211_CHAN_HT40MINUS: 123 | /* allow smaller bandwidth and same */ 124 | if (chantype == NL80211_CHAN_NO_HT) 125 | break; 126 | if (chantype == NL80211_CHAN_HT20) 127 | break; 128 | if (superchan == chantype) 129 | break; 130 | result = false; 131 | goto out; 132 | } 133 | 134 | chan_state->_oper_channel_type = superchan; 135 | if (sdata) 136 | { 137 | sdata->vif.bss_conf.channel_type = chantype; 138 | } 139 | result = true; 140 | out: 141 | mutex_unlock(&local->iflist_mtx); 142 | 143 | return result; 144 | } 145 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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-error \ 10 | -Wno-error=vla \ 11 | -Wno-error=unused-function -fno-common \ 12 | -Wno-vla \ 13 | -Wno-address-of-packed-member 14 | 15 | ifneq ($(ATBM_MAKEFILE_SUB),y) 16 | export 17 | ifeq ($(CONFIG_ATBM_MODULE_NAME),) 18 | CONFIG_ATBM_MODULE_NAME = atbm_wifi 19 | endif 20 | 21 | ifeq ($(CONFIG_ATBM_WIFIIF1_NAME),) 22 | CONFIG_ATBM_WIFIIF1_NAME = "wlan%d" 23 | endif 24 | 25 | ifeq ($(CONFIG_ATBM_WIFIIF2_NAME),) 26 | CONFIG_ATBM_WIFIIF2_NAME = "p2p%d" 27 | endif 28 | 29 | ifeq ($(CONFIG_ATBM_USB_VID),) 30 | CONFIG_ATBM_USB_VID = 0x007a 31 | endif 32 | 33 | ifeq ($(CONFIG_ATBM_USB_PID),) 34 | CONFIG_ATBM_USB_PID = 0x8888 35 | endif 36 | 37 | ifeq ($(CONFIG_ATBM_MODULE_DRIVER_NAME),) 38 | CONFIG_ATBM_MODULE_DRIVER_NAME = "atbm_wlan" 39 | endif 40 | 41 | ifeq ($(CONFIG_ATBM_PLATFORM_DEVICE_NAME),) 42 | CONFIG_ATBM_PLATFORM_DEVICE_NAME = "atbmusbwifi" 43 | endif 44 | 45 | ifeq ($(CONFIG_ATBM_MODULE_PM_STAYAWK),) 46 | CONFIG_ATBM_PLATFORM_DEVICE_NAME = "pm_stayawake" 47 | endif 48 | 49 | ifeq ($(CONFIG_ATBM_FW_NAME),) 50 | CONFIG_ATBM_FW_NAME = "fw.bin" 51 | endif 52 | 53 | export 54 | SDIO_HOST ?= $(shell echo $(CONFIG_ATBM_SDIO_MMCx)) 55 | IF1NAME ?= $(shell echo $(CONFIG_ATBM_WIFIIF1_NAME)) 56 | IF2NAME ?= $(shell echo $(CONFIG_ATBM_WIFIIF2_NAME)) 57 | FW ?= $(shell echo $(CONFIG_ATBM_FW_NAME)) 58 | MODULES_NAME ?= $(shell echo $(CONFIG_ATBM_MODULE_NAME)) 59 | USBVID ?= $(shell echo $(CONFIG_ATBM_USB_VID)) 60 | USBPID ?= $(shell echo $(CONFIG_ATBM_USB_PID)) 61 | MODDRVNAME ?= $(shell echo $(CONFIG_ATBM_MODULE_DRIVER_NAME)) 62 | PLFDEVNAME ?= $(shell echo $(CONFIG_ATBM_PLATFORM_DEVICE_NAME)) 63 | MODPMSTAYAWK ?= $(shell echo $(CONFIG_ATBM_MODULE_PM_STAYAWK)) 64 | SAEAUTHEN ?= $(CONFIG_ATBM_FUNC_SAE_AUTHEN) 65 | LOAD_FW_H ?= $(CONFIG_ATBM_USE_FIRMWARE_H) 66 | SKB_DEBUG ?= $(CONFIG_ATBM_FUNC_SKB_DEBUG) 67 | MEM_DEBUG ?= $(CONFIG_ATBM_FUNC_SKB_DEBUG) 68 | BRIDGE ?= $(CONFIG_ATBM_SUPPORT_BRIDGE) 69 | MONITOR ?= $(CONFIG_ATBM_FUNC_MONITOR) 70 | EARLYSUSPEND ?= $(CONFIG_ATBM_FUNC_EARLYSUSPEND) 71 | NOTXCONFIRM ?= $(CONFIG_ATBM_FUNC_NOTXCONFIRM) 72 | CH5G ?= $(CONFIG_ATBM_FUNC_CHANNEL_5G_PRETEND_2G) 73 | ONLY_HT20 ?= $(CONFIG_ATBM_WITHBAND_ONLY_HT20) 74 | USBAGGTX ?= $(CONFIG_ATBM_FUNC_USB_AGGRTX) 75 | USBDMABUFF ?= $(CONFIG_ATBM_FUNC_USB_DMABUFF) 76 | USBCMDENHANCE ?= $(CONFIG_ATBM_FUNC_USB_CMD_ENHANCE) 77 | USBDATAENHANCE ?= $(CONFIG_ATBM_FUNC_USB_DATA_ENHANCE) 78 | PMRELODDFW ?= $(CONFIG_ATBM_FUNC_PS_WAKEUP_RELOAD_FW) 79 | USB_BUS ?= $(CONFIG_ATBM_USB_BUS) 80 | SDIO_BUS ?= $(CONFIG_ATBM_SDIO_BUS) 81 | SPI_BUS ?= $(CONFIG_ATBM_SPI_BUS) 82 | CHECKSUM ?= $(CONFIG_ATBM_FUNC_HW_CHSUM) 83 | SWRATECTRL ?= $(CONFIG_ATBM_SW_RATE_CTRL) 84 | P2PENABLE ?= $(CONFIG_ATBM_FUNC_P2P_ENABLE) 85 | SWENC ?= $(CONFIG_ATBM_FUNC_SW_ENC) 86 | MODULEFS ?= $(CONFIG_ATBM_FUNC_MODULE_FS) 87 | DEVCTRL ?= $(CONFIG_ATBM_FUNC_DEV_CTRL_API) 88 | SMARTCONFIG ?= $(CONFIG_ATBM_FUNC_SMARTCONFIG) 89 | CONFIG_ATHENAB ?= $(CONFIG_ATBM601x)$(CONFIG_ATBM602x) 90 | CONFIG_ARESB ?= $(CONFIG_ATBM603x) 91 | #CONFIG_6012B ?= $(CONFIG_ATBM6012B_COMB) 92 | CONFIG_HERA ?= $(CONFIG_ATBM6041) 93 | NEED_SCOND_INTERFACE ?= $(CONFIG_NEED_P2P0_INTERFACE) 94 | CONFIG_NOT_SUPPORT_40M_CHW ?= $(CONFIG_ATBM601x) 95 | DRVLOADERFAST ?= $(CONFIG_ATBM_FUNC_DRV_LOADER_FAST) 96 | PRI_IE ?= $(CONFIG_ATBM_FUNC_PRIVE_IE) 97 | MONHDRPRISM ?= $(CONFIG_ATBM_FUNC_MONITOR_HDR_PRISM) 98 | ############################################################# 99 | 100 | #ATBM6041 ONLY USE SDIO 101 | ifeq ($(CONFIG_HERA),y) 102 | SDIO_BUS=y 103 | endif 104 | 105 | ifeq ($(CONFIG_ATBM_SDIO_24M),y) 106 | ifeq ($(CONFIG_ATHENAB),y) 107 | CONFIG_ATHENAB_24M=y 108 | CONFIG_ATHENAB=n 109 | endif 110 | endif 111 | endif 112 | 113 | obj-$(CONFIG_ATBM_APOLLO) += hal_apollo/ 114 | -------------------------------------------------------------------------------- /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 | 17 | #include 18 | #include "key.h" 19 | #include "aes_ccm.h" 20 | 21 | static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *scratch, u8 *a) 22 | { 23 | int i; 24 | u8 *b_0, *aad, *b, *s_0; 25 | 26 | b_0 = scratch + 3 * AES_BLOCK_SIZE; 27 | aad = scratch + 4 * AES_BLOCK_SIZE; 28 | b = scratch; 29 | s_0 = scratch + AES_BLOCK_SIZE; 30 | 31 | crypto_cipher_encrypt_one(tfm, b, b_0); 32 | 33 | /* Extra Authenticate-only data (always two AES blocks) */ 34 | for (i = 0; i < AES_BLOCK_SIZE; i++) 35 | aad[i] ^= b[i]; 36 | crypto_cipher_encrypt_one(tfm, b, aad); 37 | 38 | aad += AES_BLOCK_SIZE; 39 | 40 | for (i = 0; i < AES_BLOCK_SIZE; i++) 41 | aad[i] ^= b[i]; 42 | crypto_cipher_encrypt_one(tfm, a, aad); 43 | 44 | /* Mask out bits from auth-only-b_0 */ 45 | b_0[0] &= 0x07; 46 | 47 | /* S_0 is used to encrypt T (= MIC) */ 48 | b_0[14] = 0; 49 | b_0[15] = 0; 50 | crypto_cipher_encrypt_one(tfm, s_0, b_0); 51 | } 52 | 53 | 54 | void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch, 55 | u8 *data, size_t data_len, 56 | u8 *cdata, u8 *mic) 57 | { 58 | int i, j, last_len, num_blocks; 59 | u8 *pos, *cpos, *b, *s_0, *e, *b_0; 60 | 61 | b = scratch; 62 | s_0 = scratch + AES_BLOCK_SIZE; 63 | e = scratch + 2 * AES_BLOCK_SIZE; 64 | b_0 = scratch + 3 * AES_BLOCK_SIZE; 65 | 66 | num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE); 67 | last_len = data_len % AES_BLOCK_SIZE; 68 | aes_ccm_prepare(tfm, scratch, b); 69 | 70 | /* Process payload blocks */ 71 | pos = data; 72 | cpos = cdata; 73 | for (j = 1; j <= num_blocks; j++) { 74 | int blen = (j == num_blocks && last_len) ? 75 | last_len : AES_BLOCK_SIZE; 76 | 77 | /* Authentication followed by encryption */ 78 | for (i = 0; i < blen; i++) 79 | b[i] ^= pos[i]; 80 | crypto_cipher_encrypt_one(tfm, b, b); 81 | 82 | b_0[14] = (j >> 8) & 0xff; 83 | b_0[15] = j & 0xff; 84 | crypto_cipher_encrypt_one(tfm, e, b_0); 85 | for (i = 0; i < blen; i++) 86 | *cpos++ = *pos++ ^ e[i]; 87 | } 88 | 89 | for (i = 0; i < CCMP_MIC_LEN; i++) 90 | mic[i] = b[i] ^ s_0[i]; 91 | } 92 | 93 | 94 | int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch, 95 | u8 *cdata, size_t data_len, u8 *mic, u8 *data) 96 | { 97 | int i, j, last_len, num_blocks; 98 | u8 *pos, *cpos, *b, *s_0, *a, *b_0; 99 | 100 | b = scratch; 101 | s_0 = scratch + AES_BLOCK_SIZE; 102 | a = scratch + 2 * AES_BLOCK_SIZE; 103 | b_0 = scratch + 3 * AES_BLOCK_SIZE; 104 | 105 | num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE); 106 | last_len = data_len % AES_BLOCK_SIZE; 107 | aes_ccm_prepare(tfm, scratch, a); 108 | 109 | /* Process payload blocks */ 110 | cpos = cdata; 111 | pos = data; 112 | for (j = 1; j <= num_blocks; j++) { 113 | int blen = (j == num_blocks && last_len) ? 114 | last_len : AES_BLOCK_SIZE; 115 | 116 | /* Decryption followed by authentication */ 117 | b_0[14] = (j >> 8) & 0xff; 118 | b_0[15] = j & 0xff; 119 | crypto_cipher_encrypt_one(tfm, b, b_0); 120 | for (i = 0; i < blen; i++) { 121 | *pos = *cpos++ ^ b[i]; 122 | a[i] ^= *pos++; 123 | } 124 | crypto_cipher_encrypt_one(tfm, a, a); 125 | } 126 | 127 | for (i = 0; i < CCMP_MIC_LEN; i++) { 128 | if ((mic[i] ^ s_0[i]) != a[i]) 129 | return -1; 130 | } 131 | 132 | return 0; 133 | } 134 | 135 | 136 | struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[]) 137 | { 138 | struct crypto_cipher *tfm; 139 | 140 | tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); 141 | if (!IS_ERR(tfm)) 142 | crypto_cipher_setkey(tfm, key, ALG_CCMP_KEY_LEN); 143 | 144 | return tfm; 145 | } 146 | 147 | 148 | void ieee80211_aes_key_free(struct crypto_cipher *tfm) 149 | { 150 | crypto_free_cipher(tfm); 151 | } 152 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 10, 60)) 153 | MODULE_IMPORT_NS(CRYPTO_INTERNAL); 154 | #endif 155 | -------------------------------------------------------------------------------- /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 | atbm_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/atbm_testmode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * * 3 | * Copyright (c) 2016, altobeam 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 ATBM_NL80211_TESTMODE_MSG_COPY_H 16 | #define ATBM_NL80211_TESTMODE_MSG_COPY_H 17 | 18 | /* example command structure for test purposes */ 19 | struct atbm_msg_test_t { 20 | int dummy; 21 | }; 22 | 23 | /* example reply structure for test purposes */ 24 | struct atbm_reply_test_t { 25 | int dummy; 26 | }; 27 | 28 | /* example event structure for test purposes */ 29 | struct atbm_event_test_t { 30 | int dummy; 31 | }; 32 | 33 | enum atbm_msg_id { 34 | ATBM_MSG_TEST = 0, /* for test purposes */ 35 | ATBM_MSG_EVENT_TEST, /* for test purposes */ 36 | ATBM_MSG_SET_SNAP_FRAME, 37 | ATBM_MSG_EVENT_FRAME_DATA, 38 | ATBM_MSG_GET_TX_POWER_LEVEL, 39 | ATBM_MSG_GET_TX_POWER_RANGE, 40 | ATBM_MSG_SET_ADVANCE_SCAN_ELEMS, 41 | ATBM_MSG_SET_TX_QUEUE_PARAMS, 42 | ATBM_MSG_SET_POWER_SAVE, 43 | /* Add new IDs here */ 44 | 45 | ATBM_MSG_ID_MAX, 46 | }; 47 | 48 | enum atbm_nl80211_testmode_data_attributes { 49 | ATBM_TM_MSG_ID = 0x0001, /* u32 type containing the ATBM message ID */ 50 | ATBM_TM_MSG_DATA, /* message payload */ 51 | 52 | /* Max indicator so module test may add its own attributes */ 53 | ATBM_TM_MSG_ATTR_MAX, 54 | }; 55 | 56 | /** 57 | * atbm_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 atbm_msg_set_snap_frame { 66 | u8 len; 67 | u8 frame[0]; 68 | }; 69 | 70 | /** 71 | * atbm_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 atbm_msg_set_txqueue_params { 78 | u8 user_priority; 79 | u16 medium_time; 80 | u16 expiry_time; 81 | }; 82 | #ifdef CONFIG_ATBM_APOLLO_TESTMODE 83 | /** 84 | * atbm_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 atbm_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 | * atbm_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 atbm_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 ATBM_TM_MAX_ATTRIB_SIZE 1024 158 | 159 | #endif /* ATBM_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 !atbm_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/bh.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Device handling thread interface for mac80211 altobeam APOLLO drivers 3 | * 4 | * Copyright (c) 2016, altobeam 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 ATBM_APOLLO_BH_H 16 | #define ATBM_APOLLO_BH_H 17 | 18 | /* extern */ struct atbm_common; 19 | 20 | #define SDIO_BLOCK_SIZE 256 21 | 22 | /* Suspend state privates */ 23 | enum atbm_bh_pm_state { 24 | ATBM_APOLLO_BH_RESUMED = 0, 25 | ATBM_APOLLO_BH_SUSPEND, 26 | ATBM_APOLLO_BH_SUSPENDED, 27 | ATBM_APOLLO_BH_RESUME, 28 | }; 29 | enum atbm_rx_frame_type{ 30 | ATBM_RX_RAW_FRAME = 1, 31 | ATBM_RX_DERICTLY_DATA_FRAME, 32 | ATBM_RX_SLOW_MGMT_FRAME, 33 | ATBM_RX_WSM_CMD_FRAME, 34 | ATBM_RX_WSM_DATA_FRAME, 35 | ATBM_RX_WSM_FREE, 36 | }; 37 | #include "bh_usb.h" 38 | 39 | int atbm_register_bh(struct atbm_common *hw_priv); 40 | void atbm_unregister_bh(struct atbm_common *hw_priv); 41 | void atbm_irq_handler(struct atbm_common *hw_priv); 42 | void atbm_bh_wakeup(struct atbm_common *hw_priv); 43 | int atbm_bh_suspend(struct atbm_common *hw_priv); 44 | int atbm_bh_resume(struct atbm_common *hw_priv); 45 | /* Must be called from BH thread. */ 46 | void atbm_enable_powersave(struct atbm_vif *priv, 47 | bool enable); 48 | int wsm_release_tx_buffer(struct atbm_common *hw_priv, int count); 49 | void wsm_alloc_tx_buffer(struct atbm_common *hw_priv); 50 | int wsm_release_vif_tx_buffer(struct atbm_common *hw_priv, int if_id, 51 | int count); 52 | void atbm_put_skb(struct atbm_common *hw_priv, struct sk_buff *skb); 53 | 54 | int atbm_powerave_sdio_sync(struct atbm_common *hw_priv); 55 | int atbm_device_wakeup(struct atbm_common *hw_priv); 56 | void atbm_get_cca_work(struct atbm_work_struct *work); 57 | #ifdef ATBM_SDIO_PATCH 58 | u16 atbm_CalCheckSum(const u8 *data,u16 len); 59 | void atbm_packetId_to_seq(struct atbm_common *hw_priv,u32 packetId); 60 | int atbm_seq_to_packetId(struct atbm_common *hw_priv,u32 seq); 61 | #endif 62 | static inline int atbm_bh_is_term(struct atbm_common *hw_priv){ 63 | if((hw_priv->bh_thread==NULL) || (hw_priv->bh_error==1)||(atomic_read(&hw_priv->atbm_pluged)==0)){ 64 | return 1; 65 | } 66 | else { 67 | return 0; 68 | } 69 | } 70 | #define can_not_queue_work(hw_priv) \ 71 | (((hw_priv)->workqueue==NULL)) 72 | #define atbm_hw_priv_queue_work(hw_priv,work) \ 73 | (can_not_queue_work(hw_priv) ? -1:atbm_queue_work((hw_priv)->workqueue,work)) 74 | #define atbm_hw_priv_queue_delayed_work(hw_priv,dwork,delay) \ 75 | (can_not_queue_work(hw_priv) ? -1:atbm_queue_delayed_work((hw_priv)->workqueue,dwork,delay)) 76 | static inline bool atbm_hw_cancel_queue_work(struct atbm_work_struct *work,bool sync) 77 | { 78 | bool retval = false; 79 | if((sync == true) || atbm_work_pending(work)) 80 | { 81 | retval = atbm_cancel_work_sync(work); 82 | } 83 | 84 | return retval; 85 | } 86 | 87 | static inline bool atbm_hw_cancel_delayed_work(struct atbm_delayed_work *dwork,bool sync) 88 | { 89 | bool retval = false; 90 | if(sync == true) 91 | { 92 | retval = atbm_cancel_delayed_work_sync(dwork); 93 | } 94 | else 95 | { 96 | retval = atbm_cancel_delayed_work(dwork); 97 | } 98 | 99 | return retval; 100 | } 101 | #ifdef CONFIG_PM 102 | #define atbm_hold_suspend(__hw_priv) atbm_pm_stay_awake_lock(&((__hw_priv)->pm_state)) 103 | #define atbm_release_suspend(__hw_priv) atbm_pm_stay_awake_unlock(&((__hw_priv)->pm_state)) 104 | #else 105 | #define atbm_hold_suspend(__hw_priv) BUG_ON(__hw_priv==NULL) 106 | #define atbm_release_suspend(__hw_priv) BUG_ON(__hw_priv==NULL) 107 | #endif 108 | 109 | #define atbm_wait_event_timeout_stay_awake(_hw_priv,_wait_q,_cond,_timeout,_awake) \ 110 | ({ \ 111 | long ret_timeout = _timeout; \ 112 | if(_awake == true) atbm_hold_suspend(_hw_priv); \ 113 | ret_timeout = wait_event_timeout(_wait_q,_cond,ret_timeout); \ 114 | if(_awake == true) atbm_release_suspend(_hw_priv); \ 115 | ret_timeout; \ 116 | }) 117 | static inline void atbm_ieee80211_rx(struct ieee80211_hw *hw,struct sk_buff *skb) 118 | { 119 | #ifdef IEEE80211_TASKLET 120 | ieee80211_rx_irqsafe(hw,skb); 121 | #else 122 | if(skb->pkt_type == ATBM_RX_DERICTLY_DATA_FRAME){ 123 | ieee80211_rx_irqsafe(hw,skb); 124 | }else if(softirq_count() == 0){ 125 | skb->pkt_type = 0; 126 | ieee80211_rx_ni(hw,skb); 127 | }else { 128 | skb->pkt_type = 0; 129 | ieee80211_rx(hw,skb); 130 | } 131 | #endif 132 | } 133 | 134 | static inline void atbm_ieee80211_tx_status(struct ieee80211_hw *hw,struct sk_buff *skb) 135 | { 136 | ieee80211_tx_status_ni(hw,skb); 137 | } 138 | #endif /* ATBM_APOLLO_BH_H */ 139 | -------------------------------------------------------------------------------- /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 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) 17 | #include 18 | #endif 19 | #include 20 | #include 21 | 22 | #define NUM_DEFAULT_KEYS 4 23 | #define NUM_DEFAULT_MGMT_KEYS 2 24 | 25 | #define WEP_IV_LEN 4 26 | #define WEP_ICV_LEN 4 27 | #define ALG_CCMP_KEY_LEN 16 28 | #define CCMP_HDR_LEN 8 29 | #define CCMP_MIC_LEN 8 30 | #define CCMP_TK_LEN 16 31 | #define CCMP_PN_LEN 6 32 | #define TKIP_IV_LEN 8 33 | #define TKIP_ICV_LEN 4 34 | #define CMAC_PN_LEN 6 35 | #define WAPI_IV_LEN 18 36 | #define WAPI_ICV_LEN 16 37 | 38 | #define NUM_RX_DATA_QUEUES 16 39 | 40 | struct ieee80211_local; 41 | struct ieee80211_sub_if_data; 42 | struct sta_info; 43 | 44 | /** 45 | * enum ieee80211_internal_key_flags - internal key flags 46 | * 47 | * @KEY_FLAG_UPLOADED_TO_HARDWARE: Indicates that this key is present 48 | * in the hardware for TX crypto hardware acceleration. 49 | * @KEY_FLAG_TAINTED: Key is tainted and packets should be dropped. 50 | */ 51 | enum ieee80211_internal_key_flags { 52 | KEY_FLAG_UPLOADED_TO_HARDWARE = BIT(0), 53 | KEY_FLAG_TAINTED = BIT(1), 54 | }; 55 | 56 | enum ieee80211_internal_tkip_state { 57 | TKIP_STATE_NOT_INIT, 58 | TKIP_STATE_PHASE1_DONE, 59 | TKIP_STATE_PHASE1_HW_UPLOADED, 60 | }; 61 | 62 | struct tkip_ctx { 63 | u32 iv32; /* current iv32 */ 64 | u16 iv16; /* current iv16 */ 65 | u16 p1k[5]; /* p1k cache */ 66 | u32 p1k_iv32; /* iv32 for which p1k computed */ 67 | enum ieee80211_internal_tkip_state state; 68 | }; 69 | 70 | struct ieee80211_key { 71 | struct ieee80211_local *local; 72 | struct ieee80211_sub_if_data *sdata; 73 | struct sta_info *sta; 74 | 75 | /* for sdata list */ 76 | struct list_head list; 77 | 78 | /* protected by key mutex */ 79 | unsigned int flags; 80 | 81 | union { 82 | struct { 83 | /* protects tx context */ 84 | spinlock_t txlock; 85 | 86 | /* last used TSC */ 87 | struct tkip_ctx tx; 88 | 89 | /* last received RSC */ 90 | struct tkip_ctx rx[NUM_RX_DATA_QUEUES]; 91 | } tkip; 92 | struct { 93 | atomic64_t tx_pn; 94 | /* 95 | * Last received packet number. The first 96 | * NUM_RX_DATA_QUEUES counters are used with Data 97 | * frames and the last counter is used with Robust 98 | * Management frames. 99 | */ 100 | u8 rx_pn[NUM_RX_DATA_QUEUES + 1][CCMP_PN_LEN]; 101 | u8 prev_rx_pn[NUM_RX_DATA_QUEUES + 1][6]; 102 | #ifdef CONFIG_ATBM_USE_SW_ENC 103 | struct crypto_cipher *tfm; 104 | #endif 105 | u32 replays; /* dot11RSNAStatsCCMPReplays */ 106 | } ccmp; 107 | struct { 108 | atomic64_t tx_pn; 109 | u8 rx_pn[CMAC_PN_LEN]; 110 | struct crypto_cipher *tfm; 111 | u32 replays; /* dot11RSNAStatsCMACReplays */ 112 | u32 icverrors; /* dot11RSNAStatsCMACICVErrors */ 113 | } aes_cmac; 114 | } u; 115 | 116 | /* number of times this key has been used */ 117 | int tx_rx_count; 118 | 119 | #ifdef CONFIG_MAC80211_ATBM_DEBUGFS 120 | struct { 121 | struct dentry *stalink; 122 | struct dentry *dir; 123 | int cnt; 124 | } debugfs; 125 | #endif 126 | 127 | #ifdef CONFIG_MAC80211_ATBM_ROAMING_CHANGES 128 | /* rcu: used for non blocking key freeing */ 129 | struct rcu_head rcu; 130 | #endif 131 | /* 132 | * key config, must be last because it contains key 133 | * material as variable length member 134 | */ 135 | struct ieee80211_key_conf conf; 136 | }; 137 | struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len, 138 | const u8 *key_data, 139 | size_t seq_len, const u8 *seq); 140 | /* 141 | * Insert a key into data structures (sdata, sta if necessary) 142 | * to make it used, free old key. 143 | */ 144 | int __must_check ieee80211_key_link(struct ieee80211_key *key, 145 | struct ieee80211_sub_if_data *sdata, 146 | struct sta_info *sta); 147 | void __ieee80211_key_free(struct ieee80211_key *key); 148 | void ieee80211_key_free(struct ieee80211_local *local, 149 | struct ieee80211_key *key); 150 | void ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx, 151 | bool uni, bool multi); 152 | void ieee80211_set_default_mgmt_key(struct ieee80211_sub_if_data *sdata, 153 | int idx); 154 | void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata); 155 | void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata); 156 | void ieee80211_disable_keys(struct ieee80211_sub_if_data *sdata); 157 | #define key_mtx_dereference(local, ref) \ 158 | rcu_dereference_protected(ref, lockdep_is_held(&((local)->key_mtx))) 159 | 160 | #endif /* IEEE80211_KEY_H */ 161 | -------------------------------------------------------------------------------- /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 | fallthrough; 79 | case NL80211_IFTYPE_AP: 80 | ra = skb->data; 81 | break; 82 | #ifdef CONFIG_ATBM_SUPPORT_WDS 83 | case NL80211_IFTYPE_WDS: 84 | ra = sdata->u.wds.remote_addr; 85 | break; 86 | #endif 87 | #ifdef CONFIG_MAC80211_ATBM_MESH 88 | case NL80211_IFTYPE_MESH_POINT: 89 | ra = skb->data; 90 | break; 91 | #endif 92 | case NL80211_IFTYPE_STATION: 93 | ra = sdata->u.mgd.bssid; 94 | break; 95 | #ifdef CONFIG_ATBM_SUPPORT_IBSS 96 | case NL80211_IFTYPE_ADHOC: 97 | ra = skb->data; 98 | break; 99 | #endif 100 | default: 101 | break; 102 | } 103 | 104 | if (!sta && ra && !is_multicast_ether_addr(ra)) { 105 | sta = sta_info_get(sdata, ra); 106 | if (sta) 107 | qos = test_sta_flag(sta, WLAN_STA_WME); 108 | } 109 | rcu_read_unlock(); 110 | 111 | if (!qos) { 112 | skb->priority = 0; /* required for correct WPA/11i MIC */ 113 | return IEEE80211_AC_BE; 114 | } 115 | 116 | /* use the data classifier to determine what 802.1d tag the 117 | * data frame has */ 118 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)) 119 | skb->priority = cfg80211_classify8021d(skb); 120 | #else 121 | skb->priority = cfg80211_classify8021d(skb,NULL); 122 | #endif 123 | 124 | return ieee80211_downgrade_queue(local, skb); 125 | } 126 | 127 | u16 ieee80211_downgrade_queue(struct ieee80211_local *local, 128 | struct sk_buff *skb) 129 | { 130 | /* in case we are a client verify acm is not set for this ac */ 131 | #ifdef CONFIG_ATBM_APOLLO_TESTMODE 132 | /*And if acm is set check whether the ac has been admitted */ 133 | while (unlikely((local->wmm_acm & BIT(skb->priority)) && 134 | !(local->wmm_admitted_ups & BIT(skb->priority)))) { 135 | #else 136 | while (unlikely(local->wmm_acm & BIT(skb->priority))) { 137 | #endif /*CONFIG_ATBM_APOLLO_TESTMODE*/ 138 | if (wme_downgrade_ac(skb)) { 139 | /* 140 | * This should not really happen. The AP has marked all 141 | * lower ACs to require admission control which is not 142 | * a reasonable configuration. Allow the frame to be 143 | * transmitted using AC_BK as a workaround. 144 | */ 145 | break; 146 | } 147 | } 148 | 149 | /* look up which queue to use for frames with this 1d tag */ 150 | return ieee802_1d_to_ac[skb->priority]; 151 | } 152 | 153 | void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata, 154 | struct sk_buff *skb) 155 | { 156 | struct ieee80211_hdr *hdr = (void *)skb->data; 157 | 158 | /* Fill in the QoS header if there is one. */ 159 | if (ieee80211_is_data_qos(hdr->frame_control)) { 160 | u8 *p = ieee80211_get_qos_ctl(hdr); 161 | u8 ack_policy, tid; 162 | 163 | tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; 164 | 165 | /* preserve EOSP bit */ 166 | ack_policy = *p & IEEE80211_QOS_CTL_EOSP; 167 | 168 | if (unlikely(sdata->local->wifi_wme_noack_test)) 169 | ack_policy |= IEEE80211_QOS_CTL_ACK_POLICY_NOACK; 170 | /* qos header is 2 bytes */ 171 | *p++ = ack_policy | tid; 172 | *p = ieee80211_vif_is_mesh(&sdata->vif) ? 173 | (IEEE80211_QOS_CTL_MESH_CONTROL_PRESENT >> 8) : 0; 174 | } 175 | } 176 | -------------------------------------------------------------------------------- /Makefile.build: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | PWD:=$(shell pwd) 3 | WIFI_USER_DIR := $(USER) 4 | WIFI_INSTALL_DIR := /wifi_prj/tftpboot/$(WIFI_USER_DIR)/$(PLAT)_$(SYS) 5 | 6 | 7 | NOSTDINC_FLAGS := -I$(src)/include/ \ 8 | -include $(src)/include/linux/compat-2.6.h \ 9 | -DCOMPAT_STATIC 10 | ##################################################### 11 | export 12 | MODULES_NAME = atbm_wifi 13 | CONFIG_FPGA=n 14 | CONFIG_1601=n 15 | CONFIG_1606=n 16 | CONFIG_APOLLOC=n 17 | CONFIG_APOLLOD=n 18 | CONFIG_APOLLOE=n 19 | CONFIG_ATHENAA=n 20 | CONFIG_ATHENAB=n 21 | CONFIG_ATHENAB_24M=n 22 | CONFIG_ATHENAC=n 23 | CONFIG_ATHENALITE=n 24 | CONFIG_ATHENALITE_ECO=n 25 | CONFIG_ARES=n 26 | CONFIG_ARESB=y 27 | CONFIG_HERA=n 28 | USB_BUS=y 29 | SPI_BUS=n 30 | SDIO_BUS=n 31 | TX_NO_CONFIRM=n 32 | MULT_NAME=n 33 | ATBM_MAKEFILE_SUB=y 34 | 35 | SAEAUTHEN=n 36 | LOAD_FW_H=n 37 | SKB_DEBUG=n 38 | MEM_DEBUG=n 39 | BRIDGE=n 40 | MONITOR=y 41 | EARLYSUSPEND=n 42 | CH5G=n 43 | ONLY_HT20=y 44 | USBAGGTX=y 45 | NOTXCONFIRM=y 46 | USBDMABUFF=y 47 | USBCMDENHANCE=y 48 | USBDATAENHANCE=y 49 | PMRELODDFW=n 50 | CHECKSUM=n 51 | CONFIG_NOT_SUPPORT_40M_CHW=n 52 | SWRATECTRL=n 53 | P2PENABLE=n 54 | SWENC=n 55 | CUSTORMSPECIAL=y 56 | ################################################## 57 | #ATBM6041 only use sdio 58 | ifeq ($(CONFIG_HERA),y) 59 | SDIO_BUS=y 60 | endif 61 | #CONFIG_ATBM_APOLLO_DEBUGFS=y 62 | ##################################################### 63 | export 64 | ifeq ($(CONFIG_ATBM_APOLLO),) 65 | CONFIG_ATBM_APOLLO=m 66 | endif 67 | ################### WIRELESS ######################### 68 | ##################################################### 69 | 70 | ifeq ($(CONFIG_MAC80211_DRIVER_API_TRACER),) 71 | #ccflags-y += -DCONFIG_MAC80211_DRIVER_API_TRACER=1 72 | # CONFIG_MAC80211_DRIVER_API_TRACER=y 73 | endif 74 | #ifeq ($(CONFIG_ATBM_APOLLO_TESTMODE),) 75 | #ATBM_WIFI__EXT_CCFLAGS += -DCONFIG_ATBM_APOLLO_TESTMODE=1 76 | #CONFIG_ATBM_APOLLO_TESTMODE=y 77 | #endif 78 | 79 | HMAC_SVN_REV:=$(shell ((svnversion | grep -qv exported && echo -n 'Revision: ' && svnversion) || git svn info | sed -e 's/$$$$/M/' | grep '^Revision: ' ) | sed -e 's/^Revision: //'| sed -e 's/M//g') 80 | 81 | ifeq ($(USB_BUS),y) 82 | HIF:=usb 83 | endif 84 | ifeq ($(SDIO_BUS),y) 85 | HIF:=sdio 86 | endif 87 | ifeq ($(SPI_BUS),y) 88 | HIF:=spi 89 | endif 90 | 91 | ifeq ($(CONFIG_1601),y) 92 | WIFI_INSTALL_DIR := $(WIFI_INSTALL_DIR)_1601_v$(HMAC_SVN_REV) 93 | else ifeq ($(CONFIG_1606),y) 94 | WIFI_INSTALL_DIR := $(WIFI_INSTALL_DIR)_1606_v$(HMAC_SVN_REV) 95 | else ifeq ($(CONFIG_APOLLOC),y) 96 | WIFI_INSTALL_DIR := $(WIFI_INSTALL_DIR)_apolloc_v$(HMAC_SVN_REV) 97 | else ifeq ($(CONFIG_APOLLOC),y) 98 | WIFI_INSTALL_DIR := $(WIFI_INSTALL_DIR)_apolloc_v$(HMAC_SVN_REV) 99 | else ifeq ($(CONFIG_APOLLOE),y) 100 | WIFI_INSTALL_DIR := $(WIFI_INSTALL_DIR)_apolloe_$(HIF)_v$(HMAC_SVN_REV) 101 | else ifeq ($(CONFIG_ATHENAA),y) 102 | WIFI_INSTALL_DIR := $(WIFI_INSTALL_DIR)_athenaA_$(HIF)_v$(HMAC_SVN_REV) 103 | else ifeq ($(CONFIG_ATHENAB),y) 104 | WIFI_INSTALL_DIR := $(WIFI_INSTALL_DIR)_athenaB_ko_$(HIF)_v$(HMAC_SVN_REV) 105 | else ifeq ($(CONFIG_ATHENALITE),y) 106 | WIFI_INSTALL_DIR := $(WIFI_INSTALL_DIR)_athenaLite_ko_$(HIF)_v$(HMAC_SVN_REV) 107 | else ifeq ($(CONFIG_ARES),y) 108 | WIFI_INSTALL_DIR := $(WIFI_INSTALL_DIR)_ares_ko_$(HIF)_v$(HMAC_SVN_REV) 109 | else ifeq ($(CONFIG_ATHENAB_24M),y) 110 | WIFI_INSTALL_DIR := $(WIFI_INSTALL_DIR)_athenaB_24M_ko_$(HIF)_v$(HMAC_SVN_REV) 111 | else ifeq ($(CONFIG_ARES_24M),y) 112 | WIFI_INSTALL_DIR := $(WIFI_INSTALL_DIR)_ares_24M_ko_$(HIF)_v$(HMAC_SVN_REV) 113 | else ifeq ($(CONFIG_ARESB),y) 114 | WIFI_INSTALL_DIR := $(WIFI_INSTALL_DIR)_aresB_ko_$(HIF)_v$(HMAC_SVN_REV) 115 | else ifeq ($(CONFIG_HERA),y) 116 | WIFI_INSTALL_DIR := $(WIFI_INSTALL_DIR)_hera_ko_$(HIF)_v$(HMAC_SVN_REV) 117 | else 118 | WIFI_INSTALL_DIR := $(WIFI_INSTALL_DIR)_fpga_$(HIF)_v$(HMAC_SVN_REV) 119 | endif 120 | 121 | ifeq ($(TX_NO_CONFIRM),y) 122 | WIFI_INSTALL_DIR := $(WIFI_INSTALL_DIR)_notxconfirm 123 | endif 124 | 125 | all: get_ver modules install 126 | get_ver: 127 | @echo "#define DRIVER_VER " $(HMAC_SVN_REV) >hal_apollo/svn_version.h 128 | @echo "svn version:" $(HMAC_SVN_REV) 129 | 130 | modules:clean 131 | @echo "arch=$(ARCH)" 132 | $(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KDIR) M=$(shell pwd) modules -j8 133 | # $(MAKE) -C $(KDIR) M=$(PWD) modules 134 | 135 | strip: 136 | $(CROSS_COMPILE)strip $(WIFI_INSTALL_DIR)/$(MODULES_NAME).ko --strip-unneeded 137 | 138 | install:modules 139 | mkdir -p $(WIFI_INSTALL_DIR) 140 | chmod 777 $(WIFI_INSTALL_DIR) 141 | cp hal_apollo/*.ko $(WIFI_INSTALL_DIR) 142 | 143 | uninstall: 144 | # rm -f/wifihome/tftpboot/wuping/hmac/*.ko 145 | 146 | clean:hal_clean 147 | rm -rf hal_apollo/*.o 148 | rm -rf hal_apollo/*.ko 149 | rm -rf modules.* Module.* 150 | make -C $(KDIR) M=$(PWD) ARCH=$(ARCH) clean 151 | 152 | hal_clean: 153 | rm -rf hal_apollo/*.ko 154 | rm -rf hal_apollo/*.o 155 | rm -rf hal_apollo/*.mod.c 156 | rm -rf hal_apollo/*.cmd 157 | rm -rf hal_apollo/.*.cmd 158 | rm -rf hal_apollo/mac80211/*.cmd 159 | rm -rf hal_apollo/mac80211/.*.cmd 160 | rm -rf hal_apollo/mac80211/*.o 161 | -------------------------------------------------------------------------------- /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 | #ifndef CONFIG_RATE_HW_CONTROL 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_ATBM_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_ATBM_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 atbm_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_ATBM_RC_PID 126 | extern int rc80211_pid_init(void); 127 | extern void atbm_rc80211_pid_exit(void); 128 | #else 129 | static inline int rc80211_pid_init(void) 130 | { 131 | return 0; 132 | } 133 | static inline void atbm_rc80211_pid_exit(void) 134 | { 135 | } 136 | #endif 137 | 138 | #ifdef CONFIG_MAC80211_ATBM_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_ATBM_RC_MINSTREL_HT 152 | extern int rc80211_minstrel_ht_init(void); 153 | extern void atbm_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 atbm_rc80211_minstrel_ht_exit(void) 160 | { 161 | } 162 | #endif 163 | #endif 164 | struct tagAtbmRateControl{ 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 | --------------------------------------------------------------------------------