[Xenomai-help] RTDM driver questions
Hello All, I'm working on a RTDM driver for a PCMCIA DAQ card. I have already implemented all the basic infrastructure, some ioctls for setting the sampling rate and interrupt sources and have also implemented the interrupt handling (there is some issues with the irqs that I might ask about later). My question is how to best give the data from the driver to the user space data acquisition program. Should I allocate some kernel space and mmap it to the user address space and then use a signal of some kind to inform the user space application when the space is half full ? Any suggestions how this is best done are welcome. Also I'm using now a clock on the DAQ card to trigger an interrupt at which I read the samples of the card. The card itself (ancient) has only a very small FIFO and I also want to do some DIO on the PCs parallel port for each sample that I read from the DAQ card, so thats why I decided for this design. Would it be better to use a timer from xenomai to do the sample clocking rather than an irq generated by the clock on the DAQ card (performance or otherwise) ? Thanks for your comments, Thomas ___ Xenomai-help mailing list Xenomai-help@gna.org https://mail.gna.org/listinfo/xenomai-help
[Xenomai-help] help on alarms..
Attached is a piece of code using alarms, but I am seeing some unexpected behavior. Any help will be appreciated. in function main() the program behaves two different ways depending on where I have the last printf() 1. It works fine and terminates as expected if I have it like this while(!quit_now) printf(quit_now = %d\n, quit_now); 2. It does not terminate if I have it this way. I know quit_now is set to 1, since the last statement printed is 'quit_now is set to 1'. while(!quit_now); printf(quit_now = %d\n, quit_now); thanks, Shanti #include stdio.h #include stdlib.h #include unistd.h #include errno.h #include string.h #include sys/types.h #include sys/wait.h #include signal.h #include native/types.h #include native/alarm.h #include native/task.h #define ALARM_NAME dl_alarm2 #define ALARM_TASK_NAME dl_alarm_task #define ALARM_TIME 50 #define ALARM_INTERVAL 25 #define ALARM_TASK_PRIO 20 RT_ALARM dl_alarm; RT_TASK alarm_task; bool quit_now = 0; void catch_signal(int sig) { rt_alarm_stop(dl_alarm); rt_alarm_delete(dl_alarm); rt_task_delete(alarm_task); exit(0); } static void alarm_handler(void *cookie) { int i =0; printf(Inside alarm handler\n ); for(i = 0; i100; i++){ rt_alarm_wait(dl_alarm); printf(i = %d\n,i); } quit_now = 1; printf(quit_now is set to %d\n,quit_now); return; } int main() { int ret = 0; signal(SIGTERM, catch_signal); signal(SIGINT, catch_signal); ret = rt_alarm_create(dl_alarm, ALARM_NAME) ; if (ret) printf(\ncannot create alarm %d\n, ret); ret = rt_task_spawn(alarm_task, ALARM_TASK_NAME, 0, ALARM_TASK_PRIO, 0, alarm_handler, NULL); if(ret) exit(0); rt_alarm_start(dl_alarm, ALARM_TIME, ALARM_INTERVAL); while(!quit_now); printf(quit_now = %d\n,quit_now); rt_alarm_stop(dl_alarm); rt_alarm_delete(dl_alarm); rt_task_delete(alarm_task); return 0; } ___ Xenomai-help mailing list Xenomai-help@gna.org https://mail.gna.org/listinfo/xenomai-help
Re: [Xenomai-help] help on alarms..
Prashanti Bedapudi wrote: Attached is a piece of code using alarms, but I am seeing some unexpected behavior. Any help will be appreciated. have a look at src/testsuite/latency it does what I believe youre seeking to do (tho I havent read your code) in function main() the program behaves two different ways depending on where I have the last printf() 1. It works fine and terminates as expected if I have it like this while(!quit_now) printf(quit_now = %d\n, quit_now); 2. It does not terminate if I have it this way. I know quit_now is set to 1, since the last statement printed is 'quit_now is set to 1'. while(!quit_now); printf(quit_now = %d\n, quit_now); thanks, Shanti ___ Xenomai-help mailing list Xenomai-help@gna.org https://mail.gna.org/listinfo/xenomai-help