如何让End Device进入低功耗状态,休眠时间是如何设定的?

  在协议栈宏定义中使能POWER_SAVING后,然后在f8wConfig.cfg文件里面把-DRFD_RCVC_ALWAYS_ON=FALSE,就可以让End Device进入休眠状态。
关于休眠的时间是有OSAL操作系统的调度来决定,每次休眠时间都是按照最新会发生的一个Event Timeout作为休眠时间。具体在协议栈hal_sleep函数中有说明。
这个timeout主要分为两类,一类是应用层事件的timeout,另外一类是MAC层事件的timeout,
1)应用层的timeout的时间,是在osal_pwrmgr_powerconserve( void )函数中,通过osal_next_timeout();获得的。
2)MAC层的timeout时间,是通过halSleep( uint16 osal_timeout )函数里面,通过MAC_PwrNextTimeout();来获得的。
问题:
1、不确定的是:-DRFD_RCVC_ALWAYS_ON=FALSE, 这个值是不是讲RF给关掉的那?
2、osal_next_timeout();获得的时间是多少那?我们是否可以设置?
3、halSleep()这个函数需要来确定的读一读,我们终端睡眠的时间,应该如何来设置,设置后是否和我们想的一直,这个需要做测试
 

在主函数里面执行了 osal_pwrmgr_powerconserve( void )函数
void osal_run_system( void )
{
  uint8 idx = 0;


#ifndef HAL_BOARD_CC2538
  osalTimeUpdate();
#endif
  
  Hal_ProcessPoll();


  do {
    if (tasksEvents[idx])  // Task is highest priority that is ready.
    {
      break;
    }
  } while (++idx < tasksCnt);


  if (idx < tasksCnt)
  {
    uint16 events;
    halIntState_t intState;


    HAL_ENTER_CRITICAL_SECTION(intState);
    events = tasksEvents[idx];
    tasksEvents[idx] = 0;  // Clear the Events for this task.
    HAL_EXIT_CRITICAL_SECTION(intState);


    activeTaskID = idx;
    events = (tasksArr[idx])( idx, events );
    activeTaskID = TASK_NO_TASK;


    HAL_ENTER_CRITICAL_SECTION(intState);
    tasksEvents[idx] |= events;  // Add back unprocessed events to the current task.
    HAL_EXIT_CRITICAL_SECTION(intState);
  }
#if/**/defined( POWER_SAVING )
  else  // Complete pass through all task events with no activity?
  {
    osal_pwrmgr_powerconserve();  // Put the processor/system into sleep
  }
#endif


  /* Yield in case cooperative scheduling is being used. */
#if/**/defined (configUSE_PREEMPTION) && (configUSE_PREEMPTION == 0)
  {
    osal_task_yield();
  }
#endif
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值