aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/vt6656/int.c
diff options
context:
space:
mode:
authorForest Bond <forest@alittletooquiet.net>2009-06-13 07:38:31 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-09-15 12:01:32 -0700
commit92b96797118e5836294a6d42a5a8e10b86f50e3f (patch)
tree1eceb1d70adc634da006f38c951a515de746e2c2 /drivers/staging/vt6656/int.c
parentStaging: add rt3090 wireless driver (diff)
downloadlinux-dev-92b96797118e5836294a6d42a5a8e10b86f50e3f.tar.xz
linux-dev-92b96797118e5836294a6d42a5a8e10b86f50e3f.zip
Staging: Add pristine upstream vt6656 driver sources to drivers/staging/vt6656.
Add pristine upstream vt6656 driver sources to drivers/staging/vt6656. These files were copied from the driver directory in the upstream source archive, available here: http://www.viaarena.com/Driver/VT6656_Linux_src_v1.19_12_x86.zip After copying, trailing whitespace was stripped. This is GPL-licensed code. Signed-off-by: Forest Bond <forest@alittletooquiet.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/vt6656/int.c')
-rw-r--r--drivers/staging/vt6656/int.c214
1 files changed, 214 insertions, 0 deletions
diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c
new file mode 100644
index 000000000000..158a4cc0e903
--- /dev/null
+++ b/drivers/staging/vt6656/int.c
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 1996, 2003 VIA Networking Technologies, 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 as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ *
+ * File: int.c
+ *
+ * Purpose: Handle USB interrupt endpoint
+ *
+ * Author: Jerry Chen
+ *
+ * Date: Apr. 2, 2004
+ *
+ * Functions:
+ *
+ * Revision History:
+ * 04-02-2004 Jerry Chen: Initial release
+ *
+ */
+
+
+#if !defined(__INT_H__)
+#include "int.h"
+#endif
+#if !defined(__MIB_H__)
+#include "mib.h"
+#endif
+#if !defined(__TBIT_H__)
+#include "tbit.h"
+#endif
+#if !defined(__TMACRO_H__)
+#include "tmacro.h"
+#endif
+#if !defined(__MAC_H__)
+#include "mac.h"
+#endif
+#if !defined(__POWER_H__)
+#include "power.h"
+#endif
+#if !defined(__BSSDB_H__)
+#include "bssdb.h"
+#endif
+#if !defined(__UMEM_H__)
+#include "umem.h"
+#endif
+#if !defined(__USBPIPE_H__)
+#include "usbpipe.h"
+#endif
+
+/*--------------------- Static Definitions -------------------------*/
+//static int msglevel =MSG_LEVEL_DEBUG;
+static int msglevel =MSG_LEVEL_INFO;
+
+
+/*--------------------- Static Classes ----------------------------*/
+
+/*--------------------- Static Variables --------------------------*/
+
+/*--------------------- Static Functions --------------------------*/
+
+/*--------------------- Export Variables --------------------------*/
+
+
+/*--------------------- Export Functions --------------------------*/
+
+
+/*+
+ *
+ * Function: InterruptPollingThread
+ *
+ * Synopsis: Thread running at IRQL PASSIVE_LEVEL.
+ *
+ * Arguments: Device Extension
+ *
+ * Returns:
+ *
+ * Algorithm: Call USBD for input data;
+ *
+ * History: dd-mm-yyyy Author Comment
+ *
+ *
+ * Notes:
+ *
+ * USB reads are by nature 'Blocking', and when in a read, the device looks like it's
+ * in a 'stall' condition, so we deliberately time out every second if we've gotten no data
+ *
+-*/
+VOID
+INTvWorkItem(
+ PVOID Context
+ )
+{
+ PSDevice pDevice = (PSDevice) Context;
+ NTSTATUS ntStatus;
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Interrupt Polling Thread\n");
+
+ spin_lock_irq(&pDevice->lock);
+ if (pDevice->fKillEventPollingThread != TRUE) {
+ ntStatus = PIPEnsInterruptRead(pDevice);
+ }
+ spin_unlock_irq(&pDevice->lock);
+
+ }
+
+
+NTSTATUS
+INTnsProcessData(
+ IN PSDevice pDevice
+ )
+{
+ NTSTATUS status = STATUS_SUCCESS;
+ PSINTData pINTData;
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ struct net_device_stats* pStats = &pDevice->stats;
+
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsInterruptProcessData\n");
+
+ pINTData = (PSINTData) pDevice->intBuf.pDataBuf;
+ if (BITbIsBitOn(pINTData->byTSR0, TSR_VALID)) {
+ STAvUpdateTDStatCounter (&(pDevice->scStatistic), (BYTE) (pINTData->byPkt0 & 0x0F), (BYTE) (pINTData->byPkt0>>4), pINTData->byTSR0);
+ BSSvUpdateNodeTxCounter (pDevice, &(pDevice->scStatistic), pINTData->byTSR0, pINTData->byPkt0);
+ //DBG_PRN_GRP01(("TSR0 %02x\n", pINTData->byTSR0));
+ }
+ if (BITbIsBitOn(pINTData->byTSR1, TSR_VALID)) {
+ STAvUpdateTDStatCounter (&(pDevice->scStatistic), (BYTE) (pINTData->byPkt1 & 0x0F), (BYTE) (pINTData->byPkt1>>4), pINTData->byTSR1);
+ BSSvUpdateNodeTxCounter (pDevice, &(pDevice->scStatistic), pINTData->byTSR1, pINTData->byPkt1);
+ //DBG_PRN_GRP01(("TSR1 %02x\n", pINTData->byTSR1));
+ }
+ if (BITbIsBitOn(pINTData->byTSR2, TSR_VALID)) {
+ STAvUpdateTDStatCounter (&(pDevice->scStatistic), (BYTE) (pINTData->byPkt2 & 0x0F), (BYTE) (pINTData->byPkt2>>4), pINTData->byTSR2);
+ BSSvUpdateNodeTxCounter (pDevice, &(pDevice->scStatistic), pINTData->byTSR2, pINTData->byPkt2);
+ //DBG_PRN_GRP01(("TSR2 %02x\n", pINTData->byTSR2));
+ }
+ if (BITbIsBitOn(pINTData->byTSR3, TSR_VALID)) {
+ STAvUpdateTDStatCounter (&(pDevice->scStatistic), (BYTE) (pINTData->byPkt3 & 0x0F), (BYTE) (pINTData->byPkt3>>4), pINTData->byTSR3);
+ BSSvUpdateNodeTxCounter (pDevice, &(pDevice->scStatistic), pINTData->byTSR3, pINTData->byPkt3);
+ //DBG_PRN_GRP01(("TSR3 %02x\n", pINTData->byTSR3));
+ }
+ if ( pINTData->byISR0 != 0 ) {
+ if ( BITbIsBitOn(pINTData->byISR0, ISR_BNTX) ) {
+
+ if (pDevice->eOPMode == OP_MODE_AP) {
+ if(pMgmt->byDTIMCount > 0) {
+ pMgmt->byDTIMCount --;
+ pMgmt->sNodeDBTable[0].bRxPSPoll = FALSE;
+ } else if(pMgmt->byDTIMCount == 0) {
+ // check if mutltcast tx bufferring
+ pMgmt->byDTIMCount = pMgmt->byDTIMPeriod - 1;
+ pMgmt->sNodeDBTable[0].bRxPSPoll = TRUE;
+ if (pMgmt->sNodeDBTable[0].bPSEnable) {
+ bScheduleCommand((HANDLE)pDevice, WLAN_CMD_RX_PSPOLL, NULL);
+ }
+ }
+ bScheduleCommand((HANDLE)pDevice, WLAN_CMD_BECON_SEND, NULL);
+ } // if (pDevice->eOPMode == OP_MODE_AP)
+
+ pDevice->bBeaconSent = TRUE;
+ } else {
+ pDevice->bBeaconSent = FALSE;
+ }
+ if ( BITbIsBitOn(pINTData->byISR0, ISR_TBTT) ) {
+ if ( pDevice->bEnablePSMode ) {
+ bScheduleCommand((HANDLE) pDevice, WLAN_CMD_TBTT_WAKEUP, NULL);
+ }
+ if ( pDevice->bChannelSwitch ) {
+ pDevice->byChannelSwitchCount--;
+ if ( pDevice->byChannelSwitchCount == 0 ) {
+ bScheduleCommand((HANDLE) pDevice, WLAN_CMD_11H_CHSW, NULL);
+ }
+ }
+ }
+ LODWORD(pDevice->qwCurrTSF) = pINTData->dwLoTSF;
+ HIDWORD(pDevice->qwCurrTSF) = pINTData->dwHiTSF;
+ //DBG_PRN_GRP01(("ISR0 = %02x ,LoTsf = %08x,HiTsf = %08x\n", pINTData->byISR0, pINTData->dwLoTSF,pINTData->dwHiTSF));
+
+ STAvUpdate802_11Counter(&pDevice->s802_11Counter, &pDevice->scStatistic, pINTData->byRTSSuccess,
+ pINTData->byRTSFail, pINTData->byACKFail, pINTData->byFCSErr );
+ STAvUpdateIsrStatCounter(&pDevice->scStatistic, pINTData->byISR0, pINTData->byISR1);
+
+ }
+
+ if ( pINTData->byISR1 != 0 ) {
+ if ( BITbIsBitOn(pINTData->byISR1, ISR_GPIO3) ) {
+ bScheduleCommand((HANDLE) pDevice, WLAN_CMD_RADIO, NULL);
+ }
+ }
+ pDevice->intBuf.uDataLen = 0;
+ pDevice->intBuf.bInUse = FALSE;
+
+ pStats->tx_packets = pDevice->scStatistic.ullTsrOK;
+ pStats->tx_bytes = pDevice->scStatistic.ullTxDirectedBytes +
+ pDevice->scStatistic.ullTxMulticastBytes +
+ pDevice->scStatistic.ullTxBroadcastBytes;
+ pStats->tx_errors = pDevice->scStatistic.dwTsrErr;
+ pStats->tx_dropped = pDevice->scStatistic.dwTsrErr;
+
+ return status;
+}