nico@215: nico@215: nico@215: CanFestival: include/timer.h Source File nico@215: nico@215: nico@215: nico@215: nico@215:
nico@215:
nico@215:
nico@215:
nico@215: nico@215:

timer.h

Go to the documentation of this file.
00001 /*
nico@215: 00002 This file is part of CanFestival, a library implementing CanOpen Stack. 
nico@215: 00003 
nico@215: 00004 Copyright (C): Edouard TISSERANT and Francis DUPIN
nico@215: 00005 
nico@215: 00006 See COPYING file for copyrights details.
nico@215: 00007 
nico@215: 00008 This library is free software; you can redistribute it and/or
nico@215: 00009 modify it under the terms of the GNU Lesser General Public
nico@215: 00010 License as published by the Free Software Foundation; either
nico@215: 00011 version 2.1 of the License, or (at your option) any later version.
nico@215: 00012 
nico@215: 00013 This library is distributed in the hope that it will be useful,
nico@215: 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of
nico@215: 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
nico@215: 00016 Lesser General Public License for more details.
nico@215: 00017 
nico@215: 00018 You should have received a copy of the GNU Lesser General Public
nico@215: 00019 License along with this library; if not, write to the Free Software
nico@215: 00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
nico@215: 00021 */
nico@215: 00022 
nico@215: 00023 #ifndef __timer_h__
nico@215: 00024 #define __timer_h__
nico@215: 00025 
nico@215: 00026 #include <timerscfg.h>
nico@215: 00027 #include <applicfg.h>
nico@215: 00028 
etisserant@240: 00029 #define TIMER_HANDLE INTEGER16
nico@215: 00030 
nico@215: 00031 #include "data.h"
nico@215: 00032 
nico@215: 00033 /* --------- types and constants definitions --------- */
nico@215: 00034 #define TIMER_FREE 0
nico@215: 00035 #define TIMER_ARMED 1
nico@215: 00036 #define TIMER_TRIG 2
nico@215: 00037 #define TIMER_TRIG_PERIOD 3
nico@215: 00038 
nico@215: 00039 #define TIMER_NONE -1
nico@215: 00040 
etisserant@240: 00041 typedef void (*TimerCallback_t)(CO_Data* d, UNS32 id);
nico@215: 00042 
nico@215: 00043 struct struct_s_timer_entry {
etisserant@240: 00044         UNS8 state;
etisserant@240: 00045         CO_Data* d;
etisserant@240: 00046         TimerCallback_t callback; /* The callback func. */
etisserant@240: 00047         UNS32 id; /* The callback func. */
etisserant@240: 00048         TIMEVAL val;
etisserant@240: 00049         TIMEVAL interval; /* Periodicity */
nico@215: 00050 };
nico@215: 00051 
etisserant@240: 00052 typedef struct struct_s_timer_entry s_timer_entry;
nico@215: 00053 
nico@215: 00054 /* ---------  prototypes --------- */
nico@215: 00055 /*#define SetAlarm(d, id, callback, value, period) printf("%s, %d, SetAlarm(%s, %s, %s, %s, %s)\n",__FILE__, __LINE__, #d, #id, #callback, #value, #period); _SetAlarm(d, id, callback, value, period)*/
etisserant@240: 00056 TIMER_HANDLE SetAlarm(CO_Data* d, UNS32 id, TimerCallback_t callback, TIMEVAL value, TIMEVAL period);
etisserant@240: 00057 TIMER_HANDLE DelAlarm(TIMER_HANDLE handle);
etisserant@240: 00058 void TimeDispatch(void);
nico@215: 00059 
nico@215: 00060 /* ---------  to be defined in user app ---------*/
etisserant@240: 00061 void setTimer(TIMEVAL value);
etisserant@240: 00062 TIMEVAL getElapsedTime(void);
nico@215: 00063 
nico@215: 00064 #endif /* #define __timer_h__ */
etisserant@240: 

Generated on Mon Jul 2 19:10:16 2007 for CanFestival by  nico@215: nico@215: doxygen 1.5.1
nico@215: nico@215: