Microchip
直播中

叶亮

7年用户 225经验值
私信 关注
[问答]

SYS_TMR调用的目的是什么?

我的问题是:包含在由MHC创建的SysStasks-()例程中的SysStRMRS任务(SysObj.SyrMR)调用的目的是什么?这个调用在超循环中执行数千次/秒。在FRIERTOS DEMOS中,它包含在只运行一次/SEC的任务中。SysStMR的文档不涉及或提及任何需要定期调用该调用,但它意味着在初始化后需要启动服务。我用一个工作项目做了一个快速测试,并从SysStaskSe()中调用了SysStTrMyStask(SysObj.SyrMR)到AppIn RealLeIZE()中的最后一行。我在项目中没有发现任何问题。为什么MHC把这个调用放在SysStasks-()中?

以上来自于百度翻译


      以下为原文

    My question is: What is the purpose of the SYS_TMR_Tasks(sysObj.sysTmr) call that is included in the SYS_Tasks() routine created by MHC?  This call is executed thousands of times/sec in the superloop. In the FreeRTOS demos, it is included in a task that only runs once/sec.

The documentation on SYS_TMR does not address or mention anything about a need to make this call periodically, but it does imply that it is needed to start the service after it is initialized.  I did a quick test with a working project and moved the SYS_TMR_Tasks(sysObj.sysTmr) call from SYS_Tasks() to the last line in APP_Initialize(). I did not see any problems in my project.

So why does MHC put this call in SYS_Tasks()?

回帖(10)

苗雨

2019-1-3 14:49:31
原因是和谐正在试图将驱动程序与应用程序隔离开来。这样做可以免除开发人员对驱动程序细节的担忧:只有与驱动程序的接口很重要。

以上来自于百度翻译


      以下为原文

    The reason is because Harmony is trying to isolate the drivers from the application. Doing so frees the developer from having to worry about driver details: only the interface to said driver is important.
举报

王雪

2019-1-3 15:09:14
我明白了。然而,(在我看来)只需要调用一次SysS任务中的驱动程序接口来启动计时器服务。如果是这样,为什么周期性地调用它?

以上来自于百度翻译


      以下为原文

    I get that.  However, it appears (to me) that the driver interface in SYS_TASKS only needs to be called once to start the timer service.  If so, why is it being called periodically?  
举报

苗雨

2019-1-3 15:17:11
你报警了吗?如果是这样,我认为你需要定期调用它。另外,在您的情况下,函数只调用一次。如果调用函数中的DRVIVTMRYORD返回DRVH-HANDLE无效,会发生什么?如果它碰巧是侥幸,那么系统服务将永远不会初始化,因为服务在打开底层计时器时不会再有第二次破解。在任何情况下,查看SysStM.C中的函数。那你就没事了。有人说过,我强烈建议不要把和声单独产生。

以上来自于百度翻译


      以下为原文

    Have you set up any alarms? If so, I think that you'll need it be called periodically. Additionally, in your case, the function would be called only once. What would happen if the call to DRV_TMR_Open in that function returned DRV_HANDLE_INVALID? If it happened to be a fluke then the system service would never initialize as the service would never get a second crack at opening the underlying timer.
 
In any case, look at the function in sys_tmr.c. You are right in that if everything goes well with a single call, and you're not using any alarms, then you'll be just fine. That having been said, I would strongly advise leaving the call that Harmony generated alone.
举报

陈杰

2019-1-3 15:23:43
我同意B祝福

以上来自于百度翻译


      以下为原文

    I agree with bblessing

from sys_tmr.c
/* Function:
void SYS_TMR_Tasks ( SYS_MODULE_OBJ object )
Summary:
Maintains the system Timer's state machine and implements its ISR.
Description:
This routine is used to maintain the system Timer's internal state machine and
implement its ISR for interrupt-driven implementations.
Precondition:
The SYS_TMR_Initialize function must have been called for the specified Timer
driver instance.
Parameters:
object - SYS TMR object handle, returned from SYS_TMR_Initialize
Returns:
None.
*/

 
举报

更多回帖

发帖
×
20
完善资料,
赚取积分