Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Unified Diff: chromeos/drivers/ath6kl/htc2/htc_recv.c

Issue 3579004: ath6kl: Bringing in the upstream version (Closed) Base URL: http://git.chromium.org/git/kernel.git
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/drivers/ath6kl/htc2/htc_internal.h ('k') | chromeos/drivers/ath6kl/htc2/htc_send.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/drivers/ath6kl/htc2/htc_recv.c
diff --git a/chromeos/drivers/ath6kl/htc2/htc_recv.c b/chromeos/drivers/ath6kl/htc2/htc_recv.c
index 8f3804a47f505cbcac83471150e06ccd1085d955..3503657fe7d2948bd27c652757b416f987ffaf3f 100644
--- a/chromeos/drivers/ath6kl/htc2/htc_recv.c
+++ b/chromeos/drivers/ath6kl/htc2/htc_recv.c
@@ -1,15 +1,19 @@
//------------------------------------------------------------------------------
// <copyright file="htc_recv.c" company="Atheros">
-// Copyright (c) 2007-2008 Atheros Corporation. All rights reserved.
+// Copyright (c) 2007-2010 Atheros Corporation. 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.
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
//
//
//------------------------------------------------------------------------------
@@ -26,8 +30,8 @@
#define DO_RCV_COMPLETION(e,q) DoRecvCompletion(e,q)
#define DUMP_RECV_PKT_INFO(pP) \
- AR_DEBUG_PRINTF(ATH_DEBUG_RECV, (" HTC RECV packet 0x%X (%d bytes) (hdr:0x%X) on ep : %d \n", \
- (A_UINT32)(pP), \
+ AR_DEBUG_PRINTF(ATH_DEBUG_RECV, (" HTC RECV packet 0x%lX (%d bytes) (hdr:0x%X) on ep : %d \n", \
+ (unsigned long)(pP), \
(pP)->ActualLength, \
(pP)->PktInfo.AsRx.ExpectedHdr, \
(pP)->Endpoint))
@@ -69,8 +73,8 @@ static void DoRecvCompletion(HTC_ENDPOINT *pEndpoint,
/* using legacy EpRecv */
do {
pPacket = HTC_PACKET_DEQUEUE(pQueueToIndicate);
- AR_DEBUG_PRINTF(ATH_DEBUG_RECV, (" HTC calling ep %d recv callback on packet 0x%X \n", \
- pEndpoint->Id, (A_UINT32)(pPacket)));
+ AR_DEBUG_PRINTF(ATH_DEBUG_RECV, (" HTC calling ep %d recv callback on packet 0x%lX \n", \
+ pEndpoint->Id, (unsigned long)(pPacket)));
pEndpoint->EpCallBacks.EpRecv(pEndpoint->EpCallBacks.pContext, pPacket);
} while (!HTC_QUEUE_EMPTY(pQueueToIndicate));
}
@@ -150,9 +154,11 @@ static INLINE A_STATUS HTCProcessTrailer(HTC_TARGET *target,
((A_UINT8 *)(&pNextLookAheads[0]))[2] = pLookAhead->LookAhead[2];
((A_UINT8 *)(&pNextLookAheads[0]))[3] = pLookAhead->LookAhead[3];
+#ifdef ATH_DEBUG_MODULE
if (AR_DEBUG_LVL_CHECK(ATH_DEBUG_RECV)) {
DebugDumpBytes((A_UINT8 *)pNextLookAheads,4,"Next Look Ahead");
}
+#endif
/* just one normal lookahead */
*pNumLookAheads = 1;
}
@@ -166,9 +172,11 @@ static INLINE A_STATUS HTCProcessTrailer(HTC_TARGET *target,
pBundledLookAheadRpt = (HTC_BUNDLED_LOOKAHEAD_REPORT *)pRecordBuf;
+#ifdef ATH_DEBUG_MODULE
if (AR_DEBUG_LVL_CHECK(ATH_DEBUG_RECV)) {
DebugDumpBytes(pRecordBuf,pRecord->Length,"Bundle LookAhead");
}
+#endif
if ((pRecord->Length / (sizeof(HTC_BUNDLED_LOOKAHEAD_REPORT))) >
HTC_HOST_MAX_MSG_PER_BUNDLE) {
@@ -205,9 +213,11 @@ static INLINE A_STATUS HTCProcessTrailer(HTC_TARGET *target,
Length -= pRecord->Length;
}
+#ifdef ATH_DEBUG_MODULE
if (A_FAILED(status)) {
DebugDumpBytes(pOrigBuffer,origLength,"BAD Recv Trailer");
}
+#endif
AR_DEBUG_PRINTF(ATH_DEBUG_RECV, ("-HTCProcessTrailer \n"));
return status;
@@ -280,8 +290,9 @@ static A_STATUS HTCProcessRecvHeader(HTC_TARGET *target,
/* somehow the lookahead that gave us the full read length did not
* reflect the actual header in the pending message */
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("HTCProcessRecvHeader, lookahead mismatch! (pPkt:0x%X flags:0x%X) \n",
- (A_UINT32)pPacket, pPacket->PktInfo.AsRx.HTCRxFlags));
+ ("HTCProcessRecvHeader, lookahead mismatch! (pPkt:0x%lX flags:0x%X) \n",
+ (unsigned long)pPacket, pPacket->PktInfo.AsRx.HTCRxFlags));
+#ifdef ATH_DEBUG_MODULE
DebugDumpBytes((A_UINT8 *)&pPacket->PktInfo.AsRx.ExpectedHdr,4,"Expected Message LookAhead");
DebugDumpBytes(pBuf,sizeof(HTC_FRAME_HDR),"Current Frame Header");
#ifdef HTC_CAPTURE_LAST_FRAME
@@ -292,6 +303,7 @@ static A_STATUS HTCProcessRecvHeader(HTC_TARGET *target,
"Last trailer");
}
#endif
+#endif
status = A_EPROTO;
break;
}
@@ -355,7 +367,9 @@ static A_STATUS HTCProcessRecvHeader(HTC_TARGET *target,
if (A_FAILED(status)) {
/* dump the whole packet */
+#ifdef ATH_DEBUG_MODULE
DebugDumpBytes(pBuf,pPacket->ActualLength < 256 ? pPacket->ActualLength : 256 ,"BAD HTC Recv PKT");
+#endif
} else {
#ifdef HTC_CAPTURE_LAST_FRAME
A_MEMCPY(&target->LastFrameHdr,pBuf,sizeof(HTC_FRAME_HDR));
@@ -390,9 +404,11 @@ static INLINE void HTCAsyncRecvCheckMorePackets(HTC_TARGET *target,
if (A_EPROTO == nextStatus) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("Next look ahead from recv header was INVALID\n"));
+#ifdef ATH_DEBUG_MODULE
DebugDumpBytes((A_UINT8 *)NextLookAheads,
NumLookAheads * (sizeof(A_UINT32)),
"BAD lookaheads from lookahead report");
+#endif
}
if (A_SUCCESS(nextStatus) && !fetched) {
/* we could not fetch any more packets due to resources */
@@ -508,8 +524,8 @@ void HTCRecvCompleteHandler(void *Context, HTC_PACKET *pPacket)
A_STATUS status;
A_BOOL checkMorePkts = TRUE;
- AR_DEBUG_PRINTF(ATH_DEBUG_RECV, ("+HTCRecvCompleteHandler (pkt:0x%X, status:%d, ep:%d) \n",
- (A_UINT32)pPacket, pPacket->Status, pPacket->Endpoint));
+ AR_DEBUG_PRINTF(ATH_DEBUG_RECV, ("+HTCRecvCompleteHandler (pkt:0x%lX, status:%d, ep:%d) \n",
+ (unsigned long)pPacket, pPacket->Status, pPacket->Endpoint));
A_ASSERT(!IS_DEV_IRQ_PROC_SYNC_MODE(&target->Device));
AR_DEBUG_ASSERT(pPacket->Endpoint < ENDPOINT_MAX);
@@ -708,7 +724,7 @@ static A_STATUS AllocAndPrepareRxPackets(HTC_TARGET *target,
if (pHdr->PayloadLen > HTC_MAX_PAYLOAD_LENGTH) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Payload length %d exceeds max HTC : %d !\n",
- pHdr->PayloadLen, HTC_MAX_PAYLOAD_LENGTH));
+ pHdr->PayloadLen, (A_UINT32)HTC_MAX_PAYLOAD_LENGTH));
status = A_EPROTO;
break;
}
@@ -1485,8 +1501,8 @@ static void HTCFlushRxQueue(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint, HTC_PAC
UNLOCK_HTC_RX(target);
pPacket->Status = A_ECANCELED;
pPacket->ActualLength = 0;
- AR_DEBUG_PRINTF(ATH_DEBUG_RECV, (" Flushing RX packet:0x%X, length:%d, ep:%d \n",
- (A_UINT32)pPacket, pPacket->BufferLength, pPacket->Endpoint));
+ AR_DEBUG_PRINTF(ATH_DEBUG_RECV, (" Flushing RX packet:0x%lX, length:%d, ep:%d \n",
+ (unsigned long)pPacket, pPacket->BufferLength, pPacket->Endpoint));
INIT_HTC_PACKET_QUEUE_AND_ADD(&container,pPacket);
/* give the packet back */
DO_RCV_COMPLETION(pEndpoint,&container);
@@ -1547,3 +1563,16 @@ int HTCGetNumRecvBuffers(HTC_HANDLE HTCHandle,
return HTC_PACKET_QUEUE_DEPTH(&(target->EndPoint[Endpoint].RxBuffers));
}
+A_STATUS HTCWaitForPendingRecv(HTC_HANDLE HTCHandle,
+ A_UINT32 TimeoutInMs,
+ A_BOOL *pbIsRecvPending)
+{
+ A_STATUS status = A_OK;
+ HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+
+ status = DevWaitForPendingRecv(&target->Device,
+ TimeoutInMs,
+ pbIsRecvPending);
+
+ return status;
+}
« no previous file with comments | « chromeos/drivers/ath6kl/htc2/htc_internal.h ('k') | chromeos/drivers/ath6kl/htc2/htc_send.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698