Skip to content

Commit

Permalink
lxrt: fix fosi warning and compilation errors.
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Soetens <[email protected]>
  • Loading branch information
Peter Soetens committed Oct 7, 2010
1 parent edc753c commit 7e59c19
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions rtt/os/lxrt/fosi.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,14 @@ int rtos_nanosleep(const TIME_SPEC *rqtp, TIME_SPEC *rmtp)
return -1;
}

int rtos_cond_timedwait(rt_cond_t *cond, rt_mutex_t *mutex, NANO_TIME abstime)
int rtos_cond_timedwait(rt_cond_t *cond, rt_mutex_t *mutex, NANO_TIME abs_time)
{
CHK_LXRT_CALL();
int ret = rt_cond_wait_until(cond->cond, mutex->sem, nano2count(abs_time) );
if (ret == 0)
return 0;
if ( ret == SEM_TIMOUT )
return ETIMEOUT;
return ETIMEDOUT;
return -1;
}

Expand Down
14 changes: 9 additions & 5 deletions rtt/os/lxrt/fosi.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
#define _GNU_SOURCE // use all Posix features (and then some).
#endif

#define _XOPEN_SOURCE 600 // use all Posix features.

#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE 600 // use all Posix98 features.
#endif

#define HAVE_FOSI_API

Expand Down Expand Up @@ -79,6 +82,7 @@ extern "C" {

typedef __LXRT_HANDLE_STRUCT RTOS_RTAI_TASK;
typedef __LXRT_HANDLE_STRUCT RTOS_RTAI_SEM;
typedef __LXRT_HANDLE_STRUCT RTOS_RTAI_CND;
#endif // OROBLD_OS_AGNOSTIC // for RTAI header files.

// this is required because the rtos_sem_init function takes a pointer to RTOS_SEM,
Expand All @@ -89,7 +93,7 @@ extern "C" {

// this is required because the rtos_cond_init function takes a pointer to RTOS_COND,
// which contains a pointer to the real RTAI cond
typedef struct oro_rtai_sem_t {
typedef struct oro_rtai_cond_t {
RTOS_RTAI_CND* cond;
} rt_cond_t;

Expand All @@ -113,9 +117,9 @@ extern "C" {
RTOS_RTAI_TASK* rtaitask;
} RTOS_TASK;

const TICK_TIME InfiniteTicks = LLONG_MAX;
const NANO_TIME InfiniteNSecs = LLONG_MAX;
const double InfiniteSeconds = DBL_MAX;
static const TICK_TIME InfiniteTicks = LLONG_MAX;
static const NANO_TIME InfiniteNSecs = LLONG_MAX;
static const double InfiniteSeconds = DBL_MAX;

#define SCHED_LXRT_HARD 0 /** LXRT Hard real-time */
#define SCHED_LXRT_SOFT 1 /** LXRT Soft real-time */
Expand Down
2 changes: 1 addition & 1 deletion rtt/os/lxrt/fosi_internal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ namespace RTT
RT_TASK* self = rt_buddy();
if (self == 0)
return -1; // non-rtai thread. We could try to compare pthreads like in gnulinux ?
if ( self == task->rtaithread )
if ( self == task->rtaitask )
return 1;
return 0;
}
Expand Down

0 comments on commit 7e59c19

Please sign in to comment.