Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Shell 在VxWorks中以特定频率循环命令_Shell_Loops_Vxworks - Fatal编程技术网

Shell 在VxWorks中以特定频率循环命令

Shell 在VxWorks中以特定频率循环命令,shell,loops,vxworks,Shell,Loops,Vxworks,我试图在VxWorks中以6Hz左右的频率循环一个命令,我无法编译相关目标的代码,因此我必须使用现有的VxWorks外壳命令 我试过: repeat(1000,functionX,param1,param2,param3) 这可以很好地重复命令1000次,但不会给我所需的频率 作为总结,我看了一下: period() 由于这能够给我1hz的函数调用(这可能是可以接受的),但是我无法确定如何将所需的参数输入到FunctionX中 我试过两种方法: period(1,functionX,par

我试图在VxWorks中以6Hz左右的频率循环一个命令,我无法编译相关目标的代码,因此我必须使用现有的VxWorks外壳命令

我试过:

repeat(1000,functionX,param1,param2,param3)
这可以很好地重复命令1000次,但不会给我所需的频率

作为总结,我看了一下:

period() 
由于这能够给我1hz的函数调用(这可能是可以接受的),但是我无法确定如何将所需的参数输入到FunctionX中 我试过两种方法:

period(1,functionX,param1,param2,param3)

不走运


任何关于如何实现FunctionX的6Hz速率的想法都是很好的,但是如果不编译一些代码就无法实现,那么我将选择一种方法,让period命令与我调用的函数中的参数一起工作,并且period具有相同的签名,但对第一个参数的解释是不同的。所以,如果您可以成功调用repeat,那么您也可以成功调用period

int period
    (
    int     secs,             /* period in seconds */
    FUNCPTR func,             /* function to call repeatedly */
    int     arg1,             /* first of eight args to pass to func */
    int     arg2,
    int     arg3,
    int     arg4,
    int     arg5,
    int     arg6,
    int     arg7,
    int     arg8
    )



int repeat
    (
    int     n,                /* no. of times to call func (0=forever) */
    FUNCPTR func,             /* function to call repeatedly */
    int     arg1,             /* first of eight args to pass to func */
    int     arg2,
    int     arg3,
    int     arg4,
    int     arg5,
    int     arg6,
    int     arg7,
    int     arg8
    )
对于
repeat
而言,第一个参数是调用函数的次数,对于
period
而言,第一个参数是以秒为单位的周期

因此,
period
对您来说实在太慢了,
repeat
太快了,尽管您可以使用
tickGet
使其工作。你真正想要的是一个vxworks看门狗。在vxworks文档中查找
wdCreate()
wdStart()
,但请注意,您的看门狗处理程序将从ISR调用,因此应采取标准的ISR预防措施(即,您将需要一项任务来完成真正的工作,该工作应取决于msgQ或看门狗处理程序触发的信号量)

实际上,现在我想起来了,我相信
repeat
period
也会从ISR调用处理程序,因此技术上同样的限制也适用于那里

int period
    (
    int     secs,             /* period in seconds */
    FUNCPTR func,             /* function to call repeatedly */
    int     arg1,             /* first of eight args to pass to func */
    int     arg2,
    int     arg3,
    int     arg4,
    int     arg5,
    int     arg6,
    int     arg7,
    int     arg8
    )



int repeat
    (
    int     n,                /* no. of times to call func (0=forever) */
    FUNCPTR func,             /* function to call repeatedly */
    int     arg1,             /* first of eight args to pass to func */
    int     arg2,
    int     arg3,
    int     arg4,
    int     arg5,
    int     arg6,
    int     arg7,
    int     arg8
    )