⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 atheros_2_0_function.patch

📁 openmoko 使用的sdio wifi驱动源码
💻 PATCH
📖 第 1 页 / 共 5 页
字号:
Index: linux-2.6.24/drivers/sdio/function/Kconfig===================================================================--- /dev/null+++ linux-2.6.24/drivers/sdio/function/Kconfig@@ -0,0 +1,11 @@+#menu "SDIO function drivers"++config SDIO_AR6000_WLAN+        tristate "ar6000 wireless networking over sdio"+	depends on SDIO+        select WIRELESS_EXT+        default m+        help+          good luck.++#endmenu\ No newline at end of fileIndex: linux-2.6.24/drivers/sdio/function/Makefile===================================================================--- /dev/null+++ linux-2.6.24/drivers/sdio/function/Makefile@@ -0,0 +1 @@+obj-$(CONFIG_SDIO_AR6000_WLAN)          += wlan/\ No newline at end of fileIndex: linux-2.6.24/drivers/sdio/function/wlan/Makefile===================================================================--- /dev/null+++ linux-2.6.24/drivers/sdio/function/wlan/Makefile@@ -0,0 +1,4 @@+#+# SDIO wlan ar600 card function driver+#+obj-$(CONFIG_SDIO_AR6000_WLAN)          += ar6000/\ No newline at end of fileIndex: linux-2.6.24/drivers/sdio/function/wlan/ar6000/Makefile===================================================================--- /dev/null+++ linux-2.6.24/drivers/sdio/function/wlan/ar6000/Makefile@@ -0,0 +1,38 @@+REV ?= 2++PWD := $(shell pwd)++EXTRA_CFLAGS += -I$(src)/include++EXTRA_CFLAGS += -DLINUX -DDEBUG -D__KERNEL__ -DHTC_RAW_INTERFACE\+                -DTCMD -DSEND_EVENT_TO_APP -DUSER_KEYS \+                -DNO_SYNC_FLUSH #\+                -DMULTIPLE_FRAMES_PER_INTERRUPT -DAR6000REV$(REV) \+                -DBLOCK_TX_PATH_FLAG \+		-DSDIO \++EXTRA_CFLAGS += -DKERNEL_2_6++obj-$(CONFIG_SDIO_AR6000_WLAN) += ar6000.o++ar6000-objs += htc/ar6k.o      		   \+	       htc/ar6k_events.o 	   \+               htc/htc_send.o       	   \+               htc/htc_recv.o       	   \+               htc/htc_services.o          \+               htc/htc.o     		   \+               hif/hif.o     		   \+               bmi/bmi.o                   \+               ar6000/ar6000_drv.o         \+               ar6000/ar6000_raw_if.o	   \+               ar6000/netbuf.o		   \+               ar6000/wireless_ext.o	   \+               ar6000/ioctl.o		   \+               miscdrv/common_drv.o	   \+               miscdrv/credit_dist.o	   \+               wmi/wmi.o                   \+               wlan/wlan_node.o            \+               wlan/wlan_recv_beacon.o     \+               wlan/wlan_utils.o++Index: linux-2.6.24/drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.c===================================================================--- /dev/null+++ linux-2.6.24/drivers/sdio/function/wlan/ar6000/ar6000/ar6000_drv.c@@ -0,0 +1,3062 @@+/*+ *+ * Copyright (c) 2004-2007 Atheros Communications Inc.+ * All rights reserved.+ *+ *+ *  This program is free software; you can redistribute it and/or modify+ *  it under the terms of the GNU General Public License version 2 as+ *  published by the Free Software Foundation;+ *+ *  Software distributed under the License is distributed on an "AS+ *  IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or+ *  implied. See the License for the specific language governing+ *  rights and limitations under the License.+ *+ *+ *+ */++/*+ * This driver is a pseudo ethernet driver to access the Atheros AR6000+ * WLAN Device+ */+static const char athId[] __attribute__ ((unused)) = "$Id: //depot/sw/releases/olca2.0-GPL/host/os/linux/ar6000_drv.c#2 $";++#include "ar6000_drv.h"+#include "htc.h"++MODULE_LICENSE("GPL and additional rights");++#ifndef REORG_APTC_HEURISTICS+#undef ADAPTIVE_POWER_THROUGHPUT_CONTROL+#endif /* REORG_APTC_HEURISTICS */++#ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL+#define APTC_TRAFFIC_SAMPLING_INTERVAL     100  /* msec */+#define APTC_UPPER_THROUGHPUT_THRESHOLD    3000 /* Kbps */+#define APTC_LOWER_THROUGHPUT_THRESHOLD    2000 /* Kbps */++typedef struct aptc_traffic_record {+    A_BOOL timerScheduled;+    struct timeval samplingTS;+    unsigned long bytesReceived;+    unsigned long bytesTransmitted;+} APTC_TRAFFIC_RECORD;++A_TIMER aptcTimer;+APTC_TRAFFIC_RECORD aptcTR;+#endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */++int bmienable = 0;+unsigned int bypasswmi = 0;+unsigned int debuglevel = 0;+int tspecCompliance = 1;+unsigned int busspeedlow = 0;+unsigned int onebitmode = 0;+unsigned int skipflash = 0;+unsigned int wmitimeout = 2;+unsigned int wlanNodeCaching = 1;+unsigned int enableuartprint = 0;+unsigned int logWmiRawMsgs = 0;+unsigned int enabletimerwar = 0;+unsigned int mbox_yield_limit = 99;+int reduce_credit_dribble = 1 + HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_ONE_HALF;+int allow_trace_signal = 0;+#ifdef CONFIG_HOST_TCMD_SUPPORT+unsigned int testmode =0;+#endif++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)+module_param(bmienable, int, 0644);+module_param(bypasswmi, int, 0644);+module_param(debuglevel, int, 0644);+module_param(tspecCompliance, int, 0644);+module_param(onebitmode, int, 0644);+module_param(busspeedlow, int, 0644);+module_param(skipflash, int, 0644);+module_param(wmitimeout, int, 0644);+module_param(wlanNodeCaching, int, 0644);+module_param(logWmiRawMsgs, int, 0644);+module_param(enableuartprint, int, 0644);+module_param(enabletimerwar, int, 0644);+module_param(mbox_yield_limit, int, 0644);+module_param(reduce_credit_dribble, int, 0644);+module_param(allow_trace_signal, int, 0644);+#ifdef CONFIG_HOST_TCMD_SUPPORT+module_param(testmode, int, 0644);+#endif+#else++#define __user+/* for linux 2.4 and lower */+MODULE_PARM(bmienable,"i");+MODULE_PARM(bypasswmi,"i");+MODULE_PARM(debuglevel, "i");+MODULE_PARM(onebitmode,"i");+MODULE_PARM(busspeedlow, "i");+MODULE_PARM(skipflash, "i");+MODULE_PARM(wmitimeout, "i");+MODULE_PARM(wlanNodeCaching, "i");+MODULE_PARM(enableuartprint,"i");+MODULE_PARM(logWmiRawMsgs, "i");+MODULE_PARM(enabletimerwar,"i");+MODULE_PARM(mbox_yield_limit,"i");+MODULE_PARM(reduce_credit_dribble,"i");+MODULE_PARM(allow_trace_signal,"i");+#ifdef CONFIG_HOST_TCMD_SUPPORT+MODULE_PARM(testmode, "i");+#endif+#endif++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)+/* in 2.6.10 and later this is now a pointer to a uint */+unsigned int _mboxnum = HTC_MAILBOX_NUM_MAX;+#define mboxnum &_mboxnum+#else+unsigned int mboxnum = HTC_MAILBOX_NUM_MAX;+#endif++#ifdef DEBUG+A_UINT32 g_dbg_flags = DBG_DEFAULTS;+unsigned int debugflags = 0;+int debugdriver = 1;+unsigned int debughtc = 128;+unsigned int debugbmi = 1;+unsigned int debughif = 2;+unsigned int resetok = 1;+unsigned int txcreditsavailable[HTC_MAILBOX_NUM_MAX] = {0};+unsigned int txcreditsconsumed[HTC_MAILBOX_NUM_MAX] = {0};+unsigned int txcreditintrenable[HTC_MAILBOX_NUM_MAX] = {0};+unsigned int txcreditintrenableaggregate[HTC_MAILBOX_NUM_MAX] = {0};++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)+module_param(debugflags, int, 0644);+module_param(debugdriver, int, 0644);+module_param(debughtc, int, 0644);+module_param(debugbmi, int, 0644);+module_param(debughif, int, 0644);+module_param(resetok, int, 0644);+module_param_array(txcreditsavailable, int, mboxnum, 0644);+module_param_array(txcreditsconsumed, int, mboxnum, 0644);+module_param_array(txcreditintrenable, int, mboxnum, 0644);+module_param_array(txcreditintrenableaggregate, int, mboxnum, 0644);+#else+/* linux 2.4 and lower */+MODULE_PARM(debugflags,"i");+MODULE_PARM(debugdriver, "i");+MODULE_PARM(debughtc, "i");+MODULE_PARM(debugbmi, "i");+MODULE_PARM(debughif, "i");+MODULE_PARM(resetok, "i");+MODULE_PARM(txcreditsavailable, "0-3i");+MODULE_PARM(txcreditsconsumed, "0-3i");+MODULE_PARM(txcreditintrenable, "0-3i");+MODULE_PARM(txcreditintrenableaggregate, "0-3i");+#endif++#endif /* DEBUG */++unsigned int tx_attempt[HTC_MAILBOX_NUM_MAX] = {0};+unsigned int tx_post[HTC_MAILBOX_NUM_MAX] = {0};+unsigned int tx_complete[HTC_MAILBOX_NUM_MAX] = {0};+unsigned int hifBusRequestNumMax = 40;+unsigned int war23838_disabled = 0;+#ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL+unsigned int enableAPTCHeuristics = 1;+#endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)+module_param_array(tx_attempt, int, mboxnum, 0644);+module_param_array(tx_post, int, mboxnum, 0644);+module_param_array(tx_complete, int, mboxnum, 0644);+module_param(hifBusRequestNumMax, int, 0644);+module_param(war23838_disabled, int, 0644);+#ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL+module_param(enableAPTCHeuristics, int, 0644);+#endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */+#else+MODULE_PARM(tx_attempt, "0-3i");+MODULE_PARM(tx_post, "0-3i");+MODULE_PARM(tx_complete, "0-3i");+MODULE_PARM(hifBusRequestNumMax, "i");+MODULE_PARM(war23838_disabled, "i");+#ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL+MODULE_PARM(enableAPTCHeuristics, "i");+#endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */+#endif++#ifdef BLOCK_TX_PATH_FLAG+int blocktx = 0;+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)+module_param(blocktx, int, 0644);+#else+MODULE_PARM(blocktx, "i");+#endif+#endif /* BLOCK_TX_PATH_FLAG */++// TODO move to arsoft_c+USER_RSSI_THOLD rssi_map[12];++int reconnect_flag = 0;++DECLARE_WAIT_QUEUE_HEAD(ar6000_scan_queue);++/* Function declarations */+static int ar6000_init_module(void);+static void ar6000_cleanup_module(void);++int ar6000_init(struct net_device *dev);+static int ar6000_open(struct net_device *dev);+static int ar6000_close(struct net_device *dev);+static void ar6000_init_control_info(AR_SOFTC_T *ar);+static int ar6000_data_tx(struct sk_buff *skb, struct net_device *dev);++static void ar6000_destroy(struct net_device *dev, unsigned int unregister);+static void ar6000_detect_error(unsigned long ptr);+static struct net_device_stats *ar6000_get_stats(struct net_device *dev);+static struct iw_statistics *ar6000_get_iwstats(struct net_device * dev);++/*+ * HTC service connection handlers+ */+static void ar6000_avail_ev(HTC_HANDLE HTCHandle);++static void ar6000_unavail_ev(void *Instance);++static void ar6000_target_failure(void *Instance, A_STATUS Status);++static void ar6000_rx(void *Context, HTC_PACKET *pPacket);++static void ar6000_rx_refill(void *Context,HTC_ENDPOINT_ID Endpoint);++static void ar6000_tx_complete(void *Context, HTC_PACKET *pPacket);++static void ar6000_tx_queue_full(void *Context, HTC_ENDPOINT_ID Endpoint);++/*+ * Static variables+ */++static struct net_device *ar6000_devices[MAX_AR6000];+extern struct iw_handler_def ath_iw_handler_def;+DECLARE_WAIT_QUEUE_HEAD(arEvent);+static void ar6000_cookie_init(AR_SOFTC_T *ar);+static void ar6000_cookie_cleanup(AR_SOFTC_T *ar);+static void ar6000_free_cookie(AR_SOFTC_T *ar, struct ar_cookie * cookie);+static struct ar_cookie *ar6000_alloc_cookie(AR_SOFTC_T *ar);+static void ar6000_TxDataCleanup(AR_SOFTC_T *ar);++#ifdef USER_KEYS+static A_STATUS ar6000_reinstall_keys(AR_SOFTC_T *ar,A_UINT8 key_op_ctrl);+#endif+++static struct ar_cookie s_ar_cookie_mem[MAX_COOKIE_NUM];++#define HOST_INTEREST_ITEM_ADDRESS(ar, item)    \+((ar->arTargetType == TARGET_TYPE_AR6001) ?     \+   AR6001_HOST_INTEREST_ITEM_ADDRESS(item) :    \+   AR6002_HOST_INTEREST_ITEM_ADDRESS(item))+++/* Debug log support */++/*+ * Flag to govern whether the debug logs should be parsed in the kernel+ * or reported to the application.+ */+#define REPORT_DEBUG_LOGS_TO_APP++A_STATUS+ar6000_set_host_app_area(AR_SOFTC_T *ar)+{+    A_UINT32 address, data;+    struct host_app_area_s host_app_area;++    /* Fetch the address of the host_app_area_s instance in the host interest area */+    address = HOST_INTEREST_ITEM_ADDRESS(ar, hi_app_host_interest);+    if (ar6000_ReadRegDiag(ar->arHifDevice, &address, &data) != A_OK) {+        return A_ERROR;+    }+    address = data;+    host_app_area.wmi_protocol_ver = WMI_PROTOCOL_VERSION;+    if (ar6000_WriteDataDiag(ar->arHifDevice, address,+                             (A_UCHAR *)&host_app_area,+                             sizeof(struct host_app_area_s)) != A_OK)+    {+        return A_ERROR;+    }++    return A_OK;+}++A_UINT32+dbglog_get_debug_hdr_ptr(AR_SOFTC_T *ar)+{+    A_UINT32 param;+    A_UINT32 address;+    A_STATUS status;++    address = HOST_INTEREST_ITEM_ADDRESS(ar, hi_dbglog_hdr);+    if ((status = ar6000_ReadDataDiag(ar->arHifDevice, address,+                                      (A_UCHAR *)&param, 4)) != A_OK)+    {+        param = 0;+    }++    return param;+}++/*+ * The dbglog module has been initialized. Its ok to access the relevant+ * data stuctures over the diagnostic window.+ */+void+ar6000_dbglog_init_done(AR_SOFTC_T *ar)+{+    ar->dbglog_init_done = TRUE;+}++A_UINT32+dbglog_get_debug_fragment(A_INT8 *datap, A_UINT32 len, A_UINT32 limit)+{+    A_INT32 *buffer;+    A_UINT32 count;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -