📄 timers.h
字号:
/* **************************************************************************************
* Copyright (c) 2001 ZORAN Corporation, All Rights Reserved
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
*
* File: "timers.h" 12/13/01
*
* Description:
* ============
* Declaration for handling periodic function calls
*
* Log:
* ====
* $Revision: 4 $
* Last Modified by $Author: Nirm $ at $Modtime: 23/04/02 9:06 $
****************************************************************************************
* Updates:
****************************************************************************************
* $Log: /I49/H49V/Kernel/Timers/Timers.h $
*
* 4 23/04/02 9:26 Nirm
* - Added dependency in "Config.h".
*
* 3 10/04/02 11:28 Ettim
* Added timer_service_is_active() method.
*
* 2 26/03/02 10:44 Nirm
* - Prototypes changed;
* - Documentation updated.
*
* 1 25/03/02 13:02 Nirm
* Preliminary version.
*
* 6 17/02/02 11:40 Atai
* Correct to absolute include path
*
* 5 2/11/02 8:38 Yarone
* Added change of frerquency to timers
*
* 4 1/13/02 9:29 Yarone
* Added attributes of enable/disable and once
*
* 3 1/01/02 7:45 Yarone
* Added function description
*
* 2 12/13/01 18:43 Yarone
* correct prototypes
*
* 1 12/13/01 18:25 Yarone
*
**************************************************************************************** */
#include "Config.h" // Global Configuration - do not remove!
#ifndef __TIMERS_H_
#define __TIMERS_H_
#include "Include\SysDefs.h"
/////////////////////////////////////////////////////////////////////////////
// Constants and Enumerations
typedef enum
{
TIMER_DISABLED = 0,
TIMER_ENABLED = 1,
TIMER_ENABLE_MASK = 1,
TIMER_REPEAT = 0,
TIMER_ONCE = 2,
TIMER_ONCE_MASK = 2
} TIMER_ATTRIBUTES;
/////////////////////////////////////////////////////////////////////////////
// Types
typedef void (_far *LPTIMERPROC)(UINT8 hTimer);
/////////////////////////////////////////////////////////////////////////////
// Public Services
/**********************************************************************************
* Purpose : Creates a Timer service, which call some callback function
* periodically.
* Input Parameters : i_lpfTimerFunc - the function to be called every interval
* : Freq - the frequency in mSec (will be rounded to the timer
* : frequency)
* : uAttributes - bitwise-or combination of timer attributes.
* Return Value : A handle to the Timer on success; NULL on failure.
* Description :
* Comments : Functions called periodically are called in interrupt context so
* : they must not call blocking services and should be as short as
* : possible!
**********************************************************************************/
UINT8 timer_service_create(LPTIMERPROC i_lpfTimerFunc, UINT16 uFreq,
TIMER_ATTRIBUTES uAttributes);
/**********************************************************************************
* Purpose : Remove a function from the periodic calls
* Input Parameters : hTimer - A handle to the timer returned from a previous
* call to timer_service_create().
* Return Value : TRUE if the timer was successfully removed; FALSE otherwise.
* Description :
* Comments :
**********************************************************************************/
BOOL timer_service_delete(UINT8 hTimer);
/**********************************************************************************
* Purpose : Start a timer count
* Input Parameters : hTimer - A handle to the timer returned from a previous
* call to timer_service_create().
* : bResetCount - if the counter is to be reset or the counting continued
* Return Value : TRUE if the Timer was successfully enabled; FALSE otherwise.
* Description :
* Comments : can be used to restart a count of a counter that has not yet elapsed
**********************************************************************************/
BOOL timer_service_enable(UINT8 hTimer, BOOL bResetCount);
/**********************************************************************************
* Purpose : Stop a timer count
* Input Parameters : hTimer - A handle to the timer returned from a previous
* call to timer_service_create().
* Return Value : TRUE if the Timer was successfully disabled; FALSE otherwise.
* Description :
* Comments :
**********************************************************************************/
BOOL timer_service_disable(UINT8 hTimer);
/**********************************************************************************
* Purpose : Change the timer time period
* Input Parameters : hTimer - A handle to the timer returned from a previous
* call to timer_service_create().
* : uNewFreq - the new frequency
* Return Value : TRUE if the Timer's frequency was successfully changed;
* FALSE otherwise.
* Description :
* Comments : Effect is from next even (current count is not effected)
**********************************************************************************/
BOOL timer_service_set_freq(UINT8 hTimer, UINT16 uNewFreq);
/**********************************************************************************
* Purpose : Getting the indication whether a timer is disabled or enabled.
* Input Parameters : hTimer - A handle to the timer returned from a previous
* call to timer_service_create().
* Return Value : TRUE if the Timer is enabled
* FALSE otherwise.
* Description :
**********************************************************************************/
BOOL timer_service_is_active(UINT8 hTimer);
#endif //__TIMERS_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -