Lines Matching full:timer
2 * timer.c
35 /** \file timer.c
36 * \brief The timers services OS-Independent layer over the OS-API timer services which are OS-Dependent.
38 * \see timer.h, osapi.c
47 #include "timer.h"
52 /* The timer module structure (common to all timers) */
66 /* Per timer structure */
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 */
74 TI_UINT32 uIntervalMsec; /* The timer duration in Msec */
76 TI_BOOL bOperStateWhenStarted; /* The bOperState value when the timer was started */
77 TI_UINT32 uTwdInitCountWhenStarted; /* The uTwdInitCount value when the timer was started */
85 * \brief Create the timer module
87 * Allocate and clear the timer module object.
89 * \note This is NOT a specific timer creation! (see tmr_CreateTimer)
119 * \note This is NOT a specific timer destruction! (see tmr_DestroyTimer)
130 WLAN_OS_REPORT (("tmr_Destroy(): ERROR - NULL timer!\n"));
137 WLAN_OS_REPORT (("tmr_Destroy(): ERROR - Destroying Timer module but not all timers were destroyed!!\n"));
171 WLAN_OS_REPORT (("tmr_Free(): ERROR - NULL timer!\n"));
196 TTimerInfo *pTimerInfo; /* The timer handle */
208 TTimerInfo *pTimerInfo; /* The timer handle */
240 WLAN_OS_REPORT (("tmr_Init(): ERROR - NULL timer!\n"));
252 /* The offset of the queue-node-header from timer structure entry is needed by the queue */
270 "TIMER",
271 sizeof("TIMER"));
282 * timer events in driver context (if any).
285 * \param hTimerModule - The timer module object
293 TTimerInfo *pTimerInfo; /* The timer handle */
297 WLAN_OS_REPORT (("tmr_UpdateDriverState(): ERROR - NULL timer!\n"));
335 /* If new state is operational, request switch to driver context for handling timer events */
346 * \brief Create a new timer
348 * Create a new timer object, icluding creating a timer in the OS-API.
350 * \note This timer creation may be used only after tmr_Create() and tmr_Init() were executed!!
352 * \return TI_HANDLE - The created timer handle
357 TTimerModule *pTimerModule = (TTimerModule *)hTimerModule; /* The timer module handle */
358 TTimerInfo *pTimerInfo; /* The created timer handle */
362 WLAN_OS_REPORT (("tmr_CreateTimer(): ERROR - NULL timer!\n"));
366 /* Allocate timer object */
370 WLAN_OS_REPORT (("tmr_CreateTimer(): Timer allocation failed!!\n"));
375 /* Allocate OS-API timer, providing the common expiry callback with the current timer handle */
379 TRACE0(pTimerModule->hReport, REPORT_SEVERITY_CONSOLE ,"tmr_CreateTimer(): OS-API Timer allocation failed!!\n");
381 WLAN_OS_REPORT (("tmr_CreateTimer(): OS-API Timer allocation failed!!\n"));
385 /* Save the timer module handle in the created timer object (needed for the expiry callback) */
389 /* Return the created timer handle */
396 * \brief Destroy the specified timer
398 * Destroy the specified timer object, icluding the timer in the OS-API.
400 * \note This timer destruction function should be used before tmr_Destroy() is executed!!
401 * \param hTimerInfo - The timer handle
407 TTimerInfo *pTimerInfo = (TTimerInfo *)hTimerInfo; /* The timer handle */
408 TTimerModule *pTimerModule; /* The timer module handle */
417 WLAN_OS_REPORT (("tmr_DestroyTimer(): ERROR - NULL timer!\n"));
421 /* Free the OS-API timer */
426 /* Free the timer object */
434 * \brief Start a timer
436 * Start the specified timer running.
438 * \note Periodic-Timer may be used by applications that serve the timer expiry
440 * If an application can't finish serving the timer expiry in a single context,
441 * e.g. periodic scan, then it isn't recommended to use the periodic timer service.
442 * If such an application uses the periodic timer then it should protect itself from cases
443 * where the timer expires again before the previous timer expiry processing is finished!!
444 * \param hTimerInfo - The specific timer handle
445 * \param fExpiryCbFunc - The timer's expiry callback function.
447 * \param uIntervalMsec - The timer's duration in Msec.
448 * \param bPeriodic - If TRUE, the timer is restarted after expiry.
458 TTimerInfo *pTimerInfo = (TTimerInfo *)hTimerInfo; /* The timer handle */
459 TTimerModule *pTimerModule = (TTimerModule *)pTimerInfo->hTimerModule; /* The timer module handle */
463 WLAN_OS_REPORT (("tmr_StartTimer(): ERROR - NULL timer!\n"));
467 /* Save the timer parameters. */
475 /* Start OS-API timer running */
482 * \brief Stop a running timer
484 * Stop the specified timer.
486 * \note When using this function, it must be considered that timer expiry may happen
487 * right before the timer is stopped, so it can't be assumed that this completely
488 * prevents the timer expiry event!
489 * \param hTimerInfo - The specific timer handle
495 TTimerInfo *pTimerInfo = (TTimerInfo *)hTimerInfo; /* The timer handle */
496 TTimerModule *pTimerModule = (TTimerModule *)pTimerInfo->hTimerModule; /* The timer module handle */
500 WLAN_OS_REPORT (("tmr_StopTimer(): ERROR - NULL timer!\n"));
504 /* Stop OS-API timer running */
507 /* Clear periodic flag to prevent timer restart if we are in tmr_HandleExpiry context. */
514 * \brief Called by OS-API upon any timer expiry
516 * This is the common callback function called upon expiartion of any timer.
517 * It is called by the OS-API in timer expiry context and handles the transition
521 * \param hTimerInfo - The specific timer handle
527 TTimerInfo *pTimerInfo = (TTimerInfo *)hTimerInfo; /* The timer handle */
528 TTimerModule *pTimerModule = (TTimerModule *)pTimerInfo->hTimerModule; /* The timer module handle */
532 WLAN_OS_REPORT (("tmr_GetExpiry(): ERROR - NULL timer!\n"));
540 * If the expired timer was started when the driver's state was Operational,
561 /* Request switch to driver context for handling timer events */
570 * This is the Timer module's callback that is registered to the ContextEngine module to be invoked
582 TTimerModule *pTimerModule = (TTimerModule *)hTimerModule; /* The timer module handle */
583 TTimerInfo *pTimerInfo; /* The timer handle */
584 TI_BOOL bTwdInitOccured; /* Indicates if TWD init occured since timer start */
588 WLAN_OS_REPORT (("tmr_HandleExpiry(): ERROR - NULL timer!\n"));
597 /* If current driver state is Operational, dequeue timer object from Operational-queue */
603 /* Else (driver state is NOT-Operational), dequeue timer object from Init-queue */
618 /* If current TWD-Init-Count is different than when the timer was started, Init occured. */
621 /* Call specific timer callback function */
624 /* If the expired timer is periodic, start it again. */
639 * \brief Print module / timer information
641 * Print the module's information / a specific timer information.
644 * \param The module / timer handle
657 WLAN_OS_REPORT (("tmr_PrintModule(): ERROR - NULL timer!\n"));
678 TTimerInfo *pTimerInfo = (TTimerInfo *)hTimerInfo; /* The timer handle */