On Thu, 13 Apr 2000, David J. Christini wrote:
> int init_module(void) {
> init_shared_mem(); //initialize shared memory
> pthread_attr_init(&attr);
> sched_param.sched_priority = 1;
> pthread_attr_setschedparam(&attr, &sched_param);
> if ((ret = pthread_create(&daq_task, &attr, daq, (void *)1))) {
> goto init_error;
> }
> ret = pthread_make_periodic_np(daq_task, gethrtime(),NSECS_PER_SEC/RT_HZ);
> if (ret) goto init_error;
>
> rtl_printf(RT_PROCESS_ID ": acquisition started at %d Hz (status %d)\n",
> RT_HZ, ret);
> return 0;
>
> //allow floating point operations ... see RTLinux FAQ
> pthread_setfp_np (daq_task, 1);
Are you sure pthread_setfp_np should not be called BEFORE
pthread_make_periodic_np? Could it be that pthread_make_periodic_np starts
daq_task immediately ( at gethrtime())? Or try to start it at
gethrtime()+10000.
> void init_shared_mem(void) { // Initialize the rtlinux shared memory
>
> //allocate mbuff Shared Memory structure
> rtl_printf(RT_PROCESS_ID ": requesting allocation of %d bytes for sh_mem from
>mbuff:\n",
> sizeof(SharedMemStruct));
> sh_mem=(volatile SharedMemStruct*)mbuff_alloc(RT_PROCESS_ID,
> sizeof(SharedMemStruct));
>
> //initialize shared memory variables ... see rt_process.h for definitions
> sh_mem->scan_index=0;
> sh_mem->g=100000000; //TRUE;
> }
Hey, here you do FP operation in init_module, outside of RT thread !!!!
Nobody said you can do this!
Best regards,
--
Tomek
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/