0
|
1 |
/*
|
|
2 |
* txResult.c
|
|
3 |
*
|
|
4 |
* Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.
|
|
5 |
* All rights reserved.
|
|
6 |
*
|
|
7 |
* This program and the accompanying materials are made available under the
|
|
8 |
* terms of the Eclipse Public License v1.0 or BSD License which accompanies
|
|
9 |
* this distribution. The Eclipse Public License is available at
|
|
10 |
* http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.
|
|
11 |
*
|
|
12 |
* Redistribution and use in source and binary forms, with or without
|
|
13 |
* modification, are permitted provided that the following conditions
|
|
14 |
* are met:
|
|
15 |
*
|
|
16 |
* * Redistributions of source code must retain the above copyright
|
|
17 |
* notice, this list of conditions and the following disclaimer.
|
|
18 |
* * Redistributions in binary form must reproduce the above copyright
|
|
19 |
* notice, this list of conditions and the following disclaimer in
|
|
20 |
* the documentation and/or other materials provided with the
|
|
21 |
* distribution.
|
|
22 |
* * Neither the name Texas Instruments nor the names of its
|
|
23 |
* contributors may be used to endorse or promote products derived
|
|
24 |
* from this software without specific prior written permission.
|
|
25 |
*
|
|
26 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
27 |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
28 |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
29 |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
30 |
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
31 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
32 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
33 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
34 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
35 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
36 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
37 |
*/
|
|
38 |
|
|
39 |
|
|
40 |
/****************************************************************************
|
|
41 |
*
|
|
42 |
* MODULE: txResult.c
|
|
43 |
*
|
|
44 |
* PURPOSE: Handle packets Tx results upon Tx-complete from the FW.
|
|
45 |
*
|
|
46 |
* DESCRIPTION:
|
|
47 |
* ============
|
|
48 |
* This module is called upon Tx-complete from FW.
|
|
49 |
* It retrieves the transmitted packets results from the FW TxResult table and
|
|
50 |
* calls the upper layer callback function for each packet with its results.
|
|
51 |
*
|
|
52 |
****************************************************************************/
|
|
53 |
|
|
54 |
#define __FILE_ID__ FILE_ID_107
|
|
55 |
#include "tidef.h"
|
|
56 |
#include "osApi.h"
|
|
57 |
#include "report.h"
|
|
58 |
#include "TwIf.h"
|
|
59 |
#include "txCtrlBlk_api.h"
|
|
60 |
#include "txResult_api.h"
|
|
61 |
#include "TWDriver.h"
|
|
62 |
#include "FwEvent_api.h"
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
#define TX_RESULT_QUEUE_DEPTH_MASK (TRQ_DEPTH - 1)
|
|
67 |
|
|
68 |
#if (TX_RESULT_QUEUE_DEPTH_MASK & TRQ_DEPTH)
|
|
69 |
#error TRQ_DEPTH should be a power of 2 !!
|
|
70 |
#endif
|
|
71 |
|
|
72 |
|
|
73 |
/* Callback function definition for Tx sendPacketComplete */
|
|
74 |
typedef void (* TSendPacketCompleteCb)(TI_HANDLE hCbObj, TxResultDescriptor_t *pTxResultInfo);
|
|
75 |
|
|
76 |
/* Tx-Result SM states */
|
|
77 |
typedef enum
|
|
78 |
{
|
|
79 |
TX_RESULT_STATE_IDLE,
|
|
80 |
TX_RESULT_STATE_READING
|
|
81 |
} ETxResultState;
|
|
82 |
|
|
83 |
/* The host Tx-results counter write transaction structure. */
|
|
84 |
typedef struct
|
|
85 |
{
|
|
86 |
TTxnStruct tTxnStruct;
|
|
87 |
TI_UINT8 *pCounter;
|
|
88 |
} THostCounterWriteTxn;
|
|
89 |
|
|
90 |
/* The Tx-results counters and table read transaction structure. */
|
|
91 |
typedef struct
|
|
92 |
{
|
|
93 |
TTxnStruct tTxnStruct;
|
|
94 |
TI_UINT8 *pTxResultInfo;
|
|
95 |
} TResultsInfoReadTxn;
|
|
96 |
|
|
97 |
/* The TxResult module object. */
|
|
98 |
typedef struct
|
|
99 |
{
|
|
100 |
TI_HANDLE hOs;
|
|
101 |
TI_HANDLE hReport;
|
|
102 |
TI_HANDLE hTwIf;
|
|
103 |
|
|
104 |
TI_UINT32 uTxResultInfoAddr; /* The HW Tx-Result Table address */
|
|
105 |
TI_UINT32 uTxResultHostCounterAddr;/* The Tx-Result host counter address in SRAM */
|
|
106 |
TI_UINT32 uHostResultsCounter; /* Number of results read by host from queue since FW-init (updated to FW) */
|
|
107 |
ETxResultState eState; /* Current eState of SM */
|
|
108 |
TSendPacketCompleteCb fSendPacketCompleteCb; /* Tx-Complete callback function */
|
|
109 |
TI_HANDLE hSendPacketCompleteHndl; /* Tx-Complete callback function handle */
|
|
110 |
THostCounterWriteTxn tHostCounterWriteTxn; /* The structure used for writing host results counter to FW */
|
|
111 |
TResultsInfoReadTxn tResultsInfoReadTxn; /* The structure used for reading Tx-results counters and table from FW */
|
|
112 |
#ifdef TI_DBG
|
|
113 |
TI_UINT32 uInterruptsCounter; /* Count number of Tx-results */
|
|
114 |
#endif
|
|
115 |
|
|
116 |
} TTxResultObj;
|
|
117 |
|
|
118 |
|
|
119 |
static void txResult_Restart (TTxResultObj *pTxResult);
|
|
120 |
static void txResult_HandleNewResults (TTxResultObj *pTxResult);
|
|
121 |
static void txResult_StateMachine (TI_HANDLE hTxResult);
|
|
122 |
|
|
123 |
|
|
124 |
|
|
125 |
/****************************************************************************
|
|
126 |
* txResult_Create()
|
|
127 |
****************************************************************************
|
|
128 |
* DESCRIPTION: Create the Tx-Result object
|
|
129 |
*
|
|
130 |
* INPUTS: hOs
|
|
131 |
*
|
|
132 |
* OUTPUT: None
|
|
133 |
*
|
|
134 |
* RETURNS: The Created object
|
|
135 |
****************************************************************************/
|
|
136 |
TI_HANDLE txResult_Create(TI_HANDLE hOs)
|
|
137 |
{
|
|
138 |
TTxResultObj *pTxResult;
|
|
139 |
|
|
140 |
pTxResult = os_memoryAlloc(hOs, sizeof(TTxResultObj),MemoryNormal);
|
|
141 |
if (pTxResult == NULL)
|
|
142 |
return NULL;
|
|
143 |
|
|
144 |
os_memoryZero(hOs, pTxResult, sizeof(TTxResultObj));
|
|
145 |
|
|
146 |
pTxResult->tResultsInfoReadTxn.pTxResultInfo = os_memoryAlloc(hOs, sizeof(TxResultInterface_t) + WSPI_PAD_LEN_READ,MemoryDMA);
|
|
147 |
if (pTxResult->tResultsInfoReadTxn.pTxResultInfo == NULL)
|
|
148 |
{
|
|
149 |
return NULL;
|
|
150 |
}
|
|
151 |
os_memoryZero (hOs,pTxResult->tResultsInfoReadTxn.pTxResultInfo, sizeof(TxResultInterface_t) + WSPI_PAD_LEN_READ);
|
|
152 |
pTxResult->tResultsInfoReadTxn.pTxResultInfo += WSPI_PAD_LEN_READ;
|
|
153 |
|
|
154 |
|
|
155 |
pTxResult->tHostCounterWriteTxn.pCounter = os_memoryAlloc(hOs, sizeof(TI_UINT32) + WSPI_PAD_LEN_READ,MemoryDMA);
|
|
156 |
if (pTxResult->tHostCounterWriteTxn.pCounter == NULL)
|
|
157 |
{
|
|
158 |
return NULL;
|
|
159 |
}
|
|
160 |
os_memoryZero (hOs,pTxResult->tHostCounterWriteTxn.pCounter, sizeof(TI_UINT32) + WSPI_PAD_LEN_READ);
|
|
161 |
pTxResult->tHostCounterWriteTxn.pCounter += WSPI_PAD_LEN_READ;
|
|
162 |
|
|
163 |
pTxResult->hOs = hOs;
|
|
164 |
|
|
165 |
return( (TI_HANDLE)pTxResult );
|
|
166 |
}
|
|
167 |
|
|
168 |
|
|
169 |
/****************************************************************************
|
|
170 |
* txResult_Destroy()
|
|
171 |
****************************************************************************
|
|
172 |
* DESCRIPTION: Destroy the Tx-Result object
|
|
173 |
*
|
|
174 |
* INPUTS: hTxResult - The object to free
|
|
175 |
*
|
|
176 |
* OUTPUT: None
|
|
177 |
*
|
|
178 |
* RETURNS: TI_OK or TI_NOK
|
|
179 |
****************************************************************************/
|
|
180 |
TI_STATUS txResult_Destroy(TI_HANDLE hTxResult)
|
|
181 |
{
|
|
182 |
TTxResultObj *pTxResult = (TTxResultObj *)hTxResult;
|
|
183 |
|
|
184 |
if (pTxResult)
|
|
185 |
{
|
|
186 |
if (pTxResult->tResultsInfoReadTxn.pTxResultInfo)
|
|
187 |
{
|
|
188 |
os_memoryFree (pTxResult->hOs, pTxResult->tResultsInfoReadTxn.pTxResultInfo - WSPI_PAD_LEN_READ, sizeof(TI_UINT32) + WSPI_PAD_LEN_READ);
|
|
189 |
}
|
|
190 |
|
|
191 |
if (pTxResult->tHostCounterWriteTxn.pCounter)
|
|
192 |
{
|
|
193 |
os_memoryFree (pTxResult->hOs, pTxResult->tHostCounterWriteTxn.pCounter - WSPI_PAD_LEN_READ, sizeof(TI_UINT32) + WSPI_PAD_LEN_READ);
|
|
194 |
}
|
|
195 |
|
|
196 |
os_memoryFree(pTxResult->hOs, pTxResult, sizeof(TTxResultObj));
|
|
197 |
}
|
|
198 |
|
|
199 |
return TI_OK;
|
|
200 |
}
|
|
201 |
|
|
202 |
|
|
203 |
/****************************************************************************
|
|
204 |
* txResult_Init()
|
|
205 |
****************************************************************************
|
|
206 |
DESCRIPTION:
|
|
207 |
============
|
|
208 |
Initialize the txResult module.
|
|
209 |
****************************************************************************/
|
|
210 |
TI_STATUS txResult_Init(TI_HANDLE hTxResult, TI_HANDLE hReport, TI_HANDLE hTwIf)
|
|
211 |
{
|
|
212 |
TTxResultObj *pTxResult = (TTxResultObj *)hTxResult;
|
|
213 |
TTxnStruct *pTxn;
|
|
214 |
|
|
215 |
pTxResult->hReport = hReport;
|
|
216 |
pTxResult->hTwIf = hTwIf;
|
|
217 |
|
|
218 |
/* Prepare Host-Results-Counter write transaction (HwAddr is filled before each transaction) */
|
|
219 |
pTxn = &pTxResult->tHostCounterWriteTxn.tTxnStruct;
|
|
220 |
TXN_PARAM_SET(pTxn, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_WRITE, TXN_INC_ADDR)
|
|
221 |
BUILD_TTxnStruct(pTxn, 0, pTxResult->tHostCounterWriteTxn.pCounter, REGISTER_SIZE, NULL, NULL)
|
|
222 |
|
|
223 |
/* Prepare Tx-Result counter and table read transaction (HwAddr is filled before each transaction) */
|
|
224 |
pTxn = &pTxResult->tResultsInfoReadTxn.tTxnStruct;
|
|
225 |
TXN_PARAM_SET(pTxn, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_READ, TXN_INC_ADDR)
|
|
226 |
BUILD_TTxnStruct(pTxn,
|
|
227 |
0,
|
|
228 |
pTxResult->tResultsInfoReadTxn.pTxResultInfo,
|
|
229 |
sizeof(TxResultInterface_t),
|
|
230 |
(TTxnDoneCb)txResult_StateMachine,
|
|
231 |
hTxResult)
|
|
232 |
|
|
233 |
txResult_Restart (pTxResult);
|
|
234 |
|
|
235 |
return TI_OK;
|
|
236 |
}
|
|
237 |
|
|
238 |
|
|
239 |
/****************************************************************************
|
|
240 |
* txResult_Restart()
|
|
241 |
****************************************************************************
|
|
242 |
DESCRIPTION:
|
|
243 |
============
|
|
244 |
Restarts the Tx-Result module.
|
|
245 |
Called upon init and recovery.
|
|
246 |
Shouldn't be called upon disconnect, since the FW provides Tx-Complete
|
|
247 |
for all pending packets in FW!!
|
|
248 |
****************************************************************************/
|
|
249 |
static void txResult_Restart (TTxResultObj *pTxResult)
|
|
250 |
{
|
|
251 |
pTxResult->uHostResultsCounter = 0;
|
|
252 |
pTxResult->eState = TX_RESULT_STATE_IDLE;
|
|
253 |
}
|
|
254 |
|
|
255 |
|
|
256 |
/****************************************************************************
|
|
257 |
* txResult_setHwInfo()
|
|
258 |
****************************************************************************
|
|
259 |
* DESCRIPTION:
|
|
260 |
* Called after the HW configuration upon init or recovery.
|
|
261 |
* Store the Tx-result table HW address.
|
|
262 |
****************************************************************************/
|
|
263 |
void txResult_setHwInfo(TI_HANDLE hTxResult, TDmaParams *pDmaParams)
|
|
264 |
{
|
|
265 |
TTxResultObj *pTxResult = (TTxResultObj *)hTxResult;
|
|
266 |
|
|
267 |
pTxResult->uTxResultInfoAddr = (TI_UINT32)(pDmaParams->fwTxResultInterface);
|
|
268 |
pTxResult->uTxResultHostCounterAddr = pTxResult->uTxResultInfoAddr +
|
|
269 |
TI_FIELD_OFFSET(TxResultControl_t, TxResultHostCounter);
|
|
270 |
|
|
271 |
txResult_Restart (pTxResult);
|
|
272 |
}
|
|
273 |
|
|
274 |
|
|
275 |
/****************************************************************************
|
|
276 |
* txResult_TxCmpltIntrCb()
|
|
277 |
****************************************************************************
|
|
278 |
* DESCRIPTION:
|
|
279 |
* ============
|
|
280 |
* Called upon DATA interrupt from the FW.
|
|
281 |
* If new Tx results are available, start handling them.
|
|
282 |
*
|
|
283 |
* INPUTS: hTxResult - the txResult object handle.
|
|
284 |
* pFwStatus - The FW status registers read by the FwEvent
|
|
285 |
*
|
|
286 |
* OUTPUT: None
|
|
287 |
*
|
|
288 |
* RETURNS: void
|
|
289 |
***************************************************************************/
|
|
290 |
void txResult_TxCmpltIntrCb (TI_HANDLE hTxResult, FwStatus_t *pFwStatus)
|
|
291 |
{
|
|
292 |
TTxResultObj *pTxResult = (TTxResultObj *)hTxResult;
|
|
293 |
TI_UINT32 uTempCounters;
|
|
294 |
FwStatCntrs_t *pFwStatusCounters;
|
|
295 |
|
|
296 |
#ifdef TI_DBG
|
|
297 |
pTxResult->uInterruptsCounter++;
|
|
298 |
|
|
299 |
if (pTxResult->eState != TX_RESULT_STATE_IDLE)
|
|
300 |
{
|
|
301 |
TRACE1(pTxResult->hReport, REPORT_SEVERITY_INFORMATION, ": called in eState %d, so exit\n", pTxResult->eState);
|
|
302 |
return;
|
|
303 |
}
|
|
304 |
#endif
|
|
305 |
|
|
306 |
/* If no new results - exit (may happen since Data interrupt is common to all Tx&Rx events) */
|
|
307 |
uTempCounters = ENDIAN_HANDLE_LONG(pFwStatus->counters);
|
|
308 |
pFwStatusCounters = (FwStatCntrs_t *)&uTempCounters;
|
|
309 |
if (pFwStatusCounters->txResultsCntr == (TI_UINT8)pTxResult->uHostResultsCounter)
|
|
310 |
{
|
|
311 |
TRACE0(pTxResult->hReport, REPORT_SEVERITY_INFORMATION, ": No new Tx results\n");
|
|
312 |
return;
|
|
313 |
}
|
|
314 |
|
|
315 |
/* Call the SM to handle the new Tx results */
|
|
316 |
txResult_StateMachine (hTxResult);
|
|
317 |
}
|
|
318 |
|
|
319 |
|
|
320 |
/****************************************************************************
|
|
321 |
* txResult_StateMachine()
|
|
322 |
****************************************************************************
|
|
323 |
* DESCRIPTION:
|
|
324 |
*
|
|
325 |
* The main SM of the module. Called in IDLE eState by txResult_TxCmpltIntrCb() on
|
|
326 |
* Data interrupt from the FW.
|
|
327 |
* If no new results - exit (may happen since Data interrupt is common to all Tx&Rx events)
|
|
328 |
* Read all Tx-Result cyclic table.
|
|
329 |
* Go over the new Tx-results and call the upper layer callback function for each packet result.
|
|
330 |
* At the end - write the new host counter to the FW.
|
|
331 |
*
|
|
332 |
* INPUTS:
|
|
333 |
*
|
|
334 |
* OUTPUT:
|
|
335 |
*
|
|
336 |
* RETURNS: None
|
|
337 |
****************************************************************************/
|
|
338 |
static void txResult_StateMachine (TI_HANDLE hTxResult)
|
|
339 |
{
|
|
340 |
TTxResultObj *pTxResult = (TTxResultObj *)hTxResult;
|
|
341 |
ETxnStatus eTwifStatus = TXN_STATUS_COMPLETE; /* Last bus operation status: Complete (Sync) or Pending (Async). */
|
|
342 |
TTxnStruct *pTxn = &(pTxResult->tResultsInfoReadTxn.tTxnStruct);
|
|
343 |
|
|
344 |
/* Loop while processing is completed in current context (sync), or until fully completed */
|
|
345 |
while (eTwifStatus == TXN_STATUS_COMPLETE)
|
|
346 |
{
|
|
347 |
TRACE2(pTxResult->hReport, REPORT_SEVERITY_INFORMATION, ": eState = %d, eTwifStatus = %d\n", pTxResult->eState, eTwifStatus);
|
|
348 |
|
|
349 |
switch(pTxResult->eState)
|
|
350 |
{
|
|
351 |
case TX_RESULT_STATE_IDLE:
|
|
352 |
/* Read Tx-Result queue and counters. */
|
|
353 |
pTxn->uHwAddr = pTxResult->uTxResultInfoAddr;
|
|
354 |
eTwifStatus = twIf_Transact (pTxResult->hTwIf, pTxn);
|
|
355 |
|
|
356 |
pTxResult->eState = TX_RESULT_STATE_READING;
|
|
357 |
break;
|
|
358 |
|
|
359 |
case TX_RESULT_STATE_READING:
|
|
360 |
/* Process new Tx results, call upper layers to handle them and update host-index in the FW. */
|
|
361 |
txResult_HandleNewResults (pTxResult);
|
|
362 |
pTxResult->eState = TX_RESULT_STATE_IDLE;
|
|
363 |
return; /********* Exit after all processing is finished **********/
|
|
364 |
|
|
365 |
default:
|
|
366 |
TRACE1(pTxResult->hReport, REPORT_SEVERITY_ERROR, ": Unknown eState = %d\n", pTxResult->eState);
|
|
367 |
return;
|
|
368 |
}
|
|
369 |
}
|
|
370 |
|
|
371 |
if (eTwifStatus == TXN_STATUS_ERROR)
|
|
372 |
{
|
|
373 |
TRACE2(pTxResult->hReport, REPORT_SEVERITY_ERROR, ": returning ERROR in eState %d, eTwifStatus=%d !!!\n", pTxResult->eState, eTwifStatus);
|
|
374 |
}
|
|
375 |
}
|
|
376 |
|
|
377 |
|
|
378 |
/****************************************************************************
|
|
379 |
* txResult_HandleNewResults()
|
|
380 |
****************************************************************************
|
|
381 |
* DESCRIPTION:
|
|
382 |
* ============
|
|
383 |
* We now have the Tx Result table info from the FW so do as follows:
|
|
384 |
* 1. Find the number of new results (FW counter minus host counter), and if 0 exit.
|
|
385 |
* 2. Call the upper layers callback per Tx result.
|
|
386 |
* 3. Update Host-Counter to be equal to the FW-Counter, and write it to the FW.
|
|
387 |
***************************************************************************/
|
|
388 |
static void txResult_HandleNewResults (TTxResultObj *pTxResult)
|
|
389 |
{
|
|
390 |
TI_UINT32 uNumNewResults; /* The number of new Tx-Result entries to be processed. */
|
|
391 |
TI_UINT32 uFwResultsCounter; /* The FW current results counter (accumulated). */
|
|
392 |
TI_UINT32 uTableIndex;
|
|
393 |
TI_UINT32 i;
|
|
394 |
TxResultDescriptor_t *pCurrentResult;
|
|
395 |
TTxnStruct *pTxn = &(pTxResult->tHostCounterWriteTxn.tTxnStruct);
|
|
396 |
|
|
397 |
/* The uFwResultsCounter is the accumulated number of Tx-Results provided by the FW, and the
|
|
398 |
* uHostResultsCounter is the accumulated number of Tx-Results processed by the host.
|
|
399 |
* The delta is the number of new Tx-results in the queue, waiting for host processing.
|
|
400 |
* Since the difference is always a small positive number, a simple subtraction is good
|
|
401 |
* also for wrap around case.
|
|
402 |
*/
|
|
403 |
uFwResultsCounter = ENDIAN_HANDLE_LONG(((TxResultInterface_t*)(pTxResult->tResultsInfoReadTxn.pTxResultInfo))->TxResultControl.TxResultFwCounter);
|
|
404 |
uNumNewResults = uFwResultsCounter - pTxResult->uHostResultsCounter;
|
|
405 |
|
|
406 |
#ifdef TI_DBG
|
|
407 |
/* Verify there are new entries (was already checked in txResult_TxCmpltIntrCb) */
|
|
408 |
if (uNumNewResults == 0)
|
|
409 |
{
|
|
410 |
TRACE2(pTxResult->hReport, REPORT_SEVERITY_WARNING, ": No New Results although indicated by FwStatus!! HostCount=%d, FwCount=%d\n", pTxResult->uHostResultsCounter, uFwResultsCounter);
|
|
411 |
return;
|
|
412 |
}
|
|
413 |
#endif
|
|
414 |
|
|
415 |
/* Update host results-counter in FW to be equal to the FW counter (all new results were processed). */
|
|
416 |
*((TI_UINT32*)(pTxResult->tHostCounterWriteTxn.pCounter)) = ENDIAN_HANDLE_LONG(uFwResultsCounter);
|
|
417 |
pTxn->uHwAddr = pTxResult->uTxResultHostCounterAddr;
|
|
418 |
twIf_Transact(pTxResult->hTwIf, pTxn);
|
|
419 |
|
|
420 |
TRACE3(pTxResult->hReport, REPORT_SEVERITY_INFORMATION, ": NumResults=%d, OriginalHostCount=%d, FwCount=%d\n", uNumNewResults, pTxResult->uHostResultsCounter, uFwResultsCounter);
|
|
421 |
|
|
422 |
/* Loop over all new Tx-results and call Tx-complete callback with current entry pointer. */
|
|
423 |
/* NOTE: THIS SHOULD COME LAST because it may lead to driver-stop process!! */
|
|
424 |
for (i = 0; i < uNumNewResults; i++)
|
|
425 |
{
|
|
426 |
uTableIndex = pTxResult->uHostResultsCounter & TX_RESULT_QUEUE_DEPTH_MASK;
|
|
427 |
pCurrentResult = &(((TxResultInterface_t*)(pTxResult->tResultsInfoReadTxn.pTxResultInfo))->TxResultQueue[uTableIndex]);
|
|
428 |
pTxResult->uHostResultsCounter++;
|
|
429 |
|
|
430 |
TRACE1(pTxResult->hReport, REPORT_SEVERITY_INFORMATION , ": call upper layer CB, Status = %d\n", pCurrentResult->status);
|
|
431 |
|
|
432 |
pTxResult->fSendPacketCompleteCb (pTxResult->hSendPacketCompleteHndl, pCurrentResult);
|
|
433 |
}
|
|
434 |
}
|
|
435 |
|
|
436 |
|
|
437 |
/****************************************************************************
|
|
438 |
* txResult_RegisterCb()
|
|
439 |
****************************************************************************
|
|
440 |
* DESCRIPTION: Register the upper driver Tx-Result callback functions.
|
|
441 |
****************************************************************************/
|
|
442 |
void txResult_RegisterCb (TI_HANDLE hTxResult, TI_UINT32 uCallBackId, void *CBFunc, TI_HANDLE hCbObj)
|
|
443 |
{
|
|
444 |
TTxResultObj* pTxResult = (TTxResultObj*)hTxResult;
|
|
445 |
|
|
446 |
switch (uCallBackId)
|
|
447 |
{
|
|
448 |
/* Set Tx-Complete callback */
|
|
449 |
case TWD_INT_SEND_PACKET_COMPLETE:
|
|
450 |
pTxResult->fSendPacketCompleteCb = (TSendPacketCompleteCb)CBFunc;
|
|
451 |
pTxResult->hSendPacketCompleteHndl = hCbObj;
|
|
452 |
break;
|
|
453 |
|
|
454 |
default:
|
|
455 |
TRACE0(pTxResult->hReport, REPORT_SEVERITY_ERROR, ": Illegal value\n");
|
|
456 |
return;
|
|
457 |
}
|
|
458 |
}
|
|
459 |
|
|
460 |
|
|
461 |
#ifdef TI_DBG /* Debug Functions */
|
|
462 |
|
|
463 |
/****************************************************************************
|
|
464 |
* txResult_PrintInfo()
|
|
465 |
****************************************************************************
|
|
466 |
* DESCRIPTION: Prints TX result debug information.
|
|
467 |
****************************************************************************/
|
|
468 |
void txResult_PrintInfo (TI_HANDLE hTxResult)
|
|
469 |
{
|
|
470 |
TTxResultObj* pTxResult = (TTxResultObj*)hTxResult;
|
|
471 |
|
|
472 |
WLAN_OS_REPORT(("Tx-Result Module Information:\n"));
|
|
473 |
WLAN_OS_REPORT(("=============================\n"));
|
|
474 |
WLAN_OS_REPORT(("uInterruptsCounter: %d\n", pTxResult->uInterruptsCounter));
|
|
475 |
WLAN_OS_REPORT(("uHostResultsCounter: %d\n", pTxResult->uHostResultsCounter));
|
|
476 |
WLAN_OS_REPORT(("=============================\n"));
|
|
477 |
}
|
|
478 |
|
|
479 |
|
|
480 |
/****************************************************************************
|
|
481 |
* txResult_ClearInfo()
|
|
482 |
****************************************************************************
|
|
483 |
* DESCRIPTION: Clears TX result debug information.
|
|
484 |
****************************************************************************/
|
|
485 |
void txResult_ClearInfo (TI_HANDLE hTxResult)
|
|
486 |
{
|
|
487 |
TTxResultObj* pTxResult = (TTxResultObj*)hTxResult;
|
|
488 |
|
|
489 |
pTxResult->uInterruptsCounter = 0;
|
|
490 |
}
|
|
491 |
|
|
492 |
#endif /* TI_DBG */
|
|
493 |
|
|
494 |
|