2009-09-22 18:44:07 +00:00
/*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Ralink Tech Inc .
* 5F . , No .36 , Taiyuan St . , Jhubei City ,
* Hsinchu County 302 ,
* Taiwan , R . O . C .
*
* ( c ) Copyright 2002 - 2007 , Ralink Technology , Inc .
*
* 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 . , *
* 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA . *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Module Name :
rtusb_bulk . c
Abstract :
Revision History :
Who When What
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name Date Modification logs
*/
# include "rt_config.h"
2009-12-11 20:23:13 +00:00
void dump_urb ( struct urb * purb )
2009-09-22 18:44:07 +00:00
{
printk ( " urb :0x%08lx \n " , ( unsigned long ) purb ) ;
printk ( " \t dev :0x%08lx \n " , ( unsigned long ) purb - > dev ) ;
printk ( " \t \t dev->state :0x%d \n " , purb - > dev - > state ) ;
printk ( " \t pipe :0x%08x \n " , purb - > pipe ) ;
printk ( " \t status :%d \n " , purb - > status ) ;
printk ( " \t transfer_flags :0x%08x \n " , purb - > transfer_flags ) ;
2009-12-11 20:23:13 +00:00
printk ( " \t transfer_buffer :0x%08lx \n " ,
( unsigned long ) purb - > transfer_buffer ) ;
2009-09-22 18:44:07 +00:00
printk ( " \t transfer_buffer_length:%d \n " , purb - > transfer_buffer_length ) ;
printk ( " \t actual_length :%d \n " , purb - > actual_length ) ;
2009-12-11 20:23:13 +00:00
printk ( " \t setup_packet :0x%08lx \n " ,
( unsigned long ) purb - > setup_packet ) ;
2009-09-22 18:44:07 +00:00
printk ( " \t start_frame :%d \n " , purb - > start_frame ) ;
printk ( " \t number_of_packets :%d \n " , purb - > number_of_packets ) ;
printk ( " \t interval :%d \n " , purb - > interval ) ;
printk ( " \t error_count :%d \n " , purb - > error_count ) ;
2009-12-11 20:23:13 +00:00
printk ( " \t context :0x%08lx \n " ,
( unsigned long ) purb - > context ) ;
printk ( " \t complete :0x%08lx \n \n " ,
( unsigned long ) purb - > complete ) ;
2009-09-22 18:44:07 +00:00
}
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Routine Description :
Create kernel threads & tasklets .
Arguments :
* net_dev Pointer to wireless net device interface
Return Value :
NDIS_STATUS_SUCCESS
NDIS_STATUS_FAILURE
Note :
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
2009-12-11 20:23:16 +00:00
int RtmpMgmtTaskInit ( struct rt_rtmp_adapter * pAd )
2009-09-22 18:44:07 +00:00
{
2009-12-11 20:23:16 +00:00
struct rt_rtmp_os_task * pTask ;
2009-12-11 20:23:15 +00:00
int status ;
2009-09-22 18:44:07 +00:00
/*
2009-12-11 20:23:13 +00:00
Creat TimerQ Thread , We need init timerQ related structure before create the timer thread .
*/
2009-09-22 18:44:07 +00:00
RtmpTimerQInit ( pAd ) ;
pTask = & pAd - > timerTask ;
RtmpOSTaskInit ( pTask , " RtmpTimerTask " , pAd ) ;
status = RtmpOSTaskAttach ( pTask , RtmpTimerQThread , pTask ) ;
2009-12-11 20:23:13 +00:00
if ( status = = NDIS_STATUS_FAILURE ) {
printk ( KERN_WARNING " %s: unable to start RtmpTimerQThread \n " ,
RTMP_OS_NETDEV_GET_DEVNAME ( pAd - > net_dev ) ) ;
2009-09-22 18:44:07 +00:00
return NDIS_STATUS_FAILURE ;
}
/* Creat MLME Thread */
pTask = & pAd - > mlmeTask ;
RtmpOSTaskInit ( pTask , " RtmpMlmeTask " , pAd ) ;
status = RtmpOSTaskAttach ( pTask , MlmeThread , pTask ) ;
2009-12-11 20:23:13 +00:00
if ( status = = NDIS_STATUS_FAILURE ) {
printk ( KERN_WARNING " %s: unable to start MlmeThread \n " ,
RTMP_OS_NETDEV_GET_DEVNAME ( pAd - > net_dev ) ) ;
2009-09-22 18:44:07 +00:00
return NDIS_STATUS_FAILURE ;
}
/* Creat Command Thread */
pTask = & pAd - > cmdQTask ;
RtmpOSTaskInit ( pTask , " RtmpCmdQTask " , pAd ) ;
status = RtmpOSTaskAttach ( pTask , RTUSBCmdThread , pTask ) ;
2009-12-11 20:23:13 +00:00
if ( status = = NDIS_STATUS_FAILURE ) {
printk ( KERN_WARNING " %s: unable to start RTUSBCmdThread \n " ,
RTMP_OS_NETDEV_GET_DEVNAME ( pAd - > net_dev ) ) ;
2009-09-22 18:44:07 +00:00
return NDIS_STATUS_FAILURE ;
}
return NDIS_STATUS_SUCCESS ;
}
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Routine Description :
Close kernel threads .
Arguments :
* pAd the raxx interface data pointer
Return Value :
NONE
Note :
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
2009-12-11 20:23:16 +00:00
void RtmpMgmtTaskExit ( struct rt_rtmp_adapter * pAd )
2009-09-22 18:44:07 +00:00
{
2009-12-11 20:23:15 +00:00
int ret ;
2009-12-11 20:23:16 +00:00
struct rt_rtmp_os_task * pTask ;
2009-09-22 18:44:07 +00:00
2009-12-11 20:23:14 +00:00
/* Sleep 50 milliseconds so pending io might finish normally */
2009-09-22 18:44:07 +00:00
RTMPusecDelay ( 50000 ) ;
2009-12-11 20:23:14 +00:00
/* We want to wait until all pending receives and sends to the */
/* device object. We cancel any */
/* irps. Wait until sends and receives have stopped. */
2009-09-22 18:44:07 +00:00
RTUSBCancelPendingIRPs ( pAd ) ;
2009-12-11 20:23:14 +00:00
/* We need clear timerQ related structure before exits of the timer thread. */
2009-09-22 18:44:07 +00:00
RtmpTimerQExit ( pAd ) ;
/* Terminate Mlme Thread */
pTask = & pAd - > mlmeTask ;
ret = RtmpOSTaskKill ( pTask ) ;
2009-12-11 20:23:13 +00:00
if ( ret = = NDIS_STATUS_FAILURE ) {
2009-09-22 18:44:07 +00:00
DBGPRINT ( RT_DEBUG_ERROR , ( " %s: kill task(%s) failed! \n " ,
2009-12-11 20:23:13 +00:00
RTMP_OS_NETDEV_GET_DEVNAME ( pAd - >
net_dev ) ,
pTask - > taskName ) ) ;
2009-09-22 18:44:07 +00:00
}
/* Terminate cmdQ thread */
pTask = & pAd - > cmdQTask ;
# ifdef KTHREAD_SUPPORT
if ( pTask - > kthread_task )
# else
CHECK_PID_LEGALITY ( pTask - > taskPID )
# endif
{
mb ( ) ;
NdisAcquireSpinLock ( & pAd - > CmdQLock ) ;
pAd - > CmdQ . CmdQState = RTMP_TASK_STAT_STOPED ;
NdisReleaseSpinLock ( & pAd - > CmdQLock ) ;
mb ( ) ;
2009-12-11 20:23:14 +00:00
/*RTUSBCMDUp(pAd); */
2009-09-22 18:44:07 +00:00
ret = RtmpOSTaskKill ( pTask ) ;
2009-12-11 20:23:13 +00:00
if ( ret = = NDIS_STATUS_FAILURE ) {
2009-09-22 18:44:07 +00:00
DBGPRINT ( RT_DEBUG_ERROR , ( " %s: kill task(%s) failed! \n " ,
2009-12-11 20:23:13 +00:00
RTMP_OS_NETDEV_GET_DEVNAME
( pAd - > net_dev ) ,
pTask - > taskName ) ) ;
2009-09-22 18:44:07 +00:00
}
pAd - > CmdQ . CmdQState = RTMP_TASK_STAT_UNKNOWN ;
}
/* Terminate timer thread */
pTask = & pAd - > timerTask ;
ret = RtmpOSTaskKill ( pTask ) ;
2009-12-11 20:23:13 +00:00
if ( ret = = NDIS_STATUS_FAILURE ) {
2009-09-22 18:44:07 +00:00
DBGPRINT ( RT_DEBUG_ERROR , ( " %s: kill task(%s) failed! \n " ,
2009-12-11 20:23:13 +00:00
RTMP_OS_NETDEV_GET_DEVNAME ( pAd - >
net_dev ) ,
pTask - > taskName ) ) ;
2009-09-22 18:44:07 +00:00
}
}
static void rtusb_dataout_complete ( unsigned long data )
{
2009-12-11 20:23:16 +00:00
struct rt_rtmp_adapter * pAd ;
2009-12-11 20:23:15 +00:00
struct urb * pUrb ;
struct os_cookie * pObj ;
2009-12-11 20:23:16 +00:00
struct rt_ht_tx_context * pHTTXContext ;
2009-12-11 20:23:15 +00:00
u8 BulkOutPipeId ;
int Status ;
2009-12-11 20:23:13 +00:00
unsigned long IrqFlags ;
2009-12-11 20:23:15 +00:00
pUrb = ( struct urb * ) data ;
2009-12-11 20:23:16 +00:00
pHTTXContext = ( struct rt_ht_tx_context * ) pUrb - > context ;
2009-12-11 20:23:13 +00:00
pAd = pHTTXContext - > pAd ;
2009-12-11 20:23:15 +00:00
pObj = ( struct os_cookie * ) pAd - > OS_Cookie ;
2009-12-11 20:23:13 +00:00
Status = pUrb - > status ;
2009-09-22 18:44:07 +00:00
2009-12-11 20:23:14 +00:00
/* Store BulkOut PipeId */
2009-09-22 18:44:07 +00:00
BulkOutPipeId = pHTTXContext - > BulkOutPipeId ;
pAd - > BulkOutDataOneSecCount + + ;
2009-12-11 20:23:14 +00:00
/*DBGPRINT(RT_DEBUG_LOUD, ("Done-B(%d):I=0x%lx, CWPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d!\n", BulkOutPipeId, in_interrupt(), pHTTXContext->CurWritePosition, */
/* pHTTXContext->NextBulkOutPosition, pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad)); */
2009-09-22 18:44:07 +00:00
RTMP_IRQ_LOCK ( & pAd - > BulkOutLock [ BulkOutPipeId ] , IrqFlags ) ;
pAd - > BulkOutPending [ BulkOutPipeId ] = FALSE ;
pHTTXContext - > IRPPending = FALSE ;
pAd - > watchDogTxPendingCnt [ BulkOutPipeId ] = 0 ;
2009-12-11 20:23:13 +00:00
if ( Status = = USB_ST_NOERROR ) {
2009-09-22 18:44:07 +00:00
pAd - > BulkOutComplete + + ;
RTMP_IRQ_UNLOCK ( & pAd - > BulkOutLock [ BulkOutPipeId ] , IrqFlags ) ;
pAd - > Counters8023 . GoodTransmits + + ;
2009-12-11 20:23:14 +00:00
/*RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); */
2009-09-22 18:44:07 +00:00
FREE_HTTX_RING ( pAd , BulkOutPipeId , pHTTXContext ) ;
2009-12-11 20:23:14 +00:00
/*RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); */
2009-09-22 18:44:07 +00:00
2009-12-11 20:23:14 +00:00
} else /* STATUS_OTHER */
2009-09-22 18:44:07 +00:00
{
2009-12-11 20:23:15 +00:00
u8 * pBuf ;
2009-09-22 18:44:07 +00:00
pAd - > BulkOutCompleteOther + + ;
2009-12-11 20:23:13 +00:00
pBuf =
& pHTTXContext - > TransferBuffer - > field .
WirelessPacket [ pHTTXContext - > NextBulkOutPosition ] ;
2009-09-22 18:44:07 +00:00
if ( ! RTMP_TEST_FLAG ( pAd , ( fRTMP_ADAPTER_RESET_IN_PROGRESS |
2009-12-11 20:23:13 +00:00
fRTMP_ADAPTER_HALT_IN_PROGRESS |
fRTMP_ADAPTER_NIC_NOT_EXIST |
fRTMP_ADAPTER_BULKOUT_RESET ) ) ) {
2009-09-22 18:44:07 +00:00
RTMP_SET_FLAG ( pAd , fRTMP_ADAPTER_BULKOUT_RESET ) ;
pAd - > bulkResetPipeid = BulkOutPipeId ;
pAd - > bulkResetReq [ BulkOutPipeId ] = pAd - > BulkOutReq ;
}
RTMP_IRQ_UNLOCK ( & pAd - > BulkOutLock [ BulkOutPipeId ] , IrqFlags ) ;
2009-12-11 20:23:13 +00:00
DBGPRINT_RAW ( RT_DEBUG_ERROR ,
( " BulkOutDataPacket failed: ReasonCode=%d! \n " ,
Status ) ) ;
DBGPRINT_RAW ( RT_DEBUG_ERROR ,
( " \t >>BulkOut Req=0x%lx, Complete=0x%lx, Other=0x%lx \n " ,
pAd - > BulkOutReq , pAd - > BulkOutComplete ,
pAd - > BulkOutCompleteOther ) ) ;
DBGPRINT_RAW ( RT_DEBUG_ERROR ,
( " \t >>BulkOut Header:%x %x %x %x %x %x %x %x \n " ,
pBuf [ 0 ] , pBuf [ 1 ] , pBuf [ 2 ] , pBuf [ 3 ] , pBuf [ 4 ] ,
pBuf [ 5 ] , pBuf [ 6 ] , pBuf [ 7 ] ) ) ;
2009-12-11 20:23:14 +00:00
/*DBGPRINT_RAW(RT_DEBUG_ERROR, (">>BulkOutCompleteCancel=0x%x, BulkOutCompleteOther=0x%x\n", pAd->BulkOutCompleteCancel, pAd->BulkOutCompleteOther)); */
2009-09-22 18:44:07 +00:00
}
2009-12-11 20:23:14 +00:00
/* */
/* bInUse = TRUE, means some process are filling TX data, after that must turn on bWaitingBulkOut */
/* bWaitingBulkOut = TRUE, means the TX data are waiting for bulk out. */
/* */
/*RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); */
2009-12-11 20:23:13 +00:00
if ( ( pHTTXContext - > ENextBulkOutPosition ! =
pHTTXContext - > CurWritePosition )
& & ( pHTTXContext - > ENextBulkOutPosition ! =
( pHTTXContext - > CurWritePosition + 8 ) )
& & ! RTUSB_TEST_BULK_FLAG ( pAd ,
( fRTUSB_BULK_OUT_DATA_FRAG < <
BulkOutPipeId ) ) ) {
2009-12-11 20:23:14 +00:00
/* Indicate There is data avaliable */
2009-12-11 20:23:13 +00:00
RTUSB_SET_BULK_FLAG ( pAd ,
( fRTUSB_BULK_OUT_DATA_NORMAL < <
BulkOutPipeId ) ) ;
2009-09-22 18:44:07 +00:00
}
2009-12-11 20:23:14 +00:00
/*RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags); */
2009-09-22 18:44:07 +00:00
2009-12-11 20:23:14 +00:00
/* Always call Bulk routine, even reset bulk. */
/* The protection of rest bulk should be in BulkOut routine */
2009-09-22 18:44:07 +00:00
RTUSBKickBulkOut ( pAd ) ;
}
static void rtusb_null_frame_done_tasklet ( unsigned long data )
{
2009-12-11 20:23:16 +00:00
struct rt_rtmp_adapter * pAd ;
struct rt_tx_context * pNullContext ;
2009-12-11 20:23:15 +00:00
struct urb * pUrb ;
2009-12-11 20:23:15 +00:00
int Status ;
2009-12-11 20:23:13 +00:00
unsigned long irqFlag ;
2009-12-11 20:23:15 +00:00
pUrb = ( struct urb * ) data ;
2009-12-11 20:23:16 +00:00
pNullContext = ( struct rt_tx_context * ) pUrb - > context ;
2009-12-11 20:23:13 +00:00
pAd = pNullContext - > pAd ;
Status = pUrb - > status ;
2009-09-22 18:44:07 +00:00
2009-12-11 20:23:14 +00:00
/* Reset Null frame context flags */
2009-09-22 18:44:07 +00:00
RTMP_IRQ_LOCK ( & pAd - > BulkOutLock [ 0 ] , irqFlag ) ;
2009-12-11 20:23:13 +00:00
pNullContext - > IRPPending = FALSE ;
pNullContext - > InUse = FALSE ;
2009-09-22 18:44:07 +00:00
pAd - > BulkOutPending [ 0 ] = FALSE ;
pAd - > watchDogTxPendingCnt [ 0 ] = 0 ;
2009-12-11 20:23:13 +00:00
if ( Status = = USB_ST_NOERROR ) {
2009-09-22 18:44:07 +00:00
RTMP_IRQ_UNLOCK ( & pAd - > BulkOutLock [ 0 ] , irqFlag ) ;
RTMPDeQueuePacket ( pAd , FALSE , NUM_OF_TX_RING , MAX_TX_PROCESS ) ;
2009-12-11 20:23:14 +00:00
} else /* STATUS_OTHER */
2009-09-22 18:44:07 +00:00
{
if ( ( ! RTMP_TEST_FLAG ( pAd , fRTMP_ADAPTER_RESET_IN_PROGRESS ) ) & &
2009-12-11 20:23:13 +00:00
( ! RTMP_TEST_FLAG ( pAd , fRTMP_ADAPTER_HALT_IN_PROGRESS ) ) & &
( ! RTMP_TEST_FLAG ( pAd , fRTMP_ADAPTER_NIC_NOT_EXIST ) ) & &
( ! RTMP_TEST_FLAG ( pAd , fRTMP_ADAPTER_BULKOUT_RESET ) ) ) {
DBGPRINT_RAW ( RT_DEBUG_ERROR ,
( " Bulk Out Null Frame Failed, ReasonCode=%d! \n " ,
Status ) ) ;
2009-09-22 18:44:07 +00:00
RTMP_SET_FLAG ( pAd , fRTMP_ADAPTER_BULKOUT_RESET ) ;
2009-12-11 20:23:13 +00:00
pAd - > bulkResetPipeid =
( MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG ) ;
2009-09-22 18:44:07 +00:00
RTMP_IRQ_UNLOCK ( & pAd - > BulkOutLock [ 0 ] , irqFlag ) ;
2009-12-11 20:23:13 +00:00
RTUSBEnqueueInternalCmd ( pAd , CMDTHREAD_RESET_BULK_OUT ,
NULL , 0 ) ;
} else {
2009-09-22 18:44:07 +00:00
RTMP_IRQ_UNLOCK ( & pAd - > BulkOutLock [ 0 ] , irqFlag ) ;
}
}
2009-12-11 20:23:14 +00:00
/* Always call Bulk routine, even reset bulk. */
/* The protectioon of rest bulk should be in BulkOut routine */
2009-09-22 18:44:07 +00:00
RTUSBKickBulkOut ( pAd ) ;
}
static void rtusb_rts_frame_done_tasklet ( unsigned long data )
{
2009-12-11 20:23:16 +00:00
struct rt_rtmp_adapter * pAd ;
struct rt_tx_context * pRTSContext ;
2009-12-11 20:23:15 +00:00
struct urb * pUrb ;
2009-12-11 20:23:15 +00:00
int Status ;
2009-12-11 20:23:13 +00:00
unsigned long irqFlag ;
2009-12-11 20:23:15 +00:00
pUrb = ( struct urb * ) data ;
2009-12-11 20:23:16 +00:00
pRTSContext = ( struct rt_tx_context * ) pUrb - > context ;
2009-12-11 20:23:13 +00:00
pAd = pRTSContext - > pAd ;
Status = pUrb - > status ;
2009-09-22 18:44:07 +00:00
2009-12-11 20:23:14 +00:00
/* Reset RTS frame context flags */
2009-09-22 18:44:07 +00:00
RTMP_IRQ_LOCK ( & pAd - > BulkOutLock [ 0 ] , irqFlag ) ;
pRTSContext - > IRPPending = FALSE ;
2009-12-11 20:23:13 +00:00
pRTSContext - > InUse = FALSE ;
2009-09-22 18:44:07 +00:00
2009-12-11 20:23:13 +00:00
if ( Status = = USB_ST_NOERROR ) {
2009-09-22 18:44:07 +00:00
RTMP_IRQ_UNLOCK ( & pAd - > BulkOutLock [ 0 ] , irqFlag ) ;
RTMPDeQueuePacket ( pAd , FALSE , NUM_OF_TX_RING , MAX_TX_PROCESS ) ;
2009-12-11 20:23:14 +00:00
} else /* STATUS_OTHER */
2009-09-22 18:44:07 +00:00
{
if ( ( ! RTMP_TEST_FLAG ( pAd , fRTMP_ADAPTER_RESET_IN_PROGRESS ) ) & &
2009-12-11 20:23:13 +00:00
( ! RTMP_TEST_FLAG ( pAd , fRTMP_ADAPTER_HALT_IN_PROGRESS ) ) & &
( ! RTMP_TEST_FLAG ( pAd , fRTMP_ADAPTER_NIC_NOT_EXIST ) ) & &
( ! RTMP_TEST_FLAG ( pAd , fRTMP_ADAPTER_BULKOUT_RESET ) ) ) {
DBGPRINT_RAW ( RT_DEBUG_ERROR ,
( " Bulk Out RTS Frame Failed \n " ) ) ;
2009-09-22 18:44:07 +00:00
RTMP_SET_FLAG ( pAd , fRTMP_ADAPTER_BULKOUT_RESET ) ;
2009-12-11 20:23:13 +00:00
pAd - > bulkResetPipeid =
( MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG ) ;
2009-09-22 18:44:07 +00:00
RTMP_IRQ_UNLOCK ( & pAd - > BulkOutLock [ 0 ] , irqFlag ) ;
2009-12-11 20:23:13 +00:00
RTUSBEnqueueInternalCmd ( pAd , CMDTHREAD_RESET_BULK_OUT ,
NULL , 0 ) ;
} else {
2009-09-22 18:44:07 +00:00
RTMP_IRQ_UNLOCK ( & pAd - > BulkOutLock [ 0 ] , irqFlag ) ;
}
}
RTMP_SEM_LOCK ( & pAd - > BulkOutLock [ pRTSContext - > BulkOutPipeId ] ) ;
pAd - > BulkOutPending [ pRTSContext - > BulkOutPipeId ] = FALSE ;
RTMP_SEM_UNLOCK ( & pAd - > BulkOutLock [ pRTSContext - > BulkOutPipeId ] ) ;
2009-12-11 20:23:14 +00:00
/* Always call Bulk routine, even reset bulk. */
/* The protectioon of rest bulk should be in BulkOut routine */
2009-09-22 18:44:07 +00:00
RTUSBKickBulkOut ( pAd ) ;
}
static void rtusb_pspoll_frame_done_tasklet ( unsigned long data )
{
2009-12-11 20:23:16 +00:00
struct rt_rtmp_adapter * pAd ;
struct rt_tx_context * pPsPollContext ;
2009-12-11 20:23:15 +00:00
struct urb * pUrb ;
2009-12-11 20:23:15 +00:00
int Status ;
2009-12-11 20:23:13 +00:00
2009-12-11 20:23:15 +00:00
pUrb = ( struct urb * ) data ;
2009-12-11 20:23:16 +00:00
pPsPollContext = ( struct rt_tx_context * ) pUrb - > context ;
2009-12-11 20:23:13 +00:00
pAd = pPsPollContext - > pAd ;
Status = pUrb - > status ;
2009-09-22 18:44:07 +00:00
2009-12-11 20:23:14 +00:00
/* Reset PsPoll context flags */
2009-12-11 20:23:13 +00:00
pPsPollContext - > IRPPending = FALSE ;
pPsPollContext - > InUse = FALSE ;
2009-09-22 18:44:07 +00:00
pAd - > watchDogTxPendingCnt [ 0 ] = 0 ;
2009-12-11 20:23:13 +00:00
if ( Status = = USB_ST_NOERROR ) {
2009-09-22 18:44:07 +00:00
RTMPDeQueuePacket ( pAd , FALSE , NUM_OF_TX_RING , MAX_TX_PROCESS ) ;
2009-12-11 20:23:14 +00:00
} else /* STATUS_OTHER */
2009-09-22 18:44:07 +00:00
{
if ( ( ! RTMP_TEST_FLAG ( pAd , fRTMP_ADAPTER_RESET_IN_PROGRESS ) ) & &
2009-12-11 20:23:13 +00:00
( ! RTMP_TEST_FLAG ( pAd , fRTMP_ADAPTER_HALT_IN_PROGRESS ) ) & &
( ! RTMP_TEST_FLAG ( pAd , fRTMP_ADAPTER_NIC_NOT_EXIST ) ) & &
( ! RTMP_TEST_FLAG ( pAd , fRTMP_ADAPTER_BULKOUT_RESET ) ) ) {
DBGPRINT_RAW ( RT_DEBUG_ERROR ,
( " Bulk Out PSPoll Failed \n " ) ) ;
2009-09-22 18:44:07 +00:00
RTMP_SET_FLAG ( pAd , fRTMP_ADAPTER_BULKOUT_RESET ) ;
2009-12-11 20:23:13 +00:00
pAd - > bulkResetPipeid =
( MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG ) ;
RTUSBEnqueueInternalCmd ( pAd , CMDTHREAD_RESET_BULK_OUT ,
NULL , 0 ) ;
2009-09-22 18:44:07 +00:00
}
}
RTMP_SEM_LOCK ( & pAd - > BulkOutLock [ 0 ] ) ;
pAd - > BulkOutPending [ 0 ] = FALSE ;
RTMP_SEM_UNLOCK ( & pAd - > BulkOutLock [ 0 ] ) ;
2009-12-11 20:23:14 +00:00
/* Always call Bulk routine, even reset bulk. */
/* The protectioon of rest bulk should be in BulkOut routine */
2009-09-22 18:44:07 +00:00
RTUSBKickBulkOut ( pAd ) ;
}
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Routine Description :
Handle received packets .
Arguments :
data - URB information pointer
Return Value :
None
Note :
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
static void rx_done_tasklet ( unsigned long data )
{
2009-12-11 20:23:15 +00:00
struct urb * pUrb ;
2009-12-11 20:23:16 +00:00
struct rt_rx_context * pRxContext ;
struct rt_rtmp_adapter * pAd ;
2009-12-11 20:23:15 +00:00
int Status ;
2009-12-11 20:23:13 +00:00
unsigned int IrqFlags ;
2009-12-11 20:23:15 +00:00
pUrb = ( struct urb * ) data ;
2009-12-11 20:23:16 +00:00
pRxContext = ( struct rt_rx_context * ) pUrb - > context ;
2009-12-11 20:23:13 +00:00
pAd = pRxContext - > pAd ;
2009-09-22 18:44:07 +00:00
Status = pUrb - > status ;
RTMP_IRQ_LOCK ( & pAd - > BulkInLock , IrqFlags ) ;
pRxContext - > InUse = FALSE ;
pRxContext - > IRPPending = FALSE ;
pRxContext - > BulkInOffset + = pUrb - > actual_length ;
2009-12-11 20:23:14 +00:00
/*NdisInterlockedDecrement(&pAd->PendingRx); */
2009-09-22 18:44:07 +00:00
pAd - > PendingRx - - ;
2009-12-11 20:23:13 +00:00
if ( Status = = USB_ST_NOERROR ) {
2009-09-22 18:44:07 +00:00
pAd - > BulkInComplete + + ;
pAd - > NextRxBulkInPosition = 0 ;
2009-12-11 20:23:14 +00:00
if ( pRxContext - > BulkInOffset ) /* As jan's comment, it may bulk-in success but size is zero. */
2009-09-22 18:44:07 +00:00
{
pRxContext - > Readable = TRUE ;
INC_RING_INDEX ( pAd - > NextRxBulkInIndex , RX_RING_SIZE ) ;
}
RTMP_IRQ_UNLOCK ( & pAd - > BulkInLock , IrqFlags ) ;
2009-12-11 20:23:14 +00:00
} else /* STATUS_OTHER */
2009-09-22 18:44:07 +00:00
{
pAd - > BulkInCompleteFail + + ;
2009-12-11 20:23:14 +00:00
/* Still read this packet although it may comtain wrong bytes. */
2009-09-22 18:44:07 +00:00
pRxContext - > Readable = FALSE ;
RTMP_IRQ_UNLOCK ( & pAd - > BulkInLock , IrqFlags ) ;
2009-12-11 20:23:14 +00:00
/* Parsing all packets. because after reset, the index will reset to all zero. */
2009-09-22 18:44:07 +00:00
if ( ( ! RTMP_TEST_FLAG ( pAd , ( fRTMP_ADAPTER_RESET_IN_PROGRESS |
2009-12-11 20:23:13 +00:00
fRTMP_ADAPTER_BULKIN_RESET |
fRTMP_ADAPTER_HALT_IN_PROGRESS |
fRTMP_ADAPTER_NIC_NOT_EXIST ) ) ) ) {
2009-09-22 18:44:07 +00:00
2009-12-11 20:23:13 +00:00
DBGPRINT_RAW ( RT_DEBUG_ERROR ,
( " Bulk In Failed. Status=%d, BIIdx=0x%x, BIRIdx=0x%x, actual_length= 0x%x \n " ,
Status , pAd - > NextRxBulkInIndex ,
pAd - > NextRxBulkInReadIndex ,
pRxContext - > pUrb - > actual_length ) ) ;
2009-09-22 18:44:07 +00:00
RTMP_SET_FLAG ( pAd , fRTMP_ADAPTER_BULKIN_RESET ) ;
2009-12-11 20:23:13 +00:00
RTUSBEnqueueInternalCmd ( pAd , CMDTHREAD_RESET_BULK_IN ,
NULL , 0 ) ;
2009-09-22 18:44:07 +00:00
}
}
ASSERT ( ( pRxContext - > InUse = = pRxContext - > IRPPending ) ) ;
RTUSBBulkReceive ( pAd ) ;
return ;
}
static void rtusb_mgmt_dma_done_tasklet ( unsigned long data )
{
2009-12-11 20:23:16 +00:00
struct rt_rtmp_adapter * pAd ;
struct rt_tx_context * pMLMEContext ;
2009-12-11 20:23:13 +00:00
int index ;
2009-12-11 20:23:15 +00:00
void * pPacket ;
struct urb * pUrb ;
2009-12-11 20:23:15 +00:00
int Status ;
2009-12-11 20:23:13 +00:00
unsigned long IrqFlags ;
2009-12-11 20:23:15 +00:00
pUrb = ( struct urb * ) data ;
2009-12-11 20:23:16 +00:00
pMLMEContext = ( struct rt_tx_context * ) pUrb - > context ;
2009-12-11 20:23:13 +00:00
pAd = pMLMEContext - > pAd ;
Status = pUrb - > status ;
index = pMLMEContext - > SelfIdx ;
2009-09-22 18:44:07 +00:00
ASSERT ( ( pAd - > MgmtRing . TxDmaIdx = = index ) ) ;
RTMP_IRQ_LOCK ( & pAd - > BulkOutLock [ MGMTPIPEIDX ] , IrqFlags ) ;
2009-12-11 20:23:13 +00:00
if ( Status ! = USB_ST_NOERROR ) {
2009-12-11 20:23:14 +00:00
/*Bulk-Out fail status handle */
2009-09-22 18:44:07 +00:00
if ( ( ! RTMP_TEST_FLAG ( pAd , fRTMP_ADAPTER_RESET_IN_PROGRESS ) ) & &
2009-12-11 20:23:13 +00:00
( ! RTMP_TEST_FLAG ( pAd , fRTMP_ADAPTER_HALT_IN_PROGRESS ) ) & &
( ! RTMP_TEST_FLAG ( pAd , fRTMP_ADAPTER_NIC_NOT_EXIST ) ) & &
( ! RTMP_TEST_FLAG ( pAd , fRTMP_ADAPTER_BULKOUT_RESET ) ) ) {
DBGPRINT_RAW ( RT_DEBUG_ERROR ,
( " Bulk Out MLME Failed, Status=%d! \n " ,
Status ) ) ;
2009-12-11 20:23:14 +00:00
/* TODO: How to handle about the MLMEBulkOut failed issue. Need to resend the mgmt pkt? */
2009-09-22 18:44:07 +00:00
RTMP_SET_FLAG ( pAd , fRTMP_ADAPTER_BULKOUT_RESET ) ;
2009-12-11 20:23:13 +00:00
pAd - > bulkResetPipeid =
( MGMTPIPEIDX | BULKOUT_MGMT_RESET_FLAG ) ;
2009-09-22 18:44:07 +00:00
}
}
pAd - > BulkOutPending [ MGMTPIPEIDX ] = FALSE ;
RTMP_IRQ_UNLOCK ( & pAd - > BulkOutLock [ MGMTPIPEIDX ] , IrqFlags ) ;
RTMP_IRQ_LOCK ( & pAd - > MLMEBulkOutLock , IrqFlags ) ;
2009-12-11 20:23:14 +00:00
/* Reset MLME context flags */
2009-09-22 18:44:07 +00:00
pMLMEContext - > IRPPending = FALSE ;
pMLMEContext - > InUse = FALSE ;
pMLMEContext - > bWaitingBulkOut = FALSE ;
pMLMEContext - > BulkOutSize = 0 ;
pPacket = pAd - > MgmtRing . Cell [ index ] . pNdisPacket ;
pAd - > MgmtRing . Cell [ index ] . pNdisPacket = NULL ;
2009-12-11 20:23:14 +00:00
/* Increase MgmtRing Index */
2009-09-22 18:44:07 +00:00
INC_RING_INDEX ( pAd - > MgmtRing . TxDmaIdx , MGMT_RING_SIZE ) ;
pAd - > MgmtRing . TxSwFreeIdx + + ;
RTMP_IRQ_UNLOCK ( & pAd - > MLMEBulkOutLock , IrqFlags ) ;
2009-12-11 20:23:14 +00:00
/* No-matter success or fail, we free the mgmt packet. */
2009-09-22 18:44:07 +00:00
if ( pPacket )
RTMPFreeNdisPacket ( pAd , pPacket ) ;
if ( ( RTMP_TEST_FLAG ( pAd , ( fRTMP_ADAPTER_RESET_IN_PROGRESS |
2009-12-11 20:23:13 +00:00
fRTMP_ADAPTER_HALT_IN_PROGRESS |
fRTMP_ADAPTER_NIC_NOT_EXIST ) ) ) ) {
2009-12-11 20:23:14 +00:00
/* do nothing and return directly. */
2009-12-11 20:23:13 +00:00
} else {
2009-12-11 20:23:14 +00:00
if ( RTMP_TEST_FLAG ( pAd , fRTMP_ADAPTER_BULKOUT_RESET ) & & ( ( pAd - > bulkResetPipeid & BULKOUT_MGMT_RESET_FLAG ) = = BULKOUT_MGMT_RESET_FLAG ) ) { /* For Mgmt Bulk-Out failed, ignore it now. */
2009-12-11 20:23:13 +00:00
RTUSBEnqueueInternalCmd ( pAd , CMDTHREAD_RESET_BULK_OUT ,
NULL , 0 ) ;
} else {
2009-09-22 18:44:07 +00:00
2009-12-11 20:23:14 +00:00
/* Always call Bulk routine, even reset bulk. */
/* The protectioon of rest bulk should be in BulkOut routine */
2009-12-11 20:23:13 +00:00
if ( pAd - > MgmtRing . TxSwFreeIdx <
MGMT_RING_SIZE
/* pMLMEContext->bWaitingBulkOut == TRUE */ ) {
2009-09-22 18:44:07 +00:00
RTUSB_SET_BULK_FLAG ( pAd , fRTUSB_BULK_OUT_MLME ) ;
}
2009-12-11 20:23:13 +00:00
RTUSBKickBulkOut ( pAd ) ;
2009-09-22 18:44:07 +00:00
}
2009-12-11 20:23:13 +00:00
}
2009-09-22 18:44:07 +00:00
}
static void rtusb_ac3_dma_done_tasklet ( unsigned long data )
{
2009-12-11 20:23:16 +00:00
struct rt_rtmp_adapter * pAd ;
struct rt_ht_tx_context * pHTTXContext ;
2009-12-11 20:23:15 +00:00
u8 BulkOutPipeId = 3 ;
2009-12-11 20:23:15 +00:00
struct urb * pUrb ;
2009-09-22 18:44:07 +00:00
2009-12-11 20:23:15 +00:00
pUrb = ( struct urb * ) data ;
2009-12-11 20:23:16 +00:00
pHTTXContext = ( struct rt_ht_tx_context * ) pUrb - > context ;
2009-12-11 20:23:13 +00:00
pAd = pHTTXContext - > pAd ;
2009-09-22 18:44:07 +00:00
rtusb_dataout_complete ( ( unsigned long ) pUrb ) ;
if ( ( RTMP_TEST_FLAG ( pAd , ( fRTMP_ADAPTER_RESET_IN_PROGRESS |
2009-12-11 20:23:13 +00:00
fRTMP_ADAPTER_HALT_IN_PROGRESS |
fRTMP_ADAPTER_NIC_NOT_EXIST ) ) ) ) {
2009-12-11 20:23:14 +00:00
/* do nothing and return directly. */
2009-12-11 20:23:13 +00:00
} else {
if ( RTMP_TEST_FLAG ( pAd , fRTMP_ADAPTER_BULKOUT_RESET ) ) {
RTUSBEnqueueInternalCmd ( pAd , CMDTHREAD_RESET_BULK_OUT ,
NULL , 0 ) ;
} else {
pHTTXContext = & pAd - > TxContext [ BulkOutPipeId ] ;
2009-09-22 18:44:07 +00:00
if ( ( pAd - > TxSwQueue [ BulkOutPipeId ] . Number > 0 ) & &
2009-12-11 20:23:13 +00:00
/*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */
( pAd - > DeQueueRunning [ BulkOutPipeId ] = = FALSE ) & &
( pHTTXContext - > bCurWriting = = FALSE ) ) {
RTMPDeQueuePacket ( pAd , FALSE , BulkOutPipeId ,
MAX_TX_PROCESS ) ;
2009-09-22 18:44:07 +00:00
}
2009-12-11 20:23:13 +00:00
RTUSB_SET_BULK_FLAG ( pAd ,
fRTUSB_BULK_OUT_DATA_NORMAL < < 3 ) ;
2009-09-22 18:44:07 +00:00
RTUSBKickBulkOut ( pAd ) ;
}
}
return ;
}
static void rtusb_ac2_dma_done_tasklet ( unsigned long data )
{
2009-12-11 20:23:16 +00:00
struct rt_rtmp_adapter * pAd ;
struct rt_ht_tx_context * pHTTXContext ;
2009-12-11 20:23:15 +00:00
u8 BulkOutPipeId = 2 ;
2009-12-11 20:23:15 +00:00
struct urb * pUrb ;
2009-09-22 18:44:07 +00:00
2009-12-11 20:23:15 +00:00
pUrb = ( struct urb * ) data ;
2009-12-11 20:23:16 +00:00
pHTTXContext = ( struct rt_ht_tx_context * ) pUrb - > context ;
2009-12-11 20:23:13 +00:00
pAd = pHTTXContext - > pAd ;
2009-09-22 18:44:07 +00:00
rtusb_dataout_complete ( ( unsigned long ) pUrb ) ;
if ( ( RTMP_TEST_FLAG ( pAd , ( fRTMP_ADAPTER_RESET_IN_PROGRESS |
2009-12-11 20:23:13 +00:00
fRTMP_ADAPTER_HALT_IN_PROGRESS |
fRTMP_ADAPTER_NIC_NOT_EXIST ) ) ) ) {
2009-12-11 20:23:14 +00:00
/* do nothing and return directly. */
2009-12-11 20:23:13 +00:00
} else {
if ( RTMP_TEST_FLAG ( pAd , fRTMP_ADAPTER_BULKOUT_RESET ) ) {
RTUSBEnqueueInternalCmd ( pAd , CMDTHREAD_RESET_BULK_OUT ,
NULL , 0 ) ;
} else {
pHTTXContext = & pAd - > TxContext [ BulkOutPipeId ] ;
2009-09-22 18:44:07 +00:00
if ( ( pAd - > TxSwQueue [ BulkOutPipeId ] . Number > 0 ) & &
2009-12-11 20:23:13 +00:00
/*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */
( pAd - > DeQueueRunning [ BulkOutPipeId ] = = FALSE ) & &
( pHTTXContext - > bCurWriting = = FALSE ) ) {
RTMPDeQueuePacket ( pAd , FALSE , BulkOutPipeId ,
MAX_TX_PROCESS ) ;
2009-09-22 18:44:07 +00:00
}
2009-12-11 20:23:13 +00:00
RTUSB_SET_BULK_FLAG ( pAd ,
fRTUSB_BULK_OUT_DATA_NORMAL < < 2 ) ;
2009-09-22 18:44:07 +00:00
RTUSBKickBulkOut ( pAd ) ;
}
}
return ;
}
static void rtusb_ac1_dma_done_tasklet ( unsigned long data )
{
2009-12-11 20:23:16 +00:00
struct rt_rtmp_adapter * pAd ;
struct rt_ht_tx_context * pHTTXContext ;
2009-12-11 20:23:15 +00:00
u8 BulkOutPipeId = 1 ;
2009-12-11 20:23:15 +00:00
struct urb * pUrb ;
2009-09-22 18:44:07 +00:00
2009-12-11 20:23:15 +00:00
pUrb = ( struct urb * ) data ;
2009-12-11 20:23:16 +00:00
pHTTXContext = ( struct rt_ht_tx_context * ) pUrb - > context ;
2009-12-11 20:23:13 +00:00
pAd = pHTTXContext - > pAd ;
2009-09-22 18:44:07 +00:00
rtusb_dataout_complete ( ( unsigned long ) pUrb ) ;
if ( ( RTMP_TEST_FLAG ( pAd , ( fRTMP_ADAPTER_RESET_IN_PROGRESS |
2009-12-11 20:23:13 +00:00
fRTMP_ADAPTER_HALT_IN_PROGRESS |
fRTMP_ADAPTER_NIC_NOT_EXIST ) ) ) ) {
2009-12-11 20:23:14 +00:00
/* do nothing and return directly. */
2009-12-11 20:23:13 +00:00
} else {
if ( RTMP_TEST_FLAG ( pAd , fRTMP_ADAPTER_BULKOUT_RESET ) ) {
RTUSBEnqueueInternalCmd ( pAd , CMDTHREAD_RESET_BULK_OUT ,
NULL , 0 ) ;
} else {
pHTTXContext = & pAd - > TxContext [ BulkOutPipeId ] ;
2009-09-22 18:44:07 +00:00
if ( ( pAd - > TxSwQueue [ BulkOutPipeId ] . Number > 0 ) & &
2009-12-11 20:23:13 +00:00
/*((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */
( pAd - > DeQueueRunning [ BulkOutPipeId ] = = FALSE ) & &
( pHTTXContext - > bCurWriting = = FALSE ) ) {
RTMPDeQueuePacket ( pAd , FALSE , BulkOutPipeId ,
MAX_TX_PROCESS ) ;
2009-09-22 18:44:07 +00:00
}
2009-12-11 20:23:13 +00:00
RTUSB_SET_BULK_FLAG ( pAd ,
fRTUSB_BULK_OUT_DATA_NORMAL < < 1 ) ;
2009-09-22 18:44:07 +00:00
RTUSBKickBulkOut ( pAd ) ;
}
}
return ;
}
static void rtusb_ac0_dma_done_tasklet ( unsigned long data )
{
2009-12-11 20:23:16 +00:00
struct rt_rtmp_adapter * pAd ;
struct rt_ht_tx_context * pHTTXContext ;
2009-12-11 20:23:15 +00:00
u8 BulkOutPipeId = 0 ;
2009-12-11 20:23:15 +00:00
struct urb * pUrb ;
2009-09-22 18:44:07 +00:00
2009-12-11 20:23:15 +00:00
pUrb = ( struct urb * ) data ;
2009-12-11 20:23:16 +00:00
pHTTXContext = ( struct rt_ht_tx_context * ) pUrb - > context ;
2009-12-11 20:23:13 +00:00
pAd = pHTTXContext - > pAd ;
2009-09-22 18:44:07 +00:00
rtusb_dataout_complete ( ( unsigned long ) pUrb ) ;
if ( ( RTMP_TEST_FLAG ( pAd , ( fRTMP_ADAPTER_RESET_IN_PROGRESS |
2009-12-11 20:23:13 +00:00
fRTMP_ADAPTER_HALT_IN_PROGRESS |
fRTMP_ADAPTER_NIC_NOT_EXIST ) ) ) ) {
2009-12-11 20:23:14 +00:00
/* do nothing and return directly. */
2009-12-11 20:23:13 +00:00
} else {
if ( RTMP_TEST_FLAG ( pAd , fRTMP_ADAPTER_BULKOUT_RESET ) ) {
RTUSBEnqueueInternalCmd ( pAd , CMDTHREAD_RESET_BULK_OUT ,
NULL , 0 ) ;
} else {
pHTTXContext = & pAd - > TxContext [ BulkOutPipeId ] ;
2009-09-22 18:44:07 +00:00
if ( ( pAd - > TxSwQueue [ BulkOutPipeId ] . Number > 0 ) & &
2009-12-11 20:23:13 +00:00
/* ((pHTTXContext->CurWritePosition > (pHTTXContext->NextBulkOutPosition + 0x6000)) || (pHTTXContext->NextBulkOutPosition > pHTTXContext->CurWritePosition + 0x6000)) && */
( pAd - > DeQueueRunning [ BulkOutPipeId ] = = FALSE ) & &
( pHTTXContext - > bCurWriting = = FALSE ) ) {
RTMPDeQueuePacket ( pAd , FALSE , BulkOutPipeId ,
MAX_TX_PROCESS ) ;
2009-09-22 18:44:07 +00:00
}
RTUSB_SET_BULK_FLAG ( pAd , fRTUSB_BULK_OUT_DATA_NORMAL ) ;
RTUSBKickBulkOut ( pAd ) ;
}
}
return ;
}
2009-12-11 20:23:16 +00:00
int RtmpNetTaskInit ( struct rt_rtmp_adapter * pAd )
2009-09-22 18:44:07 +00:00
{
2009-12-11 20:23:15 +00:00
struct os_cookie * pObj = ( struct os_cookie * ) pAd - > OS_Cookie ;
2009-09-22 18:44:07 +00:00
2009-12-11 20:23:14 +00:00
/* Create receive tasklet */
2009-12-11 20:23:15 +00:00
tasklet_init ( & pObj - > rx_done_task , rx_done_tasklet , ( unsigned long ) pAd ) ;
2009-12-11 20:23:13 +00:00
tasklet_init ( & pObj - > mgmt_dma_done_task , rtusb_mgmt_dma_done_tasklet ,
( unsigned long ) pAd ) ;
tasklet_init ( & pObj - > ac0_dma_done_task , rtusb_ac0_dma_done_tasklet ,
( unsigned long ) pAd ) ;
tasklet_init ( & pObj - > ac1_dma_done_task , rtusb_ac1_dma_done_tasklet ,
( unsigned long ) pAd ) ;
tasklet_init ( & pObj - > ac2_dma_done_task , rtusb_ac2_dma_done_tasklet ,
( unsigned long ) pAd ) ;
tasklet_init ( & pObj - > ac3_dma_done_task , rtusb_ac3_dma_done_tasklet ,
( unsigned long ) pAd ) ;
2009-09-22 18:44:07 +00:00
tasklet_init ( & pObj - > tbtt_task , tbtt_tasklet , ( unsigned long ) pAd ) ;
2009-12-11 20:23:13 +00:00
tasklet_init ( & pObj - > null_frame_complete_task ,
rtusb_null_frame_done_tasklet , ( unsigned long ) pAd ) ;
tasklet_init ( & pObj - > rts_frame_complete_task ,
rtusb_rts_frame_done_tasklet , ( unsigned long ) pAd ) ;
tasklet_init ( & pObj - > pspoll_frame_complete_task ,
rtusb_pspoll_frame_done_tasklet , ( unsigned long ) pAd ) ;
2009-09-22 18:44:07 +00:00
return NDIS_STATUS_SUCCESS ;
}
2009-12-11 20:23:16 +00:00
void RtmpNetTaskExit ( struct rt_rtmp_adapter * pAd )
2009-09-22 18:44:07 +00:00
{
2009-12-11 20:23:15 +00:00
struct os_cookie * pObj ;
2009-09-22 18:44:07 +00:00
2009-12-11 20:23:15 +00:00
pObj = ( struct os_cookie * ) pAd - > OS_Cookie ;
2009-09-22 18:44:07 +00:00
tasklet_kill ( & pObj - > rx_done_task ) ;
tasklet_kill ( & pObj - > mgmt_dma_done_task ) ;
tasklet_kill ( & pObj - > ac0_dma_done_task ) ;
tasklet_kill ( & pObj - > ac1_dma_done_task ) ;
tasklet_kill ( & pObj - > ac2_dma_done_task ) ;
tasklet_kill ( & pObj - > ac3_dma_done_task ) ;
tasklet_kill ( & pObj - > tbtt_task ) ;
tasklet_kill ( & pObj - > null_frame_complete_task ) ;
tasklet_kill ( & pObj - > rts_frame_complete_task ) ;
tasklet_kill ( & pObj - > pspoll_frame_complete_task ) ;
}