]> rtime.felk.cvut.cz Git - fpga/rpi-motor-control-pxmc.git/commitdiff
RPi PXMC Test: preliminary preparations for compatibility with RTEMS.
authorPavel Pisa <pisa@cmp.felk.cvut.cz>
Fri, 9 Oct 2015 17:39:15 +0000 (19:39 +0200)
committerPavel Pisa <pisa@cmp.felk.cvut.cz>
Fri, 9 Oct 2015 17:39:15 +0000 (19:39 +0200)
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
src/app/rpi-pmsm-test1/Makefile.omk
src/app/rpi-pmsm-test1/appl_utils.c
src/app/rpi-pmsm-test1/rpi_gpclk.c

index 3bc65c25b73a17262a0e7599ea5d2baf55fe61e0..b2ad2cf0f007c0ca17b950bab66cc866a9eae031 100644 (file)
@@ -55,8 +55,10 @@ ifeq ($(CONFIG_OC_ULUT),y)
 lib_LOADLIBES += ulut
 endif
 
+ifneq ($(CONFIG_OC_BUILD4RTEMS),y)
 lib_LOADLIBES += rt
 lib_LOADLIBES += pthread
+endif
 lib_LOADLIBES += m
 
 #link_VARIANTS = app sdram
index 1fd9563ce1dd1ba3bad22b91dd82ae2a9e868be4..692a40c08efa8d66f9c700619eb2fe1e4434cb46 100644 (file)
@@ -5,6 +5,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <stdint.h>
+#include <sched.h>
 #include <unistd.h>
 #include <sys/mman.h>  /* this provides mlockall() */
 #include <pthread.h>
@@ -65,7 +66,11 @@ int sample_period_wait_next(sample_period_t *sper)
     sper->period_time.tv_nsec -= 1000*1000*1000;
     sper->period_time.tv_sec += 1;
   }
+#if !defined(__rtems__)
   return clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &sper->period_time, NULL);
+#else
+  return nanosleep(&sper->period_time, NULL);
+#endif /*__rtems__*/
 }
 
 void appl_sig_handler(int sig)
@@ -84,11 +89,12 @@ int appl_setup_environment(const char *argv0)
   if (appl_base_task_prio < fifo_min_prio)
     appl_base_task_prio = fifo_min_prio;
 
-
+#if !defined(__rtems__)
   if (mlockall(MCL_FUTURE | MCL_CURRENT) < 0) {
     fprintf(stderr, "%s: mlockall failed - cannot lock application in memory\n", argv0);
     exit(1);
   }
+#endif /*__rtems__*/
 
   atexit(appl_stop);
 
index 5eb6682b993f1d040d8f40405a9d6bddc4d55014..56eab207a13ed618ebfc181683b467af24295741 100644 (file)
@@ -11,7 +11,6 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <ctype.h>
-#include <poll.h>
 #include <unistd.h>
 #include <errno.h>
 #include <string.h>