Hi all, I wanna some help with my application. I'm learning about Xenomai POSIX and Native API. I wonder know what is wrong with my code below because both don't worked out:
POSIX:
#include <sys/mman.h>
#include <posix/pthread.h>
#include <posix/time.h>
#include <stdio.h>
static pthread_t task_desc;
void task_body (void *cookie)
{
struct timespec time;
clock_gettime(CLOCK_MONOTONIC, &time);;
pthread_make_periodic_np(pthread_self(),&time, 1000000000);
while(1) {
printf("%s\n","a");
}
}
int main (int argc, char *argv[])
{
int ret;
pthread_attr_t thattr;
pthread_attr_init(&thattr);
pthread_attr_setdetachstate(&thattr, 0);
pthread_attr_setstacksize(&thattr, 1024);
ret = pthread_create(&task_desc, NULL, &task_body, NULL);
if(!ret)
pthread_join(task_desc, NULL);
}
and NATIVE
#include <sys/mman.h>
#include <native/task.h>
#include <native/queue.h>
#include <native/intr.h>
#include <native/pipe.h>
#include <stdio.h>
#define TASK_PRIO 99 /* Highest RT priority */
#define TASK_MODE 0 /* No flags */
#define TASK_STKSZ 0 /* Stack size (use default one) */
RT_TASK task_desc;
RTIME period_ns = 1000000000llu;
void task_body (void *cookie)
{
unsigned long overrun;
rt_task_set_periodic(NULL, TM_NOW, rt_timer_ns2ticks(period_ns));
while(1) {
rt_task_wait_period(&overrun);
printf("%s\n","a");
}
}
int main (int argc, char *argv[])
{
int err;
int ret;
pthread_attr_t thattr;
mlockall(MCL_CURRENT|MCL_FUTURE);
err = rt_task_create(&task_desc,
"teste",
TASK_STKSZ,
TASK_PRIO,
TASK_MODE);
if (!err)
rt_task_start(&task_desc,&task_body,NULL);
/* ... */
}
void cleanup (void)
{
rt_task_delete(&task_desc);
}
I used the Makefile attached and tried to run on powerpc processor using
NFS.
Thanks,
Breno
Makefile
Description: Binary data
Makefile.native
Description: Binary data
_______________________________________________ Xenomai-help mailing list [email protected] https://mail.gna.org/listinfo/xenomai-help
