matrix_df hotmail wrote:
> Hello
> 
> Is there any example which shows how to use WAITONCYCLE in user mode?
> Or some kind of documention?
> 
> I tried to copy it  from /broken/netshm but this is kernel mode and I did 
> not get very far.
> 
>     int                         rtmac;
>     char                        rtmac_name[] = "TDMA0";
>     struct rtdm_getcontext_args getcontext;
> 
>     rtmac = open_rt(rtmac_name, O_RDONLY);
>     if (rtmac < 0) {
>         ret = rtmac;
>         //goto err_rtmac1;
>         printf("rtmac open failed!\n");
>     }
>    --> NOW  compiling problem
>   getcontext.struct_version = RTDM_CONTEXT_STRUCT_VER;
>     ret = ioctl_rt(rtmac, RTIOC_GETCONTEXT, &getcontext);
>     if (ret < 0) {
>       printf("rtmac RTIOC_GETCONTEXT failed!\n");
>     }

RTIOC_GETCONTEXT is a short path opener, only available to kernel-space
users (see also RTDM documentation). Therefore the compilation problems.


To invoke WAITONCYLE/WAITONCYLE_EX (see also stack/include/rtmac.h),
simply open the related TDMA device

fd = rt_dev_open("TDMA0", O_RDWR);

and issue RTMAC_RTIOC_WAITONCYCLE or RTMAC_RTIOC_WAITONCYCLE_EX from
your RT-thread:

err = rt_dev_ioctl(fd, RTMAC_RTIOC_WAITONCYCLE, TDMA_WAIT_ON_SYNC);

-or-

struct rtmac_waitinfo waitinfo = {
        type: TDMA_WAIT_ON_SYNC,
        ext_size: 0
};

err = rt_dev_ioctl(fd, RTMAC_RTIOC_WAITONCYCLE_EX, &waitinfo);
/* cycle number is now in waitinfo.cycle_no */


If you happen to create a nice demo with this information, please
contribute it so that we can put it into the examples repository.

Jan

Attachment: signature.asc
Description: OpenPGP digital signature

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
RTnet-users mailing list
RTnet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rtnet-users

Reply via email to