drivers/timers_xeno/timers_xeno.c
author Edouard Tisserant
Thu, 24 Jan 2019 13:53:01 +0100
changeset 808 de1fc3261f21
parent 807 46027bb24429
permissions -rw-r--r--
Adding -fPIC isn't necessary of xeno-config is set correctly. Backed out changeset b9f1fcda7d30
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
     1
#include <stdlib.h>
807
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
     2
47
8a1047ab51f4 SOCKET-CAN support added. Many thanks to Jan Kiszka !
etisserant
parents: 35
diff changeset
     3
#include <unistd.h>
807
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
     4
#include <stdint.h>
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
     5
#include <sys/time.h>
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
     6
#include <pthread.h>
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
     7
#include <signal.h>
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
     8
#include <sys/timerfd.h>
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
     9
#include <time.h>
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    10
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    11
#include <applicfg.h>
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    12
#include <timers.h>
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    13
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    14
static pthread_mutex_t CanFestival_mutex = PTHREAD_MUTEX_INITIALIZER;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    15
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    16
static pthread_mutex_t timer_mutex = PTHREAD_MUTEX_INITIALIZER;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    17
int tfd;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    18
static int timer_created = 0;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    19
struct timespec last_occured_alarm;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    20
struct timespec next_alarm;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    21
struct timespec time_ref;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    22
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    23
static pthread_t timer_thread; 
454
bc000083297a - add RTAI support
greg
parents: 170
diff changeset
    24
int stop_timer = 0;
bc000083297a - add RTAI support
greg
parents: 170
diff changeset
    25
807
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    26
/* Subtract the struct timespec values X and Y,
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    27
   storing the result in RESULT.
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    28
   Return 1 if the difference is negative, otherwise 0. */
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    29
int
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    30
timespec_subtract (struct timespec *result, struct timespec *x, struct timespec *y)
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    31
{
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    32
  /* Perform the carry for the later subtraction by updating y. */
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    33
  if (x->tv_nsec < y->tv_nsec) {
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    34
    int seconds = (y->tv_nsec - x->tv_nsec) / 1000000000L + 1;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    35
    y->tv_nsec -= 1000000000L * seconds;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    36
    y->tv_sec += seconds;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    37
  }
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    38
  if (x->tv_nsec - y->tv_nsec > 1000000000L) {
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    39
    int seconds = (x->tv_nsec - y->tv_nsec) / 1000000000L;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    40
    y->tv_nsec += 1000000000L * seconds;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    41
    y->tv_sec -= seconds;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    42
  }
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    43
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    44
  /* Compute the time remaining to wait.
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    45
     tv_nsec is certainly positive. */
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    46
  result->tv_sec = x->tv_sec - y->tv_sec;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    47
  result->tv_nsec = x->tv_nsec - y->tv_nsec;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    48
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    49
  /* Return 1 if result is negative. */
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    50
  return x->tv_sec < y->tv_sec;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    51
}
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    52
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    53
void timespec_add (struct timespec *result, struct timespec *x, struct timespec *y)
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    54
{
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    55
  result->tv_sec = x->tv_sec + y->tv_sec;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    56
  result->tv_nsec = x->tv_nsec + y->tv_nsec;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    57
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    58
  while (result->tv_nsec > 1000000000L) {
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    59
      result->tv_sec ++;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    60
      result->tv_nsec -= 1000000000L;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    61
  }
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    62
}
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    63
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    64
void TimerCleanup(void)
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    65
{
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    66
}
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    67
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    68
void EnterTimerMutex(void)
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    69
{
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    70
	if(pthread_mutex_lock(&timer_mutex)) {
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    71
		perror("pthread_mutex_lock(timer_mutex) failed\n");
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    72
	}
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    73
}
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    74
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    75
void LeaveTimerMutex(void)
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    76
{
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    77
	if(pthread_mutex_unlock(&timer_mutex)) {
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    78
		perror("pthread_mutex_unlock(timer_mutex) failed\n");
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    79
	}
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    80
}
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    81
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    82
void EnterMutex(void)
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    83
{
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    84
	if(pthread_mutex_lock(&CanFestival_mutex)) {
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    85
		perror("pthread_mutex_lock(CanFestival_mutex) failed\n");
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    86
	}
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    87
}
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    88
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    89
void LeaveMutex(void)
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    90
{
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    91
	if(pthread_mutex_unlock(&CanFestival_mutex)) {
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    92
		perror("pthread_mutex_unlock(CanFestival_mutex) failed\n");
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    93
	}
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    94
}
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    95
454
bc000083297a - add RTAI support
greg
parents: 170
diff changeset
    96
