本文整理汇总了C++中MSECS函数的典型用法代码示例。如果您正苦于以下问题:C++ MSECS函数的具体用法?C++ MSECS怎么用?C++ MSECS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MSECS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: panelsim_service
/*
* service()
* called periodically by RPC server idle timeout
*/
void panelsim_service(void)
{
#define MSECS(tv) ((uint64_t)((tv).tv_sec)*1000 + (tv).tv_usec / 1000 )
struct timeval current_time_tv;
int curchr;
// scan for key press, first char into buffer
// !!! Works not in Eclipse condole !!!
// set_conio_terminal_mode();
curchr = os_kbhit();
if (curchr) {
// user_input_in_progress = 1;
//curchr = getch();
//if (curchr < 0)
//{
// fprintf(stderr, "Error %d on input!\n", curchr);
//}
//else
//{
// if CR or buffer full: process input
if (curchr == '\n' || user_input_chars + 1 >= sizeof(user_input_buffer)) {
printf("Processing \"%s\"\n", user_input_buffer);
user_input_buffer[user_input_chars] = '\0';
panelsim_userinput(user_input_buffer);
update_needed = 1; // panel state changed
user_input_buffer[0] = '\0'; // empty buffer
user_input_chars = 0;
} else {
// just save & echo input character
user_input_buffer[user_input_chars++] = curchr;
user_input_buffer[user_input_chars] = '\0'; // terminate
}
//}
}
// reset_terminal_mode();
gettimeofday(¤t_time_tv, NULL);
// do not update more often then every MIN_UPDATE_INTERVALL_US usecs
if ((MSECS(update_last_time_tv) + MIN_UPDATE_INTERVALL_MS < MSECS(current_time_tv))
&& update_needed /*&& !user_input_in_progress*/) {
update_last_time_tv = current_time_tv;
update_needed = 0;
panelsim_show();
printf(" q) quit\n");
printf("\nSet input by entering \"<nr> <value>\"\n");
// re-print current user input
printf(">>> %s", user_input_buffer);
}
}
示例2: rtl_ips_nic_off
void rtl_ips_nic_off(struct ieee80211_hw *hw)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
queue_delayed_work(rtlpriv->works.rtl_wq,
&rtlpriv->works.ips_nic_off_wq, MSECS(100));
}
示例3: rtl_swlps_rf_sleep
void rtl_swlps_rf_sleep(struct ieee80211_hw *hw)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
u8 sleep_intv;
if (!rtlpriv->psc.sw_ps_enabled)
return;
if ((rtlpriv->sec.being_setkey) ||
(mac->opmode == NL80211_IFTYPE_ADHOC))
return;
/*sleep after linked 10s, to let DHCP and 4-way handshake ok enough!! */
if ((mac->link_state != MAC80211_LINKED) || (mac->cnt_after_linked < 5))
return;
if (rtlpriv->link_info.busytraffic)
return;
mutex_lock(&rtlpriv->locks.ps_mutex);
rtl_ps_set_rf_state(hw, ERFSLEEP, RF_CHANGE_BY_PS);
mutex_unlock(&rtlpriv->locks.ps_mutex);
if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM &&
!RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM)) {
rtlpriv->intf_ops->enable_aspm(hw);
RT_SET_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM);
}
/* here is power save alg, when this beacon is DTIM
* we will set sleep time to dtim_period * n;
* when this beacon is not DTIM, we will set sleep
* time to sleep_intv = rtlpriv->psc.dtim_counter or
* MAX_SW_LPS_SLEEP_INTV(default set to 5) */
if (rtlpriv->psc.dtim_counter == 0) {
if (hw->conf.ps_dtim_period == 1)
sleep_intv = hw->conf.ps_dtim_period * 2;
else
sleep_intv = hw->conf.ps_dtim_period;
} else {
sleep_intv = rtlpriv->psc.dtim_counter;
}
if (sleep_intv > MAX_SW_LPS_SLEEP_INTV)
sleep_intv = MAX_SW_LPS_SLEEP_INTV;
/* this print should always be dtim_conter = 0 &
* sleep = dtim_period, that meaons, we should
* awake before every dtim */
RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG,
"dtim_counter:%x will sleep :%d beacon_intv\n",
rtlpriv->psc.dtim_counter, sleep_intv);
/* we tested that 40ms is enough for sw & hw sw delay */
queue_delayed_work(rtlpriv->works.rtl_wq, &rtlpriv->works.ps_rfon_wq,
MSECS(sleep_intv * mac->vif->bss_conf.beacon_int - 40));
}
示例4: ActivateBAEntry
static void ActivateBAEntry(struct rtllib_device *ieee, struct ba_record *pBA,
u16 Time)
{
pBA->bValid = true;
if (Time != 0)
mod_timer(&pBA->Timer, jiffies + MSECS(Time));
}
示例5: CPUcheck_firmware_ready
static bool CPUcheck_firmware_ready(struct net_device *dev)
{
bool rt_status = true;
u32 CPU_status = 0;
unsigned long timeout;
timeout = jiffies + MSECS(20);
while (time_before(jiffies, timeout)) {
CPU_status = read_nic_dword(dev, CPU_GEN);
if (CPU_status&CPU_GEN_FIRM_RDY)
break;
mdelay(2);
}
if (!(CPU_status&CPU_GEN_FIRM_RDY))
goto CPUCheckFirmwareReady_Fail;
else
RT_TRACE(COMP_FIRMWARE, "Download Firmware: Firmware ready!\n");
return rt_status;
CPUCheckFirmwareReady_Fail:
RT_TRACE(COMP_ERR, "ERR in %s()\n", __func__);
rt_status = false;
return rt_status;
}
示例6: CPUcheck_maincodeok_turnonCPU
static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev)
{
bool rt_status = true;
u32 CPU_status = 0;
unsigned long timeout;
timeout = jiffies + MSECS(200);
while (time_before(jiffies, timeout)) {
CPU_status = read_nic_dword(dev, CPU_GEN);
if (CPU_status & CPU_GEN_PUT_CODE_OK)
break;
mdelay(2);
}
if (!(CPU_status&CPU_GEN_PUT_CODE_OK)) {
RT_TRACE(COMP_ERR, "Download Firmware: Put code fail!\n");
goto CPUCheckMainCodeOKAndTurnOnCPU_Fail;
} else {
RT_TRACE(COMP_FIRMWARE, "Download Firmware: Put code ok!\n");
}
CPU_status = read_nic_dword(dev, CPU_GEN);
write_nic_byte(dev, CPU_GEN,
(u8)((CPU_status|CPU_GEN_PWR_STB_CPU)&0xff));
mdelay(1);
timeout = jiffies + MSECS(200);
while (time_before(jiffies, timeout)) {
CPU_status = read_nic_dword(dev, CPU_GEN);
if (CPU_status&CPU_GEN_BOOT_RDY)
break;
mdelay(2);
}
if (!(CPU_status&CPU_GEN_BOOT_RDY))
goto CPUCheckMainCodeOKAndTurnOnCPU_Fail;
else
RT_TRACE(COMP_FIRMWARE, "Download Firmware: Boot ready!\n");
return rt_status;
CPUCheckMainCodeOKAndTurnOnCPU_Fail:
RT_TRACE(COMP_ERR, "ERR in %s()\n", __func__);
rt_status = false;
return rt_status;
}
示例7: AdmitTS
void AdmitTS(struct rtllib_device *ieee, PTS_COMMON_INFO pTsCommonInfo, u32 InactTime)
{
del_timer_sync(&pTsCommonInfo->SetupTimer);
del_timer_sync(&pTsCommonInfo->InactTimer);
if(InactTime!=0)
mod_timer(&pTsCommonInfo->InactTimer, jiffies + MSECS(InactTime));
}
示例8: SwLedControlMode4
void SwLedControlMode4(struct net_device *dev, LED_CTL_MODE LedAction)
{
struct r8192_priv *priv = rtllib_priv(dev);
PLED_8190 pLed0 = &(priv->SwLed0);
PLED_8190 pLed1 = &(priv->SwLed1);
switch(LedAction)
{
case LED_CTL_POWER_ON:
pLed1->CurrLedState = LED_ON;
SwLedOn(dev, pLed1);
pLed0->CurrLedState = LED_OFF;
SwLedOff(dev, pLed0);
break;
case LED_CTL_TX:
case LED_CTL_RX:
if( pLed0->bLedBlinkInProgress == false )
{
pLed0->bLedBlinkInProgress = true;
pLed0->CurrLedState = LED_BLINK_RUNTOP;
pLed0->BlinkTimes = 2;
if( pLed0->bLedOn )
pLed0->BlinkingLedState = LED_OFF;
else
pLed0->BlinkingLedState = LED_ON;
mod_timer(&(pLed0->BlinkTimer), jiffies + MSECS(LED_RunTop_BLINK_INTERVAL));
}
break;
case LED_CTL_POWER_OFF:
pLed0->CurrLedState = LED_OFF;
pLed1->CurrLedState = LED_OFF;
if(pLed0->bLedBlinkInProgress)
{
del_timer_sync(&(pLed0->BlinkTimer));
pLed0->bLedBlinkInProgress = false;
}
if(pLed1->bLedBlinkInProgress)
{
del_timer_sync(&(pLed1->BlinkTimer));
pLed1->bLedBlinkInProgress = false;
}
SwLedOff(dev, pLed0);
SwLedOff(dev, pLed1);
break;
default:
break;
}
RT_TRACE(COMP_LED, "Led0 %d, Led1 %d \n", pLed0->CurrLedState, pLed1->CurrLedState);
}
示例9: rtl_watch_dog_timer_callback
void rtl_watch_dog_timer_callback(unsigned long data)
{
struct ieee80211_hw *hw = (struct ieee80211_hw *)data;
struct rtl_priv *rtlpriv = rtl_priv(hw);
queue_delayed_work(rtlpriv->works.rtl_wq,
&rtlpriv->works.watchdog_wq, 0);
mod_timer(&rtlpriv->works.watchdog_timer,
jiffies + MSECS(RTL_WATCH_DOG_TIME));
}
示例10: rtl_ips_nic_off
void rtl_ips_nic_off(struct ieee80211_hw *hw)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
/* because when link with ap, mac80211 will ask us
* to disable nic quickly after scan before linking,
* this will cause link failed, so we delay 100ms here
*/
queue_delayed_work(rtlpriv->works.rtl_wq,
&rtlpriv->works.ips_nic_off_wq, MSECS(100));
}
示例11: rtl8192_hw_wakeup
void rtl8192_hw_wakeup(struct net_device* dev)
{
struct r8192_priv *priv = rtllib_priv(dev);
unsigned long flags = 0;
u8 queue_index = 0;
unsigned long queue_len = 0;
struct sk_buff* skb = NULL;
#ifdef CONFIG_ASPM_OR_D3
PRT_POWER_SAVE_CONTROL pPSC = (PRT_POWER_SAVE_CONTROL)(&(priv->rtllib->PowerSaveControl));
#endif
spin_lock_irqsave(&priv->rf_ps_lock,flags);
if (priv->RFChangeInProgress) {
spin_unlock_irqrestore(&priv->rf_ps_lock,flags);
RT_TRACE(COMP_RF, "rtl8192_hw_wakeup(): RF Change in progress! \n");
printk("rtl8192_hw_wakeup(): RF Change in progress! schedule wake up task again\n");
queue_delayed_work_rsl(priv->rtllib->wq,&priv->rtllib->hw_wakeup_wq,MSECS(10));
return;
}
spin_unlock_irqrestore(&priv->rf_ps_lock,flags);
#ifdef CONFIG_ASPM_OR_D3
if (pPSC->RegRfPsLevel & RT_RF_LPS_LEVEL_ASPM) {
RT_DISABLE_ASPM(dev);
RT_CLEAR_PS_LEVEL(pPSC, RT_RF_LPS_LEVEL_ASPM);
}
#endif
RT_TRACE(COMP_PS, "%s()============>come to wake up\n", __FUNCTION__);
MgntActSet_RF_State(dev, eRfOn, RF_CHANGE_BY_PS,false);
for (queue_index=0; queue_index<=VO_QUEUE; queue_index++){
queue_len = skb_queue_len(&priv->rtllib->skb_waitQ[queue_index]);
if (queue_len) {
printk("=====>%s(): no need to ps,wake up!! %d queue is not empty\n",
__FUNCTION__,queue_index);
skb = skb_dequeue(&priv->rtllib->skb_waitQ[queue_index]);
if (skb == NULL) {
RT_TRACE(COMP_ERR,"rtl8192_hw_wakeup():skb is NULL\n");
return;
}
if ((priv->rtllib->b4ac_Uapsd & 0x0f) !=0) {
if ( IsMgntQosData(skb->data) || IsMgntQosNull(skb->data) ) {
if(!priv->rtllib->bin_service_period && get_qos_queueID_maskAPSD(queue_index, priv->rtllib->b4ac_Uapsd))
{
RT_TRACE(COMP_PS, "rtl8192_hw_wakeup(): >>>>>>>>>> Enter APSD service period >>>>>>>>>>\n");
printk("rtl8192_hw_wakeup(): >>>>>>>>>> Enter APSD service period >>>>>>>>>>\n");
priv->rtllib->bin_service_period = true;
}
}
}
priv->rtllib->softmac_data_hard_start_xmit(skb,dev,0/* rate useless now*/);
}
}
}
示例12: rtl_swlps_rf_sleep
void rtl_swlps_rf_sleep(struct ieee80211_hw *hw)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
u8 sleep_intv;
if (!rtlpriv->psc.sw_ps_enabled)
return;
if ((rtlpriv->sec.being_setkey) ||
(mac->opmode == NL80211_IFTYPE_ADHOC))
return;
if ((mac->link_state != MAC80211_LINKED) || (mac->cnt_after_linked < 5))
return;
if (rtlpriv->link_info.busytraffic)
return;
mutex_lock(&rtlpriv->locks.ps_mutex);
rtl_ps_set_rf_state(hw, ERFSLEEP, RF_CHANGE_BY_PS);
mutex_unlock(&rtlpriv->locks.ps_mutex);
if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM &&
!RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM)) {
rtlpriv->intf_ops->enable_aspm(hw);
RT_SET_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM);
}
if (rtlpriv->psc.dtim_counter == 0) {
if (hw->conf.ps_dtim_period == 1)
sleep_intv = hw->conf.ps_dtim_period * 2;
else
sleep_intv = hw->conf.ps_dtim_period;
} else {
sleep_intv = rtlpriv->psc.dtim_counter;
}
if (sleep_intv > MAX_SW_LPS_SLEEP_INTV)
sleep_intv = MAX_SW_LPS_SLEEP_INTV;
RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG,
"dtim_counter:%x will sleep :%d beacon_intv\n",
rtlpriv->psc.dtim_counter, sleep_intv);
queue_delayed_work(rtlpriv->works.rtl_wq, &rtlpriv->works.ps_rfon_wq,
MSECS(sleep_intv * mac->vif->bss_conf.beacon_int - 40));
}
示例13: timer_rate_adaptive
void timer_rate_adaptive(unsigned long data)
{
struct r8180_priv *priv = ieee80211_priv((struct net_device *)data);
if (!priv->up) {
return;
}
if ((priv->ieee80211->iw_mode != IW_MODE_MASTER)
&& (priv->ieee80211->state == IEEE80211_LINKED) &&
(priv->ForcedDataRate == 0)) {
queue_work(priv->ieee80211->wq, (void *)&priv->ieee80211->rate_adapter_wq);
}
priv->rateadapter_timer.expires = jiffies + MSECS(priv->RateAdaptivePeriod);
add_timer(&priv->rateadapter_timer);
}
示例14: SwAntennaDiversityTimerCallback
void SwAntennaDiversityTimerCallback(struct net_device *dev)
{
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
RT_RF_POWER_STATE rtState;
rtState = priv->eRFPowerState;
do {
if (rtState == eRfOff) {
break;
} else if (rtState == eRfSleep) {
break;
}
SwAntennaDiversity(dev);
} while (false);
if (priv->up) {
priv->SwAntennaDiversityTimer.expires = jiffies + MSECS(ANTENNA_DIVERSITY_TIMER_PERIOD);
add_timer(&priv->SwAntennaDiversityTimer);
}
}
示例15: ActivateBAEntry
void ActivateBAEntry(struct ieee80211_device* ieee, PBA_RECORD pBA, u16 Time)
{
pBA->bValid = true;
if(Time != 0)
mod_timer(&pBA->Timer, jiffies + MSECS(Time));
}