alarm.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *  $Id: event.h 156 2008-06-28 10:05:26Z merdmann $
00003  *
00004  *  Thu Nov 29 20:55:57 2007
00005  *  Copyright  2007 Michael Erdmann
00006  *  Email: michael.erdmann@snafu.de
00007  ****************************************************************************/
00008 
00009 /*
00010  *  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU General Public License for more details.
00019  *
00020  *  You should have received a copy of the GNU General Public License
00021  *  along with this program; if not, write to the Free Software
00022  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00023  */
00024 
00029 #ifndef _ALARM_H
00030 #define _ALARM_H
00031 
00032 #define ALARMCALLBACK(x)  void x(AlarmType AlarmID)
00033 
00035 typedef unsigned TickType;
00036 
00037 /* This data type points to the data type TickType.*/
00038 typedef TickType *TickRefType;
00039 
00041 typedef struct {
00042         TickType maxallowedvalue;       /* Maximum possible allowed count value in ticks */
00043         TickType ticksperbase;          /* Number of ticks required to reach a counter-specific unit*/
00044         TickType mincycle;                      /* Smallest allowed value for the cycle-parameter */
00045 } AlarmBaseType;
00046 
00047 typedef AlarmBaseType* AlarmBaseRefType;
00048 
00049 typedef struct {
00050         unsigned value;
00051         unsigned ticks;
00052 
00053         AlarmBaseType *base;
00054 } t_counter;
00055 
00056 /* internal presentation of an alarm */
00057 typedef struct {
00058         BOOL            active;
00059         unsigned        expire;
00060         unsigned        cycle;
00061         t_counter       *counter;
00062 } t_alarm;
00063 
00064 
00065 typedef t_alarm* AlarmType;     /* This data type represents an alarm object. */
00066 
00076 StatusType GetAlarmBase ( AlarmType AlarmId, AlarmBaseRefType info );
00077 
00086 StatusType GetAlarm ( AlarmType AlarmID, TickRefType Info);
00087 
00112 StatusType SetRelAlarm ( AlarmType AlarmID, TickType increment, TickType cycle );
00113 
00141 StatusType SetAbsAlarm ( AlarmType AlarmID, TickType start, TickType cycle );
00142 
00148 StatusType CancelAlarm ( AlarmType AlarmID );
00149 
00150 
00151 #endif

Generated on Mon Sep 29 19:56:47 2008 for mKernel by  doxygen 1.4.6