• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * timer.c
3  *
4  * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  *  * Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  *  * Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in
15  *    the documentation and/or other materials provided with the
16  *    distribution.
17  *  * Neither the name Texas Instruments nor the names of its
18  *    contributors may be used to endorse or promote products derived
19  *    from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 
35 /** \file   timer.c
36  *  \brief  The timers services OS-Independent layer over the OS-API timer services which are OS-Dependent.
37  *
38  *  \see    timer.h, osapi.c
39  */
40 
41 #include <linux/kernel.h>
42 #define __FILE_ID__  FILE_ID_0
43 #include "osApi.h"
44 #include "report.h"
45 #include "queue.h"
46 #include "context.h"
47 #include "timer.h"
48 
49 
50 #define EXPIRY_QUE_SIZE  64  /* support case where all timers expire during recovery or error */
51 
52 /* The timer module structure (common to all timers) */
53 typedef struct
54 {
55     TI_HANDLE   hOs;
56     TI_HANDLE   hReport;
57     TI_HANDLE   hContext;
58     TI_UINT32   uContextId;     /* The ID allocated to this module on registration to context module */
59     TI_HANDLE   hInitQueue;     /* Handle of the Init-Queue */
60     TI_HANDLE   hOperQueue;     /* Handle of the Operational-Queue */
61     TI_BOOL     bOperState;     /* TRUE when the driver is in operational state (not init or recovery) */
62     TI_UINT32   uTwdInitCount;  /* Increments on each TWD init (i.e. recovery) */
63     TI_UINT32   uTimersCount;   /* Number of created timers */
64 } TTimerModule;
65 
66 /* Per timer structure */
67 typedef struct
68 {
69     TI_HANDLE    hTimerModule;             /* The timer module handle (see TTimerModule, needed on expiry) */
70     TI_HANDLE    hOsTimerObj;              /* The OS-API timer object handle */
71     TQueNodeHdr  tQueNodeHdr;              /* The header used for queueing the timer */
72     TTimerCbFunc fExpiryCbFunc;            /* The CB-function provided by the timer user for expiration */
73     TI_HANDLE    hExpiryCbHndl;            /* The CB-function handle */
74     TI_UINT32    uIntervalMsec;            /* The timer duration in Msec */
75     TI_BOOL      bPeriodic;                /* If TRUE, restarted after each expiry */
76     TI_BOOL      bOperStateWhenStarted;    /* The bOperState value when the timer was started */
77     TI_UINT32    uTwdInitCountWhenStarted; /* The uTwdInitCount value when the timer was started */
78 } TTimerInfo;
79 
80 
81 
82 
83 /**
84  * \fn     tmr_Create
85  * \brief  Create the timer module
86  *
87  * Allocate and clear the timer module object.
88  *
89  * \note   This is NOT a specific timer creation! (see tmr_CreateTimer)
90  * \param  hOs - Handle to Os Abstraction Layer
91  * \return Handle of the allocated object
92  * \sa     tmr_Destroy
93  */
tmr_Create(TI_HANDLE hOs)94 TI_HANDLE tmr_Create (TI_HANDLE hOs)
95 {
96     TI_HANDLE hTimerModule;
97 
98     /* allocate module object */
99     hTimerModule = os_memoryAlloc (hOs, sizeof(TTimerModule));
100 
101     if (!hTimerModule)
102     {
103         WLAN_OS_REPORT (("tmr_Create():  Allocation failed!!\n"));
104         return NULL;
105     }
106 
107     os_memoryZero (hOs, hTimerModule, (sizeof(TTimerModule)));
108 
109     return (hTimerModule);
110 }
111 
112 
113 /**
114  * \fn     tmr_Destroy
115  * \brief  Destroy the module.
116  *
117  * Free the module's queues and object.
118  *
119  * \note   This is NOT a specific timer destruction! (see tmr_DestroyTimer)
120  * \param  hTimerModule - The module object
121  * \return TI_OK on success or TI_NOK on failure
122  * \sa     tmr_Create
123  */
tmr_Destroy(TI_HANDLE hTimerModule)124 TI_STATUS tmr_Destroy (TI_HANDLE hTimerModule)
125 {
126     TTimerModule *pTimerModule = (TTimerModule *)hTimerModule;
127 
128     /* Alert if there are still timers that were not destroyed */
129     if (pTimerModule->uTimersCount)
130     {
131         WLAN_OS_REPORT (("tmr_Destroy():  ERROR - Destroying Timer module but not all timers were destroyed!!\n"));
132     }
133 
134     /* Clear queues */
135     tmr_ClearInitQueue (hTimerModule);
136     tmr_ClearOperQueue (hTimerModule);
137 
138     /* Destroy the module's queues */
139     que_Destroy (pTimerModule->hInitQueue);
140     que_Destroy (pTimerModule->hOperQueue);
141 
142     /* free module object */
143     os_memoryFree (pTimerModule->hOs, pTimerModule, sizeof(TTimerModule));
144 
145     return TI_OK;
146 }
147 /**
148  * \fn     tmr_Free
149  * \brief  Free the memory.
150  *
151  * Free the module's queues and object.
152  *
153  * \param  hTimerModule - The module object
154  * \return TI_OK on success or TI_NOK on failure
155  * \sa     tmr_Create
156  */
tmr_Free(TI_HANDLE hTimerModule)157 TI_STATUS tmr_Free(TI_HANDLE hTimerModule)
158 {
159     TTimerModule *pTimerModule = (TTimerModule *)hTimerModule;
160 
161     /* free module object */
162     os_memoryFree (pTimerModule->hOs, pTimerModule, sizeof(TTimerModule));
163 
164     return TI_OK;
165 }
166 
167 
168 /**
169  * \fn     tmr_ClearInitQueue & tmr_ClearOperQueue
170  * \brief  Clear Init/Operationsl queue
171  *
172  * Dequeue all queued timers.
173  *
174  * \note
175  * \param  hTimerModule - The object
176  * \return void
177  * \sa
178  */
tmr_ClearInitQueue(TI_HANDLE hTimerModule)179 void tmr_ClearInitQueue (TI_HANDLE hTimerModule)
180 {
181     TTimerModule *pTimerModule = (TTimerModule *)hTimerModule;
182     TTimerInfo   *pTimerInfo;      /* The timer handle */
183 
184     do {
185         context_EnterCriticalSection (pTimerModule->hContext);
186         pTimerInfo = que_Dequeue (pTimerModule->hInitQueue);
187         context_LeaveCriticalSection (pTimerModule->hContext);
188     } while (pTimerInfo != NULL);
189 }
190 
tmr_ClearOperQueue(TI_HANDLE hTimerModule)191 void tmr_ClearOperQueue (TI_HANDLE hTimerModule)
192 {
193     TTimerModule *pTimerModule = (TTimerModule *)hTimerModule;
194     TTimerInfo   *pTimerInfo;      /* The timer handle */
195 
196     do {
197         context_EnterCriticalSection (pTimerModule->hContext);
198         pTimerInfo = que_Dequeue (pTimerModule->hOperQueue);
199         context_LeaveCriticalSection (pTimerModule->hContext);
200     } while (pTimerInfo != NULL);
201 }
202 
203 
204 /**
205  * \fn     tmr_Init
206  * \brief  Init required handles
207  *
208  * Init required handles and module variables, create the init-queue and
209  *     operational-queue, and register as the context-engine client.
210  *
211  * \note
212  * \param  hTimerModule  - The queue object
213  * \param  hOs       - Handle to Os Abstraction Layer
214  * \param  hReport   - Handle to report module
215  * \param  hContext  - Handle to context module
216  * \return void
217  * \sa
218  */
tmr_Init(TI_HANDLE hTimerModule,TI_HANDLE hOs,TI_HANDLE hReport,TI_HANDLE hContext)219 void tmr_Init (TI_HANDLE hTimerModule, TI_HANDLE hOs, TI_HANDLE hReport, TI_HANDLE hContext)
220 {
221     TTimerModule *pTimerModule = (TTimerModule *)hTimerModule;
222     TI_UINT32     uNodeHeaderOffset;
223 
224     pTimerModule->hOs           = hOs;
225     pTimerModule->hReport       = hReport;
226     pTimerModule->hContext      = hContext;
227 
228     pTimerModule->bOperState    = TI_FALSE;
229     pTimerModule->uTimersCount  = 0;
230     pTimerModule->uTwdInitCount = 0;
231 
232     /* The offset of the queue-node-header from timer structure entry is needed by the queue */
233     uNodeHeaderOffset = TI_FIELD_OFFSET(TTimerInfo, tQueNodeHdr);
234 
235     /* Create and initialize the Init and Operational queues (for timers expiry events) */
236     pTimerModule->hInitQueue = que_Create (pTimerModule->hOs,
237                                            pTimerModule->hReport,
238                                            EXPIRY_QUE_SIZE,
239                                            uNodeHeaderOffset);
240     pTimerModule->hOperQueue = que_Create (pTimerModule->hOs,
241                                            pTimerModule->hReport,
242                                            EXPIRY_QUE_SIZE,
243                                            uNodeHeaderOffset);
244 
245     /* Register to the context engine and get the client ID */
246     pTimerModule->uContextId = context_RegisterClient (pTimerModule->hContext,
247                                                        tmr_HandleExpiry,
248                                                        hTimerModule,
249                                                        TI_TRUE,
250                                                        "TIMER",
251                                                        sizeof("TIMER"));
252 }
253 
254 
255 /**
256  * \fn     tmr_UpdateDriverState
257  * \brief  Update driver state
258  *
259  * Under critical section, update driver state (operational or not),
260  *   and if opertional, clear init queue.
261  * Leave critical section and if operational state, request schedule for handling
262  *   timer events in driver context (if any).
263  *
264  * \note
265  * \param  hTimerModule - The timer module object
266  * \param  bOperState   - TRUE if driver state is now operational, FALSE if not.
267  * \return void
268  * \sa
269  */
tmr_UpdateDriverState(TI_HANDLE hTimerModule,TI_BOOL bOperState)270 void tmr_UpdateDriverState (TI_HANDLE hTimerModule, TI_BOOL bOperState)
271 {
272     TTimerModule *pTimerModule = (TTimerModule *)hTimerModule;
273     TTimerInfo   *pTimerInfo;      /* The timer handle */
274 
275     /* Enter critical section */
276     context_EnterCriticalSection (pTimerModule->hContext);
277 
278     if (bOperState == pTimerModule->bOperState)
279     {
280         context_LeaveCriticalSection (pTimerModule->hContext);
281         TRACE1(pTimerModule->hReport, REPORT_SEVERITY_ERROR, "tmr_UpdateDriverState(): New bOperState (%d) is as current!\n", bOperState);
282         return;
283     }
284 
285     /* Save new state (TRUE means operational). */
286     pTimerModule->bOperState = bOperState;
287 
288     /* If new state is operational */
289     if (bOperState)
290     {
291         /* Increment the TWD initializations counter (for detecting recovery events). */
292         pTimerModule->uTwdInitCount++;
293     }
294 
295     /* Leave critical section */
296     context_LeaveCriticalSection (pTimerModule->hContext);
297 
298     /* If new state is operational */
299     if (bOperState)
300     {
301         /* Empty the init queue (obsolete). */
302         do {
303             context_EnterCriticalSection (pTimerModule->hContext);
304             pTimerInfo = que_Dequeue (pTimerModule->hInitQueue);
305             context_LeaveCriticalSection (pTimerModule->hContext);
306         } while (pTimerInfo != NULL);
307     }
308 
309     /* If new state is operational, request switch to driver context for handling timer events */
310     if (bOperState)
311     {
312         context_RequestSchedule (pTimerModule->hContext, pTimerModule->uContextId);
313     }
314 }
315 
316 
317 
318 /**
319  * \fn     tmr_CreateTimer
320  * \brief  Create a new timer
321  *
322  * Create a new timer object, icluding creating a timer in the OS-API.
323  *
324  * \note   This timer creation may be used only after tmr_Create() and tmr_Init() were executed!!
325  * \param  hTimerModule - The module handle
326  * \return TI_HANDLE    - The created timer handle
327  * \sa     tmr_DestroyTimer
328  */
tmr_CreateTimer(TI_HANDLE hTimerModule)329 TI_HANDLE tmr_CreateTimer (TI_HANDLE hTimerModule)
330 {
331     TTimerModule *pTimerModule = (TTimerModule *)hTimerModule; /* The timer module handle */
332     TTimerInfo   *pTimerInfo;  /* The created timer handle */
333 
334     /* Allocate timer object */
335     pTimerInfo = os_memoryAlloc (pTimerModule->hOs, sizeof(TTimerInfo));
336     if (!pTimerInfo)
337     {
338         WLAN_OS_REPORT (("tmr_CreateTimer():  Timer allocation failed!!\n"));
339         return NULL;
340     }
341     os_memoryZero (pTimerModule->hOs, pTimerInfo, (sizeof(TTimerInfo)));
342 
343     /* Allocate OS-API timer, providing the common expiry callback with the current timer handle */
344     pTimerInfo->hOsTimerObj = os_timerCreate(pTimerModule->hOs, tmr_GetExpiry, (TI_HANDLE)pTimerInfo);
345     if (!pTimerInfo->hOsTimerObj)
346     {
347         TRACE0(pTimerModule->hReport, REPORT_SEVERITY_CONSOLE ,"tmr_CreateTimer():  OS-API Timer allocation failed!!\n");
348         os_memoryFree (pTimerModule->hOs, pTimerInfo, sizeof(TTimerInfo));
349         WLAN_OS_REPORT (("tmr_CreateTimer():  OS-API Timer allocation failed!!\n"));
350         return NULL;
351     }
352 
353     /* Save the timer module handle in the created timer object (needed for the expiry callback) */
354     pTimerInfo->hTimerModule = hTimerModule;
355     pTimerModule->uTimersCount++;  /* count created timers */
356 
357     /* Return the created timer handle */
358     return (TI_HANDLE)pTimerInfo;
359 }
360 
361 
362 /**
363  * \fn     tmr_DestroyTimer
364  * \brief  Destroy the specified timer
365  *
366  * Destroy the specified timer object, icluding the timer in the OS-API.
367  *
368  * \note   This timer destruction function should be used before tmr_Destroy() is executed!!
369  * \param  hTimerInfo - The timer handle
370  * \return TI_OK on success or TI_NOK on failure
371  * \sa     tmr_CreateTimer
372  */
tmr_DestroyTimer(TI_HANDLE hTimerInfo)373 TI_STATUS tmr_DestroyTimer (TI_HANDLE hTimerInfo)
374 {
375     TTimerInfo *pTimerInfo = (TTimerInfo *)hTimerInfo;  /* The timer handle */
376     TTimerModule *pTimerModule;                  /* The timer module handle */
377 
378     if (!pTimerInfo)
379         return TI_NOK;
380     pTimerModule = (TTimerModule *)pTimerInfo->hTimerModule;
381     /* Free the OS-API timer */
382     if (pTimerInfo->hOsTimerObj) {
383         os_timerDestroy (pTimerModule->hOs, pTimerInfo->hOsTimerObj);
384         pTimerModule->uTimersCount--;  /* update created timers number */
385     }
386     /* Free the timer object */
387     os_memoryFree (pTimerModule->hOs, hTimerInfo, sizeof(TTimerInfo));
388     return TI_OK;
389 }
390 
391 
392 /**
393  * \fn     tmr_StartTimer
394  * \brief  Start a timer
395  *
396  * Start the specified timer running.
397  *
398  * \note   Periodic-Timer may be used by applications that serve the timer expiry
399  *           in a single context.
400  *         If an application can't finish serving the timer expiry in a single context,
401  *           e.g. periodic scan, then it isn't recommended to use the periodic timer service.
402  *         If such an application uses the periodic timer then it should protect itself from cases
403  *            where the timer expires again before the previous timer expiry processing is finished!!
404  * \param  hTimerInfo    - The specific timer handle
405  * \param  fExpiryCbFunc - The timer's expiry callback function.
406  * \param  hExpiryCbHndl - The client's expiry callback function handle.
407  * \param  uIntervalMsec - The timer's duration in Msec.
408  * \param  bPeriodic     - If TRUE, the timer is restarted after expiry.
409  * \return void
410  * \sa     tmr_StopTimer, tmr_GetExpiry
411  */
tmr_StartTimer(TI_HANDLE hTimerInfo,TTimerCbFunc fExpiryCbFunc,TI_HANDLE hExpiryCbHndl,TI_UINT32 uIntervalMsec,TI_BOOL bPeriodic)412 void tmr_StartTimer (TI_HANDLE     hTimerInfo,
413                      TTimerCbFunc  fExpiryCbFunc,
414                      TI_HANDLE     hExpiryCbHndl,
415                      TI_UINT32     uIntervalMsec,
416                      TI_BOOL       bPeriodic)
417 {
418     TTimerInfo   *pTimerInfo   = (TTimerInfo *)hTimerInfo;                 /* The timer handle */
419     TTimerModule *pTimerModule = (TTimerModule *)pTimerInfo->hTimerModule; /* The timer module handle */
420 
421     /* Save the timer parameters. */
422     pTimerInfo->fExpiryCbFunc            = fExpiryCbFunc;
423     pTimerInfo->hExpiryCbHndl            = hExpiryCbHndl;
424     pTimerInfo->uIntervalMsec            = uIntervalMsec;
425     pTimerInfo->bPeriodic                = bPeriodic;
426     pTimerInfo->bOperStateWhenStarted    = pTimerModule->bOperState;
427     pTimerInfo->uTwdInitCountWhenStarted = pTimerModule->uTwdInitCount;
428 
429     /* Start OS-API timer running */
430     os_timerStart(pTimerModule->hOs, pTimerInfo->hOsTimerObj, uIntervalMsec);
431 }
432 
433 
434 /**
435  * \fn     tmr_StopTimer
436  * \brief  Stop a running timer
437  *
438  * Stop the specified timer.
439  *
440  * \note   When using this function, it must be considered that timer expiry may happen
441  *           right before the timer is stopped, so it can't be assumed that this completely
442  *           prevents the timer expiry event!
443  * \param  hTimerInfo - The specific timer handle
444  * \return void
445  * \sa     tmr_StartTimer
446  */
tmr_StopTimer(TI_HANDLE hTimerInfo)447 void tmr_StopTimer (TI_HANDLE hTimerInfo)
448 {
449     TTimerInfo   *pTimerInfo   = (TTimerInfo *)hTimerInfo;                 /* The timer handle */
450     TTimerModule *pTimerModule = (TTimerModule *)pTimerInfo->hTimerModule; /* The timer module handle */
451 
452     /* Stop OS-API timer running */
453     os_timerStop(pTimerModule->hOs, pTimerInfo->hOsTimerObj);
454 
455     /* Clear periodic flag to prevent timer restart if we are in tmr_HandleExpiry context. */
456     pTimerInfo->bPeriodic = TI_FALSE;
457 }
458 
459 
460 /**
461  * \fn     tmr_GetExpiry
462  * \brief  Called by OS-API upon any timer expiry
463  *
464  * This is the common callback function called upon expiartion of any timer.
465  * It is called by the OS-API in timer expiry context and handles the transition
466  *   to the driver's context for handling the expiry event.
467  *
468  * \note
469  * \param  hTimerInfo - The specific timer handle
470  * \return void
471  * \sa     tmr_HandleExpiry
472  */
tmr_GetExpiry(TI_HANDLE hTimerInfo)473 void tmr_GetExpiry (TI_HANDLE hTimerInfo)
474 {
475     TTimerInfo   *pTimerInfo   = (TTimerInfo *)hTimerInfo;                 /* The timer handle */
476 	TTimerModule *pTimerModule = (TTimerModule *)pTimerInfo->hTimerModule; /* The timer module handle */
477 
478     /* Enter critical section */
479     context_EnterCriticalSection (pTimerModule->hContext);
480 
481     /*
482      * If the expired timer was started when the driver's state was Operational,
483      *   insert it to the Operational-queue
484      */
485     if (pTimerInfo->bOperStateWhenStarted)
486     {
487         que_Enqueue (pTimerModule->hOperQueue, hTimerInfo);
488     }
489 
490     /*
491      * Else (started when driver's state was NOT-Operational), if now the state is still
492      *   NOT Operational insert it to the Init-queue.
493      *   (If state changed from non-operational to operational the event is ignored)
494      */
495     else if (!pTimerModule->bOperState)
496     {
497         que_Enqueue (pTimerModule->hInitQueue, hTimerInfo);
498     }
499 
500     /* Leave critical section */
501     context_LeaveCriticalSection (pTimerModule->hContext);
502 
503     /* Request switch to driver context for handling timer events */
504     context_RequestSchedule (pTimerModule->hContext, pTimerModule->uContextId);
505 }
506 
507 
508 /**
509  * \fn     tmr_HandleExpiry
510  * \brief  Handles queued expiry events in driver context
511  *
512  * This is the Timer module's callback that is registered to the ContextEngine module to be invoked
513  *   from the driver task (after requested by tmr_GetExpiry through context_RequestSchedule ()).
514  * It dequeues all expiry events from the queue that correlates to the current driver state,
515  *   and calls their users callbacks.
516  *
517  * \note
518  * \param  hTimerModule - The module object
519  * \return void
520  * \sa     tmr_GetExpiry
521  */
tmr_HandleExpiry(TI_HANDLE hTimerModule)522 void tmr_HandleExpiry (TI_HANDLE hTimerModule)
523 {
524     TTimerModule *pTimerModule = (TTimerModule *)hTimerModule; /* The timer module handle */
525     TTimerInfo   *pTimerInfo;      /* The timer handle */
526     TI_BOOL       bTwdInitOccured; /* Indicates if TWD init occured since timer start */
527 
528     while (1)
529     {
530         /* Enter critical section */
531         context_EnterCriticalSection (pTimerModule->hContext);
532 
533         /* If current driver state is Operational, dequeue timer object from Operational-queue */
534         if (pTimerModule->bOperState)
535         {
536             pTimerInfo = (TTimerInfo *) que_Dequeue (pTimerModule->hOperQueue);
537         }
538 
539         /* Else (driver state is NOT-Operational), dequeue timer object from Init-queue */
540         else
541         {
542             pTimerInfo = (TTimerInfo *) que_Dequeue (pTimerModule->hInitQueue);
543         }
544 
545         /* Leave critical section */
546         context_LeaveCriticalSection (pTimerModule->hContext);
547 
548         /* If no more objects in queue, exit */
549         if (!pTimerInfo)
550         {
551             return;  /** EXIT Point **/
552         }
553 
554         /* If current TWD-Init-Count is different than when the timer was started, Init occured. */
555         bTwdInitOccured = (pTimerModule->uTwdInitCount != pTimerInfo->uTwdInitCountWhenStarted);
556 
557         /* Call specific timer callback function */
558         pTimerInfo->fExpiryCbFunc (pTimerInfo->hExpiryCbHndl, bTwdInitOccured);
559 
560         /* If the expired timer is periodic, start it again. */
561         if (pTimerInfo->bPeriodic)
562         {
563             tmr_StartTimer ((TI_HANDLE)pTimerInfo,
564                             pTimerInfo->fExpiryCbFunc,
565                             pTimerInfo->hExpiryCbHndl,
566                             pTimerInfo->uIntervalMsec,
567                             pTimerInfo->bPeriodic);
568         }
569     }
570 }
571 
572 
573 /**
574  * \fn     tmr_PrintModule / tmr_PrintTimer
575  * \brief  Print module / timer information
576  *
577  * Print the module's information / a specific timer information.
578  *
579  * \note
580  * \param  The module / timer handle
581  * \return void
582  * \sa
583  */
584 
585 #ifdef TI_DBG
586 
tmr_PrintModule(TI_HANDLE hTimerModule)587 void tmr_PrintModule (TI_HANDLE hTimerModule)
588 {
589     TTimerModule *pTimerModule = (TTimerModule *)hTimerModule;
590 
591     /* Print module parameters */
592     WLAN_OS_REPORT(("tmr_PrintModule(): uContextId=%d, bOperState=%d, uTwdInitCount=%d, uTimersCount=%d\n",
593     pTimerModule->uContextId, pTimerModule->bOperState,
594     pTimerModule->uTwdInitCount, pTimerModule->uTimersCount));
595 
596     /* Print Init Queue Info */
597     WLAN_OS_REPORT(("tmr_PrintModule(): Init-Queue:\n"));
598     que_Print(pTimerModule->hInitQueue);
599 
600     /* Print Operational Queue Info */
601     WLAN_OS_REPORT(("tmr_PrintModule(): Operational-Queue:\n"));
602     que_Print(pTimerModule->hOperQueue);
603 }
604 
tmr_PrintTimer(TI_HANDLE hTimerInfo)605 void tmr_PrintTimer (TI_HANDLE hTimerInfo)
606 {
607 #ifdef REPORT_LOG
608     TTimerInfo   *pTimerInfo   = (TTimerInfo *)hTimerInfo;                 /* The timer handle */
609 
610     WLAN_OS_REPORT(("tmr_PrintTimer(): uIntervalMs=%d, bPeriodic=%d, bOperStateWhenStarted=%d, uTwdInitCountWhenStarted=%d, hOsTimerObj=0x%x, fExpiryCbFunc=0x%x\n",
611     pTimerInfo->uIntervalMsec, pTimerInfo->bPeriodic, pTimerInfo->bOperStateWhenStarted,
612     pTimerInfo->uTwdInitCountWhenStarted, pTimerInfo->hOsTimerObj, pTimerInfo->fExpiryCbFunc));
613 #endif
614 }
615 
616 #endif /* TI_DBG */
617