2 * Linux cfg80211 driver - Android related functions
4 * $Copyright Open Broadcom Corporation$
6 * $Id: wl_android.h 367305 2012-11-07 13:49:55Z $
12 #include <linux/module.h>
13 #include <linux/netdevice.h>
14 #include <wldev_common.h>
16 /* If any feature uses the Generic Netlink Interface, put it here to enable WL_GENL
25 #include <net/genetlink.h>
29 * Android platform dependent functions, feel free to add Android specific functions here
30 * (save the macros in dhd). Please do NOT declare functions that are NOT exposed to dhd
31 * or cfg, define them as static in wl_android.c
35 * wl_android_init will be called from module init function (dhd_module_init now), similarly
36 * wl_android_exit will be called from module exit function (dhd_module_cleanup now)
38 int wl_android_init(void);
39 int wl_android_exit(void);
40 void wl_android_post_init(void);
41 int wl_android_wifi_on(struct net_device *dev);
42 int wl_android_wifi_off(struct net_device *dev);
43 int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd);
44 void* wl_android_prealloc(int section, unsigned long size);
46 #if defined(CONFIG_WIFI_CONTROL_FUNC)
47 int wl_android_wifictrl_func_add(void);
48 void wl_android_wifictrl_func_del(void);
49 void* wl_android_prealloc(int section, unsigned long size);
51 int wifi_get_irq_number(unsigned long *irq_flags_ptr);
52 int wifi_set_power(int on, unsigned long msec);
53 int wifi_get_mac_addr(unsigned char *buf);
54 void *wifi_get_country_code(char *ccode);
55 #endif /* CONFIG_WIFI_CONTROL_FUNC */
58 typedef struct bcm_event_hdr {
63 /* attributes (variables): the index in this enum is used as a reference for the type,
64 * userspace application has to indicate the corresponding type
65 * the policy is used for security considerations
73 #define BCM_GENL_ATTR_MAX (__BCM_GENL_ATTR_MAX - 1)
75 /* commands: enumeration of all commands (functions),
76 * used by userspace application to identify command to be ececuted
83 #define BCM_GENL_CMD_MAX (__BCM_GENL_CMD_MAX - 1)
85 /* Enum values used by the BCM supplicant to identify the events */
94 s32 wl_genl_send_msg(struct net_device *ndev, u32 event_type,
95 u8 *string, u16 len, u8 *hdr, u16 hdrlen);
99 * BSSCACHE: Cache bss list
100 * RSSAVG: Average RSSI of BSS list
101 * RSSIOFFSET: RSSI offset
106 //#define RSSIOFFSET_NEW
108 #define RSSI_MAXVAL -2
109 #define RSSI_MINVAL -200
111 #if defined(ESCAN_RESULT_PATCH)
112 #define REPEATED_SCAN_RESULT_CNT 2
114 #define REPEATED_SCAN_RESULT_CNT 1
118 #define RSSIAVG_LEN (4*REPEATED_SCAN_RESULT_CNT)
119 #define RSSICACHE_LEN (4*REPEATED_SCAN_RESULT_CNT)
121 typedef struct wl_rssi_cache {
122 struct wl_rssi_cache *next;
124 struct ether_addr BSSID;
125 int16 RSSI[RSSIAVG_LEN];
128 typedef struct wl_rssi_cache_ctrl {
129 wl_rssi_cache_t *m_cache_head;
130 } wl_rssi_cache_ctrl_t;
132 void wl_free_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl);
133 void wl_delete_dirty_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl);
134 void wl_delete_disconnected_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, u8 *bssid);
135 void wl_reset_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl);
136 void wl_update_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, wl_scan_results_t *ss_list);
137 int wl_update_connected_rssi_cache(struct net_device *net, wl_rssi_cache_ctrl_t *rssi_cache_ctrl, int *rssi_avg);
138 int16 wl_get_avg_rssi(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, void *addr);
141 #if defined(RSSIOFFSET)
142 #define RSSI_OFFSET 5
143 #if defined(RSSIOFFSET_NEW)
144 #define RSSI_OFFSET_MAXVAL -80
145 #define RSSI_OFFSET_MINVAL -94
146 #define RSSI_OFFSET_INTVAL ((RSSI_OFFSET_MAXVAL-RSSI_OFFSET_MINVAL)/RSSI_OFFSET)
148 #define BCM4330_CHIP_ID 0x4330
149 #define BCM4330B2_CHIP_REV 4
150 int wl_update_rssi_offset(int rssi);
153 #if defined(BSSCACHE)
154 #define BSSCACHE_LEN (4*REPEATED_SCAN_RESULT_CNT)
155 #define BSSCACHE_TIME 15000
157 typedef struct wl_bss_cache {
158 struct wl_bss_cache *next;
160 wl_scan_results_t results;
163 typedef struct wl_bss_cache_ctrl {
164 wl_bss_cache_t *m_cache_head;
165 struct timer_list *m_timer;
167 } wl_bss_cache_ctrl_t;
169 void wl_free_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl);
170 void wl_delete_dirty_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl);
171 void wl_delete_disconnected_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl, u8 *bssid);
172 void wl_reset_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl);
173 void wl_update_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl, wl_scan_results_t *ss_list);
174 void wl_run_bss_cache_timer(wl_bss_cache_ctrl_t *bss_cache_ctrl, int kick_off);
175 void wl_release_bss_cache_ctrl(wl_bss_cache_ctrl_t *bss_cache_ctrl);
176 int wl_init_bss_cache_ctrl(wl_bss_cache_ctrl_t *bss_cache_ctrl);
178 #endif /* _wl_android_ */