?? am_timers.cc
字號:
/* (c) Copyright Motorola 1996-2002, All rights reserved. Motorola Confidential Proprietary Contains confidential proprietary information of Motorola, Inc. Reverse engineering is prohibited. The copyright notice does not imply publication. DESCRIPTION: This function contains the AM Application Layer main driver routines. These functions build up information for the hardware layer, and then all at once, pass it to the hardware layer. *************** REVISION HISTORY ********************************************* Date Author Reference ======== ======== ========================== 99-11-10 bchoi CR - CSGce39480 Modify Audio Manager timer functionality to use SUAPI compliant timers.******************************************************************************/#include <audio/AM_Timers.H>#include <audio/AM_Event_Handler.H>#include <audio/am_server_task.h>#include <audio/AM_Tone_Sequence_Handler.H>extern AM_Event_Handler * am_event_handler;//===============================================================================// Function: Constructor// Initialize all attributes of the class//===============================================================================AM_Timer_Base::AM_Timer_Base(){ Next = NULL; Prev = NULL; InitialDelay = 0; Delay = 0; SeqIndex = 0; Active = FALSE;}//===============================================================================// Function: Destructor//// - Does nothing the destructor does not need to be virtual, nothing// // //===============================================================================AM_Timer_Base::~AM_Timer_Base(){}//===============================================================================// Function: StartSequence // - This is the beginning of a sequence of timers, this will initialize// the delay to the first value. RunSequence takes over on each timer event // NOTES:// The return code on this function tells us if the delay is 0 or not. // The timer handler will set the tasks event immediately if it is zero. // Historically: the suapi layer rejects 0 and LONGMAX//===============================================================================BOOL AM_Timer_Base::StartSequence(){ Active = TRUE; Delay = InitialDelay; SeqIndex = 0; if(Delay == 0) { return TRUE; } return FALSE;}//===============================================================================// Function: GenerateTone// Easy way to get to the event handler.....//===============================================================================void AM_Timer_Base::GenerateTone( UINT16 tone_type, UINT16 request){// am_event_handler->am_event_logic_processor.generate_tone(tone_type, request);}//===============================================================================// Function:Expired() *****THIS ONE IS IMPORTANT******//// - We will see if our time has run out, if it has then Run the Sequence// if the timer is zero after the sequence is run, then this timer is done// return TRUE to have the timer handler remove us from the list //===============================================================================#if (AUDIO_RAINBOW == TRUE)BOOL AM_Timer_Base::Expired(SU_PAL_TICKS tic)#elseBOOL AM_Timer_Base::Expired(SU_TICKS tic)#endif{ Delay = Delay - tic; if(Delay <= 0) { Delay = 0; RunSequence(); } if(Delay >0) { Active = TRUE; return FALSE; } Active = FALSE; return TRUE;}//===============================================================================// Function: ResetTimer// Reset the Timer to a new value//===============================================================================#if (AUDIO_RAINBOW == TRUE)void AM_Timer_Base::ResetTimer(SU_PAL_TICKS ticks)#elsevoid AM_Timer_Base::ResetTimer(SU_TICKS ticks)#endif{ Delay = ticks;}//===============================================================================// Function IsActive// See if the timer is active, Boolean is an easy way to keep track if // it is in the list or not//===============================================================================BOOL AM_Timer_Base::IsActive(){ return Active;}//===============================================================================// Function SetActive// Member function to set the active flag//===============================================================================void AM_Timer_Base::SetActive(BOOL state){ Active = state;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -