wonx/UNIXTimer.h
Hiroaki Sakai 0f43e6d6ee Added interrupt handling. Timer interrupt support.
(UNIXTimer, WWInterrupt, WWTimer, WonxSystem addition)
According to interrupt support, compatibility functions are replaced with UNIXTimer_Pause (), UNIXTimer_Unpause ()
It hung around.
UNIXTimer, WWTimer, WonxSystem's callback functions,
It is necessary to check finely whether there are bugs peculiar to interrupts.
(The setting of the interrupt in the callback function may change, or from the callback function
It is necessary to check whether the callback function is called or not)

Version 0.2 beta - from wonx-b02.tar.gz
2018-03-07 23:05:54 +00:00

102 lines
4.5 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef _UNIXTimer_h_INCLUDED_
#define _UNIXTimer_h_INCLUDED_
/*****************************************************************************/
/* ここから */
/*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
/*****************************************************************************/
/* クラスの定義 */
/*****************************************************************************/
typedef struct _UNIXTimer * UNIXTimer;
typedef int (*UNIXTimerCallBack)(void *);
/*****************************************************************************/
/* メンバ関数の宣言 */
/*****************************************************************************/
/*---------------------------------------------------------------------------*/
/* タイマの ON, OFF */
/*---------------------------------------------------------------------------*/
int UNIXTimer_ON(UNIXTimer unix_timer);
int UNIXTimer_OFF(UNIXTimer unix_timer);
int UNIXTimer_IsON(UNIXTimer unix_timer);
int UNIXTimer_IsOFF(UNIXTimer unix_timer);
/*---------------------------------------------------------------------------*/
/* 一時停止 */
/*---------------------------------------------------------------------------*/
/*
* 関数の先頭と末尾を Pause, Unpause でくくるばあいなどは,
* 関数から関数を呼び出したときに,2重 Pause, Unpause が起きるので
* 注意すること.(ただし,ポーズはネストできる)
*/
/*
* ポーズはネストされるのでUNIXTimer_Unpause() を安易に繰り返し呼んだり
* しないように注意すること.
*/
int UNIXTimer_Pause(UNIXTimer unix_timer);
int UNIXTimer_Unpause(UNIXTimer unix_timer);
int UNIXTimer_IsPause(UNIXTimer unix_timer);
/*---------------------------------------------------------------------------*/
/* オートプリセット */
/*---------------------------------------------------------------------------*/
int UNIXTimer_SetAutoPreset(UNIXTimer unix_timer);
int UNIXTimer_ResetAutoPreset(UNIXTimer unix_timer);
int UNIXTimer_IsAutoPreset(UNIXTimer unix_timer);
/*---------------------------------------------------------------------------*/
/* インターバル */
/*---------------------------------------------------------------------------*/
int UNIXTimer_GetInterval(UNIXTimer unix_timer);
int UNIXTimer_SetInterval(UNIXTimer unix_timer, int interval);
/*---------------------------------------------------------------------------*/
/* コールバック関数の呼び出し時のパラメータ */
/*---------------------------------------------------------------------------*/
void * UNIXTimer_GetParameter(UNIXTimer unix_timer);
void * UNIXTimer_Setparameter(UNIXTimer unix_timer, void * parameter);
/*---------------------------------------------------------------------------*/
/* コールバック関数の取得・登録 */
/*---------------------------------------------------------------------------*/
UNIXTimerCallBack UNIXTimer_GetCallBack(UNIXTimer unix_timer);
UNIXTimerCallBack UNIXTimer_SetCallBack(UNIXTimer unix_timer,
UNIXTimerCallBack callback);
/*---------------------------------------------------------------------------*/
/* オブジェクトの作成 */
/*---------------------------------------------------------------------------*/
UNIXTimer UNIXTimer_Create(int auto_preset, int interval, void * parameter,
UNIXTimerCallBack callback);
/*---------------------------------------------------------------------------*/
/* オブジェクトの削除 */
/*---------------------------------------------------------------------------*/
UNIXTimer UNIXTimer_Destroy(UNIXTimer unix_timer);
/*****************************************************************************/
/* ここまで */
/*****************************************************************************/
#endif
/*****************************************************************************/
/* End of File. */
/*****************************************************************************/