28 #ifndef RTT_ECOS__FOSI_H 29 #define RTT_ECOS__FOSI_H 39 #include <cyg/kernel/kapi.h> 42 #include <pkgconf/kernel.h> 43 #include <cyg/infra/diag.h> 48 #define SCHED_ECOS_FIFO 0 49 #define ORO_SCHED_RT 0 50 #define ORO_SCHED_OTHER 0 52 #define ORO_WAIT_ABS 0 53 #define ORO_WAIT_REL 1 55 typedef long long NANO_TIME; 103 return (CYGNUM_HAL_RTC_DENOMINATOR*nano)/CYGNUM_HAL_RTC_NUMERATOR;
110 return CYGNUM_HAL_RTC_NUMERATOR/CYGNUM_HAL_RTC_DENOMINATOR*count;
120 return cyg_current_time();
135 cyg_semaphore_init(m, value);
141 cyg_semaphore_destroy(m);
147 cyg_semaphore_post(m);
153 cyg_semaphore_wait(m);
160 if (cyg_semaphore_trywait(m) ==
true)
167 static inline int rtos_sem_wait_timed(rt_sem_t* m,
NANO_TIME delay )
170 if (cyg_semaphore_timed_wait(m,cyg_current_time()+
nano2ticks(delay)) ==
true)
179 cyg_semaphore_peek(m, &val);
197 cyg_mutex_release(m);
198 cyg_mutex_destroy(m);
216 return cyg_mutex_lock(m);
226 if (cyg_mutex_trylock(m) ==
true)
260 #define rtos_printf diag_printf int rtos_mutex_init(rt_mutex_t *m)
const double InfiniteSeconds
int rtos_mutex_rec_lock(rt_rec_mutex_t *m)
const TICK_TIME InfiniteTicks
NANO_TIME rtos_get_time_ns(void)
Get "system" time in nanoseconds.
const NANO_TIME InfiniteNSecs
int rtos_mutex_rec_init(rt_rec_mutex_t *m)
int rtos_sem_trywait(rt_sem_t *m)
int rtos_mutex_rec_trylock(rt_rec_mutex_t *m)
int rtos_sem_signal(rt_sem_t *m)
void cyg_recursive_mutex_destroy(cyg_recursive_mutex_t *mx)
Destroy.
void cyg_recursive_mutex_unlock(cyg_recursive_mutex_t *mx)
Unlock.
cyg_tick_count_t TICK_TIME
int rtos_mutex_unlock(rt_mutex_t *m)
int rtos_mutex_rec_unlock(rt_rec_mutex_t *m)
void rtos_disable_rt_warning()
Disallows the RTOS to print a warning when we violate real-time constraints.
void cyg_recursive_mutex_init(cyg_recursive_mutex_t *mx)
Initialize recursive mutex.
int rtos_sem_destroy(rt_sem_t *m)
int rtos_mutex_lock(rt_mutex_t *m)
TICK_TIME rtos_get_time_ticks(void)
Get "system" time in ticks FIXME see https://proj.fmtc.be/orocos-bugzilla/show_bug.cgi?id=60
int rtos_mutex_trylock(rt_mutex_t *m)
NANO_TIME ticks2nano(TICK_TIME count)
Time conversions from system ticks to nano seconds.
cyg_recursive_mutex_t rt_rec_mutex_t
int rtos_sem_init(rt_sem_t *m, int value)
All these should return zero in case of succes.
TICK_TIME nano2ticks(NANO_TIME nano)
Time conversions from nano seconds to system ticks.
bool cyg_recursive_mutex_lock(cyg_recursive_mutex_t *mx)
Lock recursive mutex.
int rtos_mutex_destroy(rt_mutex_t *m)
int rtos_sem_value(rt_sem_t *m)
void rtos_enable_rt_warning()
Allows the RTOS to print a warning when we violate real-time constraints.
struct timespec TIME_SPEC
int rtos_sem_wait(rt_sem_t *m)
bool cyg_recursive_mutex_trylock(cyg_recursive_mutex_t *mx)
Trylock.
int rtos_mutex_rec_destroy(rt_rec_mutex_t *m)