avtimer.h

来自「AMLOGIC DPF source code」· C头文件 代码 · 共 140 行

H
140
字号
/*******************************************************************
 * 
 *  Copyright C 2005 by Amlogic, Inc. All Rights Reserved.
 *
 *  Description: Declarations for AVOS periodic timer functions
 *
 *  Author: Eric Knudstrup
 *  Created: Wed Apr  6 11:47:07 2005
 *
 *******************************************************************/

#ifndef AVTIMER_H
#define AVTIMER_H

typedef enum {
    AVTIMER_FLAG_NONE     = 0,      /* Default settings */
    AVTIMER_FLAG_DISABLED = (1<<0), /* Not in the timer queue */
    AVTIMER_FLAG_PERIODIC = (1<<1), /* Restart after each firing */
    AVTIMER_FLAG_FREE     = (1<<2), /* In the free list */
    AVTIMER_FLAG_AUTO_REFRESH = (1<<3), /* Auto restart when call AVTimerRefresh */
    AVTIMER_FLAG_AUTO_DELETE = (1<<4), /* Auto delete after firing */
} AVTimerFlag_t;

/* Timer service */
typedef void (*TIMER_CB_t)(void *arg);

typedef INT32S AVTimer_t;
#define AVTIMER_INVALID ((AVTimer_t)NULL)


/*;emacs generated header for file avtimer.c. Global function declarations only. */

/**
 * Configure AVOS timers.  Must be called before AVInit().
 * @param[in] stack_size Stack size for the timer task.  Default 512.
 * @param[in] count Number of timers available.  Default 16.
 */
extern void
AVTimerConfig(unsigned stack_size, unsigned count);

extern void
OS_TimerInit();

/**
 * Check if AVOS timer handle is enabled
 *
 * @return TRUE if enabled, FALSE if not
 */
extern int
AVTimerIsEnabled(AVTimer_t handle);

/**
 * Force an AVOS timer to fire.
 *
 * @return TRUE if the delete succeeded, FALSE if not.
 */
extern int
AVTimerForce(AVTimer_t handle);

/**
 * Release an AVOS timer.
 *
 * @return TRUE if the delete succeeded, FALSE if not.
 */
extern int
AVTimerDelete(AVTimer_t handle);

/** 
 * Change the timeout value for a previously allocated timer.
 */
extern void
AVTimerChangeTimeout(AVTimer_t handle, INT32U timeout);

/** 
 * Restart AVOS Timer handle using the timer queue using the 
 * previously set timeout value.
 */
extern void
AVTimerRestart(AVTimer_t handle);

/** 
 * Add AVOS Timer handle into the timer queue using the 
 * previously set timeout value.
 */
extern void
AVTimerEnable(AVTimer_t handle);

/** 
 * Remove AVOS Timer handle from the timer queue
 */
extern void
AVTimerDisable(AVTimer_t handle);

/**
 * Create a new AVOS timer. Only one instance of this callback address is allowed.
 * Must be called from task context.
 * @param IN timeout Time to wait in ticks.
 * @param IN callback User callback function.
 * @param IN arg Argument to user callback.
 * @returns Either an AVTimer_t handle or AVTIMER_INVALID if the timer allocation
 * was unsuccessful.
 */
extern AVTimer_t
AVTimerCreateNoRepeat(unsigned timeout, TIMER_CB_t callback, void *arg);

/**
 * Create a new AVOS timer. Must be called from task context.
 * @param IN timeout Time to wait in ticks.
 * @param IN callback User callback function.
 * @param IN arg Argument to user callback.
 * @returns Either an AVTimer_t handle or AVTIMER_INVALID if the timer allocation
 * was unsuccessful.
 */
extern AVTimer_t
AVTimerCreate(unsigned timeout, TIMER_CB_t callback, void *arg);

/**
 * Create a new AVOS timer with flags. Must be called from task context.
 * @param IN timeout Time to wait in ticks.
 * @param IN callback User callback function.
 * @param IN arg Argument to user callback.
 * @param IN flags Can be AVTIMER_FLAG_DISABLED (allocate, but don't activate),
 * AVTIMER_FLAG_PERIODIC (automatically reactivate after firing) or
 * AVTIMER_FLAG_NONE (default single shot setting).
 * @returns Either an AVTimer_t handle or AVTIMER_INVALID if the timer allocation
 * was unsuccessful.
 */
extern AVTimer_t
AVTimerCreateFlag(INT32U timeout, TIMER_CB_t callback, void *arg,
 AVTimerFlag_t flags);

/**
 * Restart all timer which flag is AVTIMER_FLAG_AUTO_REFRESH
 */
void AVTimerRefresh(void);

/*;end emacs generated header for file avtimer.c. Global function declarations only. */

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?