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

📄 common_atheros_sdiostack_ar6000_wlan.patch

📁 ar6k 的WIFI驱动
💻 PATCH
📖 第 1 页 / 共 5 页
字号:
+ *  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 file contains the definitions of the basic atheros data types.+ * It is used to map the data types in atheros files to a platform specific+ * type.+ *+ */++#ifndef _OSAPI_LINUX_H_+#define _OSAPI_LINUX_H_++#include <linux/version.h>+#include <linux/types.h>+#include <linux/kernel.h>+#include <linux/string.h>+#include <linux/skbuff.h>+#include <linux/netdevice.h>+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)+#include <linux/jiffies.h>+#endif+#include <linux/timer.h>+#include <linux/delay.h>+#include <linux/wait.h>+#ifdef KERNEL_2_4+#include <asm/arch/irq.h>+#include <asm/irq.h>+#endif++/*+ * Endianes macros+ */+#define A_BE2CPU8(x)       ntohb(x)+#define A_BE2CPU16(x)      ntohs(x)+#define A_BE2CPU32(x)      ntohl(x)++#define A_LE2CPU8(x)       (x)+#define A_LE2CPU16(x)      (x)+#define A_LE2CPU32(x)      (x)++#define A_CPU2BE8(x)       htonb(x)+#define A_CPU2BE16(x)      htons(x)+#define A_CPU2BE32(x)      htonl(x)++#define A_MEMCPY(dst, src, len)         memcpy((A_UINT8 *)(dst), (src), (len))+#define A_MEMZERO(addr, len)            memset(addr, 0, len)+#define A_MEMCMP(addr1, addr2, len)     memcmp((addr1), (addr2), (len))+#define A_MALLOC(size)                  kmalloc((size), GFP_KERNEL)+#define A_MALLOC_NOWAIT(size)           kmalloc((size), GFP_ATOMIC)+#define A_FREE(addr)                    kfree(addr)+#define A_PRINTF(args...)               printk(args)++/* Mutual Exclusion */+typedef spinlock_t                      A_MUTEX_T;+#define A_MUTEX_INIT(mutex)             spin_lock_init(mutex)+#define A_MUTEX_LOCK(mutex)             spin_lock_bh(mutex)+#define A_MUTEX_UNLOCK(mutex)           spin_unlock_bh(mutex)++/*+ * Timer Functions+ */+#define A_MDELAY(msecs)                 mdelay(msecs)+typedef struct timer_list               A_TIMER;++#define A_INIT_TIMER(pTimer, pFunction, pArg) do {              \+    init_timer(pTimer);                                         \+    (pTimer)->function = (pFunction);                           \+    (pTimer)->data	 = (unsigned long)(pArg);                   \+} while (0)++/*+ * Start a Timer that elapses after 'periodMSec' milli-seconds+ * Support is provided for a one-shot timer. The 'repeatFlag' is+ * ignored.+ */+#define A_TIMEOUT_MS(pTimer, periodMSec, repeatFlag) do {                   \+    if (repeatFlag) {                                                       \+        printk("\n" __FILE__ ":%d: Timer Repeat requested\n",__LINE__);     \+        panic("Timer Repeat");                                              \+    }                                                                       \+    mod_timer((pTimer), jiffies + HZ * (periodMSec) / 1000);                \+} while (0)++/*+ * Cancel the Timer.+ */+#define A_UNTIMEOUT(pTimer) do {                                \+    del_timer((pTimer));                                        \+} while (0)++#define A_DELETE_TIMER(pTimer) do {                             \+} while (0)++/*+ * Wait Queue related functions+ */+typedef wait_queue_head_t               A_WAITQUEUE_HEAD;+#define A_INIT_WAITQUEUE_HEAD(head)     init_waitqueue_head(head)+#ifdef mvlcee31_2_4_20_omap2420_gsm_gprs+#ifndef wait_event_interruptible_timeout+#define __wait_event_interruptible_timeout(wq, condition, ret)          \+do {                                                                    \+        wait_queue_t __wait;                                            \+        init_waitqueue_entry(&__wait, current);                         \+                                                                        \+        add_wait_queue(&wq, &__wait);                                   \+        for (;;) {                                                      \+                set_current_state(TASK_INTERRUPTIBLE);                  \+                if (condition)                                          \+                        break;                                          \+                if (!signal_pending(current)) {                         \+                        ret = schedule_timeout(ret);                    \+                        if (!ret)                                       \+                                break;                                  \+                        continue;                                       \+                }                                                       \+                ret = -ERESTARTSYS;                                     \+                break;                                                  \+        }                                                               \+        current->state = TASK_RUNNING;                                  \+        remove_wait_queue(&wq, &__wait);                                \+} while (0)++#define wait_event_interruptible_timeout(wq, condition, timeout)        \+({                                                                      \+        long __ret = timeout;                                           \+        if (!(condition))                                               \+                __wait_event_interruptible_timeout(wq, condition, __ret); \+        __ret;                                                          \+})+#endif /* wait_event_interruptible_timeout */++#define A_WAIT_EVENT_INTERRUPTIBLE_TIMEOUT(head, condition, timeout) do { \+    wait_event_interruptible_timeout(head, condition, timeout); \+} while (0)+#else+#define A_WAIT_EVENT_INTERRUPTIBLE_TIMEOUT(head, condition, timeout) do { \+    wait_event_interruptible_timeout(head, condition, timeout); \+} while (0)+#endif /* mvlcee31_2_4_20-omap2420_gsm_gprs */++#define A_WAKE_UP(head)                 wake_up(head)++#ifdef DEBUG+#define A_ASSERT(expr)  \+    if (!(expr)) {   \+        printk( "\n" __FILE__ ":%d: Assertion " #expr " failed!\n",__LINE__); \+        panic(#expr); \+    }++#else+#define A_ASSERT(expr)+#endif /* DEBUG */++#endif /* _OSAPI_LINUX_H_ */Index: linux-2.6.18/drivers/sdio/function/wlan/ar6000/include/wmi_host.h===================================================================--- /dev/null+++ linux-2.6.18/drivers/sdio/function/wlan/ar6000/include/wmi_host.h@@ -0,0 +1,75 @@+/*+ * Copyright (c) 2004-2006 Atheros Communications Inc.+ *+ *  Wireless Network driver for Atheros AR6001+ *+ *  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 file contains local definitios for the wmi host module.+ *+ */++#ifndef _WMI_HOST_H_+#define _WMI_HOST_H_++#ifdef __cplusplus+extern "C" {+#endif++/*+ * IP QoS Field definitions according to 802.1p+ */+#define BEST_EFFORT_PRI         0+#define BACKGROUND_PRI          1+#define EXCELLENT_EFFORT_PRI    3+#define CONTROLLED_LOAD_PRI     4+#define VIDEO_PRI               5+#define VOICE_PRI               6+#define NETWORK_CONTROL_PRI     7++struct wmi_stats {+    A_UINT32    cmd_len_err;+    A_UINT32    cmd_id_err;+};++struct wmi_priority_state {+    A_UINT8     inUse;+    A_UINT8     mbox;+};++struct wmi_mbox_state {+    A_UINT8     trafficClass;+    A_INT8      priorityNum;+};++struct wmi_t {+    A_BOOL                          wmi_ready;+    A_BOOL                          wmi_numQoSStream;+    struct wmi_priority_state       wmi_priority[WMI_MAX_NUM_PRI_STREAMS];+    struct wmi_mbox_state           wmi_mboxMap[2][WMI_MBOX_COUNT];+    A_INT8                          wmi_trafficClassMap[2][WMM_NUM_AC];+    A_UINT8                         wmi_olderPriRxMbox;+    A_UINT8                         wmi_newerPriRxMbox;+    void                           *wmi_devt;+    struct wmi_stats                wmi_stats;+    struct ieee80211_node_table     wmi_scan_table;+    A_BOOL                          wmi_pstreamCmdInProgress[2][WMM_NUM_AC];+    A_BOOL                          wmi_cpstreamCmdInProgress;+    A_UINT8                         wmi_bssid[ATH_MAC_LEN];+    A_UINT8                         wmi_powerMode;+    A_UINT8                         wmi_phyMode;+};++#ifdef __cplusplus+}+#endif++#endif /* _WMI_HOST_H_ */Index: linux-2.6.18/drivers/sdio/function/wlan/ar6000/bmi/bmi_internal.h===================================================================--- /dev/null+++ linux-2.6.18/drivers/sdio/function/wlan/ar6000/bmi/bmi_internal.h@@ -0,0 +1,31 @@+/*+ * Copyright (c) 2004-2006 Atheros Communications Inc.+ *  Wireless Network driver for Atheros AR6001+ *+ *  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.+ *+ */+#include "../include/athdefs.h"+#include "../include/athtypes.h"+#include "../include/osapi.h"+#include "../include/hw/mbox_host_reg.h"+#include "../include/AR6000_bmi.h"++#define BMI_COMMUNICATION_TIMEOUT       100000++A_STATUS+bmiBufferSend(HIF_DEVICE *device,+              A_UCHAR *buffer,+              A_UINT32 length);++A_STATUS+bmiBufferReceive(HIF_DEVICE *device,+                 A_UCHAR *buffer,+                 A_UINT32 length);Index: linux-2.6.18/drivers/sdio/function/wlan/ar6000/hif/hif.c===================================================================--- /dev/null+++ linux-2.6.18/drivers/sdio/function/wlan/ar6000/hif/hif.c@@ -0,0 +1,664 @@+/*+ * Copyright (c) 2004-2005 Atheros Communications Inc.+ *+ *  Wireless Network driver for Atheros AR6001+ *+ *  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 file contains the routines handling the interaction with the SDIO+ * driver+ */+#include "hif_internal.h"++/* ------ Static Variables ------ */++/* ------ Global Variable Declarations ------- */+SD_PNP_INFO Ids[] = {+    {+        .SDIO_ManufacturerID = MANUFACTURER_ID_BASE | 0xB,+        .SDIO_ManufacturerCode = MANUFACTURER_CODE,+        .SDIO_FunctionClass = FUNCTION_CLASS,+        .SDIO_FunctionNo = 1+    },+    {+        .SDIO_ManufacturerID = MANUFACTURER_ID_BASE | 0xA,+        .SDIO_ManufacturerCode = MANUFACTURER_CODE,+        .SDIO_FunctionClass = FUNCTION_CLASS,+        .SDIO_FunctionNo = 1+    },+    {+        .SDIO_ManufacturerID = MANUFACTURER_ID_BASE | 0x9,+        .SDIO_ManufacturerCode = MANUFACTURER_CODE,+        .SDIO_FunctionClass = FUNCTION_CLASS,+        .SDIO_FunctionNo = 1+    },+    {+        .SDIO_ManufacturerID = MANUFACTURER_ID_BASE | 0x8,+        .SDIO_ManufacturerCode = MANUFACTURER_CODE,+        .SDIO_FunctionClass = FUNCTION_CLASS,+        .SDIO_FunctionNo = 1+    },+    {+    }                      //list is null termintaed+};++TARGET_FUNCTION_CONTEXT FunctionContext = {+    .function.Version    = CT_SDIO_STACK_VERSION_CODE,+    .function.pName      = "sdio_wlan",+    .function.MaxDevices = 1,+    .function.NumDevices = 0,+    .function.pIds       = Ids,+    .function.pProbe     = hifDeviceInserted,+    .function.pRemove    = hifDeviceRemoved,+    .function.pSuspend   = NULL,+    .function.pResume    = NULL,+    .function.pWake      = NULL,+    .function.pContext   = &FunctionContext,+};++HIF_DEVICE hifDevice[HIF_MAX_DEVICES];+HTC_CALLBACKS htcCallbacks;+BUS_REQUEST busRequest[BUS_REQUEST_MAX_NUM];+OS_CRITICALSECTION lock;+extern A_UINT32 onebitmode;+extern A_UINT32 busspeedlow;+extern A_UINT32 debughif;++#ifdef DEBUG+#define ATH_DEBUG_ERROR 1+#define ATH_DEBUG_WARN  2+#define ATH_DEBUG_TRACE 3+#define _AR_DEBUG_PRINTX_ARG(arg...) arg+#define AR_DEBUG_PRINTF(lvl, args)\+    {if (lvl <= debughif)\+        A_PRINTF(KERN_ALERT _AR_DEBUG_PRINTX_ARG args);\+    }+#else+#define AR_DEBUG_PRINTF(lvl, args)+#endif++/* ------ Functions ------ */+void+HIFRegisterCallbacks(HTC_CALLBACKS *callbacks)+{+    SDIO_STATUS status;+    DBG_ASSERT(callbacks != NULL);++    /* Store the callback and event handlers */+    htcCallbacks.deviceInsertedHandler = callbacks->deviceInsertedHandler;+    htcCallbacks.deviceRemovedHandler = callbacks->deviceRemovedHandler;+    htcCallbacks.deviceSuspendHandler = callbacks->deviceSuspendHandler;+    htcCallbacks.deviceResumeHandler = callbacks->deviceResumeHandler;+    htcCallbacks.deviceWakeupHandler = callbacks->deviceWakeupHandler;+    htcCallbacks.rwCompletionHandler = callbacks->rwCompletionHandler;+    htcCallbacks.dsrHandler = callbacks->dsrHandler;++    CriticalSectionInit(&lock);++    /* Register with bus driver core */+    status = SDIO_RegisterFunction(&FunctionContext.function);+    DBG_ASSERT(SDIO_SUCCESS(status));+}++A_STATUS+HIFReadWrite(HIF_DEVICE *device,+             A_UINT32 address,+             A_UCHAR *buffer,+             A_UINT32 length,+             HIF_REQUEST *request,+             void *context)+{+    A_UINT8 rw;+    A_UINT8 mode;+    A_UINT8 funcNo;+    A_UINT8 opcode;+    A_UINT16 count;+    SDREQUEST *sdrequest;+    SDIO_STATUS status;+    DBG_ASSERT(device != NULL);+    DBG_ASSERT(device->

⌨️ 快捷键说明

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