void TimerInit(void)
bc000083297a - add RTAI support
greg
parents: 170
diff changeset
    97
{
807
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    98
    /* Initialize absolute time references */
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
    99
    if(clock_gettime(CLOCK_MONOTONIC, &time_ref)){
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   100
        perror("clock_gettime(time_ref)");
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   101
    }
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   102
    next_alarm = last_occured_alarm = time_ref;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   103
}
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   104
454
bc000083297a - add RTAI support
greg
parents: 170
diff changeset
   105
void StopTimerLoop(TimerCallback_t exitfunction)
bc000083297a - add RTAI support
greg
parents: 170
diff changeset
   106
{
807
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   107
454
bc000083297a - add RTAI support
greg
parents: 170
diff changeset
   108
	stop_timer = 1;
807
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   109
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   110
    pthread_cancel(timer_thread);
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   111
    pthread_join(timer_thread, NULL);
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   112
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   113
	EnterMutex();
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   114
	exitfunction(NULL,0);
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   115
	LeaveMutex();
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   116
}
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   117
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   118
void* xenomai_timerLoop(void* unused)
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   119
{
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   120
    struct sched_param param = { .sched_priority = 80 };
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   121
    int ret;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   122
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   123
    if (ret = pthread_setname_np(pthread_self(), "canfestival_timer")) {
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   124
        fprintf(stderr, "pthread_setname_np(): %s\n",
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   125
                strerror(-ret));
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   126
        goto exit_timerLoop;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   127
    }
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   128
    
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   129
    if (ret = pthread_setschedparam(pthread_self(), SCHED_FIFO, &param)) {
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   130
        fprintf(stderr, "pthread_setschedparam(): %s\n",
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   131
                strerror(-ret));
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   132
        goto exit_timerLoop;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   133
    }
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   134
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   135
    EnterTimerMutex();
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   136
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   137
    tfd = timerfd_create(CLOCK_MONOTONIC, 0);
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   138
    if(tfd == -1) {
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   139
		perror("timer_create() failed\n");
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   140
        goto exit_timerLoop_timermutex;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   141
    }
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   142
    timer_created = 1;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   143
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   144
    while (!stop_timer)
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   145
    {
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   146
        uint64_t ticks;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   147
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   148
        LeaveTimerMutex();
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   149
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   150
        EnterMutex();
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   151
        TimeDispatch();
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   152
        LeaveMutex();
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   153
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   154
        /*  wait next timer occurence */
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   155
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   156
        ret = read(tfd, &ticks, sizeof(ticks));
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   157
        if (ret < 0) {
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   158
            perror("timerfd read()\n");
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   159
            break;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   160
        }
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   161
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   162
        EnterTimerMutex();
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   163
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   164
        last_occured_alarm = next_alarm;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   165
    }
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   166
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   167
    close(tfd);
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   168
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   169
    timer_created = 0;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   170
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   171
exit_timerLoop_timermutex:
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   172
    LeaveTimerMutex();
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   173
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   174
exit_timerLoop:
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   175
    return NULL;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   176
}
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   177
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   178
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   179
void StartTimerLoop(TimerCallback_t init_callback)
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   180
{
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   181
    int ret;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   182
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   183
	stop_timer = 0;	
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   184
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   185
	EnterMutex();
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   186
	// At first, TimeDispatch will call init_callback.
454
bc000083297a - add RTAI support
greg
parents: 170
diff changeset
   187
	SetAlarm(NULL, 0, init_callback, 0, 0);
807
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   188
	LeaveMutex();
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   189
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   190
    ret = pthread_create(&timer_thread, NULL, &xenomai_timerLoop, NULL);
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   191
    if (ret) {
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   192
        fprintf(stderr, "StartTimerLoop pthread_create(): %s\n",
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   193
                strerror(-ret));
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   194
    }
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   195
}
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   196
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   197
static void (*unixtimer_ReceiveLoop_task_proc)(CAN_PORT) = NULL;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   198
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   199
void* xenomai_canReceiveLoop(void* port)
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   200
{
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   201
    int ret;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   202
    struct sched_param param = { .sched_priority = 82 };
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   203
    pthread_setname_np(pthread_self(), "canReceiveLoop");
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   204
    pthread_setschedparam(pthread_self(), SCHED_FIFO, &param);
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   205
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   206
    unixtimer_ReceiveLoop_task_proc((CAN_PORT)port);
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   207
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   208
    return NULL;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   209
}
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   210
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   211
void CreateReceiveTask(CAN_PORT port, TASK_HANDLE* Thread, void* ReceiveLoopPtr)
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   212
{
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   213
    unixtimer_ReceiveLoop_task_proc = ReceiveLoopPtr;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   214
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   215
	if(pthread_create(Thread, NULL, xenomai_canReceiveLoop, (void*)port)) {
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   216
		perror("CreateReceiveTask pthread_create()");
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   217
	}
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   218
}
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   219
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   220
void WaitReceiveTaskEnd(TASK_HANDLE *Thread)
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   221
{
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   222
	if(pthread_cancel(*Thread)) {
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   223
		perror("pthread_cancel()");
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   224
	}
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   225
	if(pthread_join(*Thread, NULL)) {
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   226
		perror("pthread_join()");
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   227
	}
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   228
}
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   229
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   230
#define maxval(a,b) ((a>b)?a:b)
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   231
void setTimer(TIMEVAL value)
47
8a1047ab51f4 SOCKET-CAN support added. Many thanks to Jan Kiszka !
etisserant
parents: 35
diff changeset
   232
{
807
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   233
    struct itimerspec timerValues;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   234
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   235
    EnterTimerMutex();
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   236
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   237
    if(timer_created){
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   238
        long tv_nsec = (maxval(value,1)%1000000000LL);
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   239
        time_t tv_sec = value/1000000000LL;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   240
        timerValues.it_value.tv_sec = tv_sec;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   241
        timerValues.it_value.tv_nsec = tv_nsec;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   242
        timerValues.it_interval.tv_sec = 0;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   243
        timerValues.it_interval.tv_nsec = 0;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   244
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   245
        /* keep track of when should alarm occur*/
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   246
        timespec_add(&next_alarm, &time_ref, &timerValues.it_value);
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   247
        timerfd_settime (tfd, 0, &timerValues, NULL);
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   248
    }
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   249
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   250
    LeaveTimerMutex();
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   251
}
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   252
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   253
0
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   254
TIMEVAL getElapsedTime(void)
4472ee7c6c3e Commit a new cvs repo.
etisserant
parents:
diff changeset
   255
{
807
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   256
    struct itimerspec outTimerValues;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   257
    struct timespec ts;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   258
    struct timespec last_occured_alarm_copy;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   259
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   260
    TIMEVAL res = 0;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   261
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   262
    EnterTimerMutex();
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   263
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   264
    if(timer_created){
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   265
        if(clock_gettime(CLOCK_MONOTONIC, &time_ref)){
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   266
            perror("clock_gettime(ts)");
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   267
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   268
        }
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   269
        /* timespec_substract modifies second operand */
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   270
        last_occured_alarm_copy = last_occured_alarm;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   271
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   272
        timespec_subtract(&ts, &time_ref, &last_occured_alarm_copy);
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   273
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   274
        /* TIMEVAL is nano seconds */
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   275
        res = (ts.tv_sec * 1000000000L) + ts.tv_nsec;
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   276
    }
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   277
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   278
    LeaveTimerMutex();
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   279
454
bc000083297a - add RTAI support
greg
parents: 170
diff changeset
   280
	return res;
bc000083297a - add RTAI support
greg
parents: 170
diff changeset
   281
}
807
46027bb24429 Rewrite of timer_xeno.c to use POSIX API instead of Alchemy.
Edouard Tisserant
parents: 805
diff changeset
   282