drivers/ecos_lpc2138_sja1000/time_slicer.c
author dejoigny
Tue, 16 May 2006 17:21:14 +0200
changeset 7 126e37bcca0f
parent 0 4472ee7c6c3e
permissions -rw-r--r--
ajout filtrage msgs
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     1
/*
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     2
This file is part of CanFestival, a library implementing CanOpen Stack.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     3
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     4
 Author: Christian Fortin (canfestival@canopencanada.ca)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     5
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     6
See COPYING file for copyrights details.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     7
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     8
This library is free software; you can redistribute it and/or
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     9
modify it under the terms of the GNU Lesser General Public
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    10
License as published by the Free Software Foundation; either
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    11
version 2.1 of the License, or (at your option) any later version.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    12
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    13
This library is distributed in the hope that it will be useful,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    14
but WITHOUT ANY WARRANTY; without even the implied warranty of
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    16
Lesser General Public License for more details.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    17
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    18
You should have received a copy of the GNU Lesser General Public
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    19
License along with this library; if not, write to the Free Software
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    21
*/
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    22
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    23
#include <stdlib.h>
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    24
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    25
#include <sys/time.h>
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    26
#include <signal.h>
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    27
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    28
#include <cyg/kernel/kapi.h>
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    29
#include <cyg/hal/hal_arch.h>
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    30
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    31
#include "applicfg.h"
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    32
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    33
#include <timer.h>
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    34
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    35
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    36
#define max(a,b) a>b?a:b
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    37
#define min(a,b) a<b?a:b
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    38
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    39
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    40
// ---------  The timer table ---------
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    41
s_timer_entry timers[MAX_NB_TIMER] = {{TIMER_FREE, NULL, NULL, 0, 0, 0},};
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    42
TIMEVAL total_sleep_time = TIMEVAL_MAX;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    43
TIMER_HANDLE last_timer_raw = -1;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    44
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    45
cyg_alarm_t chrono_timer;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    46
cyg_alarm alarm_timer;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    47
cyg_handle_t alarm_handle_timer;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    48
cyg_handle_t rtclock, rtcounter;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    49
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    50
void init_timer(void)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    51
{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    52
	rtclock = cyg_real_time_clock();
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    53
	cyg_clock_to_counter(rtclock, &rtcounter);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    54
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    55
	cyg_alarm_create(rtcounter,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    56
                         &chrono_timer,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    57
                         0, 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    58
                         &alarm_handle_timer,
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    59
                         &alarm_timer);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    60
}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    61
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    62
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    63
unsigned int getElapsedTime(void)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    64
{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    65
	// HCS12 main timer :  Increment every 4 us.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    66
	return 0; // IO_PORTS_16(TCNTH);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    67
}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    68
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    69
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    70
void setTimer(TIMEVAL tm /* in ms? s? us? */)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    71
{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    72
/*
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    73
	this function is required by the library to make the scheduler work
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    74
	properly
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    75
	it is called by SetAlarm() (in src/timer.c)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    76
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    77
	the interrupt vector must call TimeDispatch() (in src/timer.c)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    78
*/
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    79
	/*
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    80
		value of alarm time for eCos
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    81
		  1 = 10 msec
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    82
		100 = 1 sec
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    83
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    84
#define MS_TO_TIMEVAL(ms) ms/10
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    85
#define US_TO_TIMEVAL(us) us*4
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    86
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    87
	*/
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    88
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    89
	cyg_alarm_initialize(alarm_handle_timer, tm, 0);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    90
}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    91
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    92
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    93
void chrono_timer(cyg_handle_t alarm, cyg_addrword_t data)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    94
{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    95
	int i;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    96
	int next_wakeup = TIMEVAL_MAX; // used to compute when should normaly occur next wakeup
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    97
	// First run : change timer state depending on time
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    98
	// Get time since timer signal
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
    99
	int overrun = getElapsedTime();
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   100
	
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   101
	int real_total_sleep_time = total_sleep_time + overrun;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   102
	
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   103
	for(i=0; i <= last_timer_raw; i++)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   104
	{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   105
		s_timer_entry *row = (timers+i);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   106
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   107
		if (row->state & TIMER_ARMED) // if row is active
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   108
		{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   109
			if (row->val <= real_total_sleep_time) // to be trigged
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   110
			{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   111
				if (!row->interval) // if simply outdated
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   112
				{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   113
					row->state = TIMER_TRIG; // ask for trig
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   114
				}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   115
				else // or period have expired
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   116
				{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   117
					// set val as interval, with overrun correction
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   118
					row->val = row->interval - (overrun % row->interval);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   119
					row->state = TIMER_TRIG_PERIOD; // ask for trig, periodic
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   120
					// Check if this new timer value is the soonest
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   121
					next_wakeup = min(row->val,next_wakeup);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   122
				}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   123
			}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   124
			else
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   125
			{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   126
				// Each armed timer value in decremented.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   127
				row->val -= real_total_sleep_time;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   128
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   129
				// Check if this new timer value is the soonest
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   130
				next_wakeup = min(row->val,next_wakeup);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   131
			}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   132
		}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   133
	}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   134
	
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   135
	// Remember how much time we should sleep.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   136
	total_sleep_time = next_wakeup;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   137
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   138
	// Set timer to soonest occurence
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   139
	setTimer(next_wakeup);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   140
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   141
	// Then trig them or not.
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   142
	for(i=0; i<=last_timer_raw; i++)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   143
	{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   144
		s_timer_entry *row = (timers+i);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   145
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   146
		if (row->state & TIMER_TRIG)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   147
		{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   148
			row->state &= ~TIMER_TRIG; // reset trig state (will be free if not periodic)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   149
			(*row->callback)(row->d, row->id); // trig !
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   150
		}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   151
	}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   152
}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   153
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   154
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   155
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   156
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   157
TIMER_HANDLE SetAlarm(CO_Data* d, UNS32 id, TimerCallback_t callback, TIMEVAL value, TIMEVAL period)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   158
{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   159
	int i;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   160
	TIMER_HANDLE row_number = TIMER_NONE;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   161
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   162
	if (callback == NULL) // nothing to store
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   163
		return TIMER_NONE;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   164
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   165
	// in order to decide new timer setting we have to run over all timer rows
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   166
	
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   167
	for(i=0; i <= last_timer_raw + 1 && i < MAX_NB_TIMER; i++)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   168
	{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   169
		s_timer_entry *row = (timers+i);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   170
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   171
		if (row->state == TIMER_FREE) // an empty row
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   172
		{	// just store
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   173
			row->callback = callback;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   174
			row->d = d;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   175
			row->id = id;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   176
			row->val = value;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   177
			row->interval = period;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   178
			row->state = TIMER_ARMED;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   179
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   180
			row_number = i;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   181
			break;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   182
		}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   183
	}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   184
	
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   185
	if (row_number != TIMER_NONE) // if successfull
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   186
	{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   187
		if (row_number == last_timer_raw + 1) last_timer_raw++;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   188
		
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   189
		// set next wakeup alarm if new entry is sooner than others, or if it is alone
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   190
		unsigned int real_timer_value = min(value, TIMEVAL_MAX);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   191
		unsigned int elapsed_time = getElapsedTime();
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   192
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   193
		if (total_sleep_time > elapsed_time && total_sleep_time - elapsed_time > real_timer_value)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   194
		{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   195
			total_sleep_time = elapsed_time + real_timer_value;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   196
			setTimer(real_timer_value);
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   197
		}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   198
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   199
		return row_number;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   200
	}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   201
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   202
	return TIMER_NONE;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   203
}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   204
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   205
// ---------  Use this to remove an alarm ---------
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   206
TIMER_HANDLE DelAlarm(TIMER_HANDLE handle)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   207
{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   208
	if (handle != TIMER_NONE)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   209
	{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   210
		if (handle == last_timer_raw) 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   211
			last_timer_raw--;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   212
		timers[handle].state = TIMER_FREE; 		
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   213
	}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   214
	else 
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   215
	{
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   216
	}
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   217
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   218
	return TIMER_NONE;
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   219
}