您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ watchdog_stop函数代码示例

51自学网 2021-06-03 09:52:27
  C++
这篇教程C++ watchdog_stop函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中watchdog_stop函数的典型用法代码示例。如果您正苦于以下问题:C++ watchdog_stop函数的具体用法?C++ watchdog_stop怎么用?C++ watchdog_stop使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了watchdog_stop函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: PROCESS_THREAD

PROCESS_THREAD(interferer_example, ev, data){ PROCESS_EXITHANDLER()   PROCESS_BEGIN();  static struct etimer et; //powertrace_start(CLOCK_SECOND * 2); // Initial configurations on CC2420: channel and tx power watchdog_stop(); cc2420_set_txpower(power); cc2420_set_channel(26); //printf("interfering with periodic interference/n");  // Continuous Interference  CC2420_SPI_ENABLE();  //SPI_SET_UNMODULATED(0x1800,0x0100,0x0508,0x0004); SPI_SET_MODULATED(0x050C);  //powertrace_start(CLOCK_SECOND*2); while(1){	  for(power=3; power<32; power+=4){ SPI_SET_TXPOWER((0xa0ff & 0xffe0) | (power & 0x1f)); etimer_set(&et, CLOCK_SECOND/1000); PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); //printf ("transmit power = %d/n",power); }  for(power=27; power>3; power-=4){ SPI_SET_TXPOWER((0xa0ff & 0xffe0) | (power & 0x1f)); etimer_set(&et, CLOCK_SECOND/1000); PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); //printf ("transmit power = %d/n",power); }  for(power=3; power<32; power+=2){ SPI_SET_TXPOWER((0xa0ff & 0xffe0) | (0 & 0x1f)); etimer_set(&et, CLOCK_SECOND/1000); PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); //printf ("transmit power = %d/n",power); } }  CC2420_SPI_DISABLE(); void powertrace_stop(void);  PROCESS_WAIT_EVENT();   PROCESS_END();}
开发者ID:vaibhav90,项目名称:NES_Project,代码行数:51,


示例2: main

intmain() {    const struct CMUnitTest tests[] = {            cmocka_unit_test_setup_teardown(cm_session_test, cm_setup, cm_teardown),            cmocka_unit_test_setup_teardown(cm_session_neg_test, cm_setup, NULL),            cmocka_unit_test_setup_teardown(cm_buffers_test, cm_setup, cm_teardown),            cmocka_unit_test_setup_teardown(cm_signals_test, cm_setup, cm_teardown),    };    watchdog_start(300);    int ret = cmocka_run_group_tests(tests, NULL, NULL);    watchdog_stop();    return ret;}
开发者ID:qmm161,项目名称:sysrepo,代码行数:14,


示例3: ISR

/*--------------------------------------------------------------------------*/ISR(TIMER0_A1, rtimer_a01_isr){  /* store the IV register as any read/write resets interrupt flags */  uint16_t ivreg = TA0IV;  if(ivreg & TA0IV_TACCR1) {    /* rtimer interrupt */    TA0CCTL1 &= ~CCIFG;    watchdog_start();    /* check for and run any pending rtimers */    rtimer_run_next();    /* also check for any pending events and wake up if needed */    if(process_nevents() > 0) {      LPM4_EXIT;    }    watchdog_stop();  } else if(ivreg & TA0IV_TACCR2) {    /* simple pwm interrupt */    TA0CCTL2 &= ~CCIFG;    if(spwm.on_time > 0) {      if(spwm.on_time == period) {        TA0CCTL2 &= ~CCIE;  /* no need for interrupt, is at 100% DC *//*        SIMPLE_PWM_PORT(OUT) |= (1 << spwm.pin);*/        pwm_on_cb();      } else {        /* normal on-case */        if(period_end) {          period_end = 0;          TA0CCR2 = TAR + spwm.on_time;/*          SIMPLE_PWM_PORT(OUT) |= (1 << spwm.pin);*/          pwm_off_cb();        } else {          period_end = 1;          TA0CCR2 = TAR + (period - spwm.on_time);/*          SIMPLE_PWM_PORT(OUT) &= ~(1 << spwm.pin);*/          pwm_on_cb();        }      }    }  }}
开发者ID:dirtwillfly,项目名称:contiki-launchpad,代码行数:51,


示例4: watchdog_destroy

void    watchdog_destroy(WATCHDOG *wp){    char   *myname = "watchdog_destroy";    watchdog_stop(wp);    watchdog_curr = wp->saved_watchdog;    if (sigaction(SIGALRM, &wp->saved_action, (struct sigaction *) 0) < 0)	msg_fatal("%s: sigaction(SIGALRM): %m", myname);    if (wp->saved_time)	alarm(wp->saved_time);    myfree((char *) wp);    if (msg_verbose)	msg_info("%s: %p", myname, (void *) wp);}
开发者ID:TonyChengTW,项目名称:Rmail,代码行数:14,


示例5: watchdog_release

static int watchdog_release(struct inode *inode, struct file *file){	struct watchdog_core_data *wd_data = file->private_data;	struct watchdog_device *wdd;	int err = -EBUSY;	bool running;	mutex_lock(&wd_data->lock);	wdd = wd_data->wdd;	if (!wdd)		goto done;	/*	 * We only stop the watchdog if we received the magic character	 * or if WDIOF_MAGICCLOSE is not set. If nowayout was set then	 * watchdog_stop will fail.	 */	if (!test_bit(WDOG_ACTIVE, &wdd->status))		err = 0;	else if (test_and_clear_bit(_WDOG_ALLOW_RELEASE, &wd_data->status) ||		 !(wdd->info->options & WDIOF_MAGICCLOSE))		err = watchdog_stop(wdd);	/* If the watchdog was not stopped, send a keepalive ping */	if (err < 0) {		pr_crit("watchdog%d: watchdog did not stop!/n", wdd->id);		watchdog_ping(wdd);	}	watchdog_update_worker(wdd);	/* make sure that /dev/watchdog can be re-opened */	clear_bit(_WDOG_DEV_OPEN, &wd_data->status);done:	running = wdd && watchdog_hw_running(wdd);	mutex_unlock(&wd_data->lock);	/*	 * Allow the owner module to be unloaded again unless the watchdog	 * is still running. If the watchdog is still running, it can not	 * be stopped, and its driver must not be unloaded.	 */	if (!running) {		module_put(wd_data->cdev.owner);		kref_put(&wd_data->kref, watchdog_core_data_release);	}	return 0;}
开发者ID:AshishNamdev,项目名称:linux,代码行数:49,


示例6: timera0

 timera0 (void) {  ENERGEST_ON(ENERGEST_TYPE_IRQ);  watchdog_start();  rtimer_run_next();  if(process_nevents() > 0) {    LPM4_EXIT;  }  watchdog_stop();  ENERGEST_OFF(ENERGEST_TYPE_IRQ);}
开发者ID:chanhemow,项目名称:contiki-fork,代码行数:15,


示例7: watchdog_workfunc

static void watchdog_workfunc(struct work_struct *work){	struct watchdog_data *wd;	wd = container_of(work, struct watchdog_data, work.work);	pr_debug("%s: pet watchdog/n", __func__);	/* stop watchdog and restart it */	watchdog_stop(wd);	watchdog_start(wd);	/* reschedule to clear it again in the future */	queue_delayed_work(wd->wq, &wd->work, wd->pet_interval);}
开发者ID:Aaroneke,项目名称:galaxy-2636,代码行数:15,


示例8: main

int main(void){    watchdog_stop();    set_mcu_speed_dco_mclk_8MHz_smclk_1MHz();    leds_init();    led_red_on();    for(;;)    {        delay_ms(1000);        led_red_switch();        led_green_switch();    }}
开发者ID:PaulMougel,项目名称:msp430,代码行数:15,


示例9: watchdog_init

/*---------------------------------------------------------------------------*/voidwatchdog_init(void){  /* The MSP430 watchdog is enabled at boot-up, so we stop it during     initialization. */  counter = 0;  watchdog_stop();#if CONTIKI_TARGET_WISMOTE  SFRIFG1 &= ~WDTIFG;  SFRIE1 |= WDTIE;#else  IFG1 &= ~WDTIFG;  IE1 |= WDTIE;#endif}
开发者ID:Johnyren,项目名称:orpl,代码行数:16,


示例10: ISR

/*---------------------------------------------------------------------------*/ISR(TIMERA1, timera1){  ENERGEST_ON(ENERGEST_TYPE_IRQ);  watchdog_start();  if(TAIV == 2) {    /* HW timer bug fix: Interrupt handler called before TR==CCR.     * Occurs when timer state is toggled between STOP and CONT. */    while(TACTL & MC1 && TACCR1 - TAR == 1);    /* Make sure interrupt time is future */    do {      TACCR1 += INTERVAL;      ++count;      /* Make sure the CLOCK_CONF_SECOND is a power of two, to ensure	 that the modulo operation below becomes a logical and and not	 an expensive divide. Algorithm from Wikipedia:	 http://en.wikipedia.org/wiki/Power_of_two */#if (CLOCK_CONF_SECOND & (CLOCK_CONF_SECOND - 1)) != 0#error CLOCK_CONF_SECOND must be a power of two (i.e., 1, 2, 4, 8, 16, 32, 64, ...).#error Change CLOCK_CONF_SECOND in contiki-conf.h.#endif      if(count % CLOCK_CONF_SECOND == 0) {	++seconds;        energest_flush();      }    } while((TACCR1 - TAR) > INTERVAL);    last_tar = TAR;    if(etimer_pending() &&       (etimer_next_expiration_time() - count - 1) > MAX_TICKS) {      etimer_request_poll();      LPM4_EXIT;    }  }  /*  if(process_nevents() >= 0) {    LPM4_EXIT;    }*/  watchdog_stop();  ENERGEST_OFF(ENERGEST_TYPE_IRQ);}
开发者ID:StevenSLXie,项目名称:Contiki-PCT,代码行数:49,


示例11: collect_garbage

/*---------------------------------------------------------------------------*/static voidcollect_garbage(int mode){  uint16_t sector;  struct sector_status stats;  coffee_page_t first_page, isolation_count;  watchdog_stop();  PRINTF("Coffee: Running the file system garbage collector in %s mode/n",	 mode == GC_RELUCTANT ? "reluctant" : "greedy");  /*   * The garbage collector erases as many sectors as possible. A sector is   * erasable if there are only free or obsolete pages in it.   */  for(sector = 0; sector < COFFEE_SECTOR_COUNT; sector++) {    isolation_count = get_sector_status(sector, &stats);    PRINTF("Coffee: Sector %u has %u active, %u obsolete, and %u free pages./n",        sector, (unsigned)stats.active,	(unsigned)stats.obsolete, (unsigned)stats.free);    if(stats.active > 0) {      continue;    }    if((mode == GC_RELUCTANT && stats.free == 0) ||       (mode == GC_GREEDY && stats.obsolete > 0)) {      first_page = sector * COFFEE_PAGES_PER_SECTOR;      if(first_page < *next_free) {        *next_free = first_page;      }      if(isolation_count > 0) {        isolate_pages(first_page + COFFEE_PAGES_PER_SECTOR, isolation_count);      }      COFFEE_ERASE(sector);      PRINTF("Coffee: Erased sector %d!/n", sector);      if(mode == GC_RELUCTANT && isolation_count > 0) {        break;      }    }  }  watchdog_start();}
开发者ID:EDAyele,项目名称:ptunes,代码行数:48,


示例12: reserve

/*---------------------------------------------------------------------------*/static struct file *reserve(const char *name, coffee_page_t pages,	int allow_duplicates, unsigned flags){  struct file_header hdr;  coffee_page_t page;  struct file *file;  watchdog_stop();  if(!allow_duplicates && find_file(name) != NULL) {    watchdog_start();    return NULL;  }  page = find_contiguous_pages(pages);  if(page == INVALID_PAGE) {    if(*gc_wait) {      return NULL;    }    collect_garbage(GC_GREEDY);    page = find_contiguous_pages(pages);    if(page == INVALID_PAGE) {      watchdog_start();      *gc_wait = 1;      return NULL;    }  }  memset(&hdr, 0, sizeof(hdr));  memcpy(hdr.name, name, sizeof(hdr.name) - 1);  hdr.max_pages = pages;  hdr.flags = HDR_FLAG_ALLOCATED | flags;  write_header(&hdr, page);  PRINTF("Coffee: Reserved %u pages starting from %u for file %s/n",      pages, page, name);  file = load_file(page, &hdr);  file->end = 0;  watchdog_start();  return file;}
开发者ID:EDAyele,项目名称:ptunes,代码行数:45,


示例13: LPTMR_IRQHandler

/*---------------------------------------------------------------------------*/voidLPTMR_IRQHandler(void)  {    ENERGEST_ON(ENERGEST_TYPE_IRQ);    watchdog_start();        PRINTF("rtimer_arch_init compare event at 0x%4x./n", rtimer_arch_now());    LPTMR0_CMR = LPTMR_CMR_COMPARE(LPTMR_CMR_COMPARE_MASK);    LPTMR0_CSR = (uint32_t) ((LPTMR0_CSR        & (uint32_t) ~(uint32_t) (LPTMR_CSR_TIE_MASK))    | (uint32_t) (LPTMR_CSR_TCF_MASK)); // Clear interrupt flag and disable interrupt    rtimer_run_next();    watchdog_stop();    ENERGEST_OFF(ENERGEST_TYPE_IRQ);  }
开发者ID:AlexanderWiniger,项目名称:kinetis-mote,代码行数:21,


示例14: bmc_stop_wd_timer

/** * stop wdt internal * */void bmc_stop_wd_timer(void){	if ((wd_timer.timer_use & WD_TIMER_START))	{		taskENTER_CRITICAL();		/* set watchdog timer values */		wd_timer.timer_use = WD_TIMER_USE_SMS_OS;		wd_timer.timer_action = WD_TIMER_ACT_NO;		wd_timer.initial_count = 0;		wd_timer.present_count = 0;		wd_timer.timer_use &= ~WD_TIMER_START;		/* stop watchdog timer */		watchdog_stop();		debug_uart_printf(DBG_GRP_WDT, 1, "Watchdog timer stopped via %s/n", __FUNCTION__);		taskEXIT_CRITICAL();	}}
开发者ID:ryanSie,项目名称:Advantech,代码行数:24,


示例15: main

intmain() {    const struct CMUnitTest tests[] = {        cmocka_unit_test(sr_new_tree_test),        cmocka_unit_test(sr_new_trees_test),        cmocka_unit_test(sr_node_set_name_test),        cmocka_unit_test(sr_node_set_module_test),        cmocka_unit_test(sr_node_set_str_data_test),        cmocka_unit_test(sr_node_build_str_data_test),        cmocka_unit_test(sr_node_add_child_test),        cmocka_unit_test(sr_dup_tree_test),        cmocka_unit_test(sr_dup_trees_test),        cmocka_unit_test(sr_print_tree_test)    };    watchdog_start(300);    int ret = cmocka_run_group_tests(tests, NULL, NULL);    watchdog_stop();    return ret;}
开发者ID:sartura,项目名称:sysrepo,代码行数:20,


示例16: watchdog_destroy

void    watchdog_destroy(WATCHDOG *wp){    const char *myname = "watchdog_destroy";    watchdog_stop(wp);    watchdog_curr = wp->saved_watchdog;    if (sigaction(SIGALRM, &wp->saved_action, (struct sigaction *) 0) < 0)	msg_fatal("%s: sigaction(SIGALRM): %m", myname);    if (wp->saved_time)	alarm(wp->saved_time);    myfree((void *) wp);#ifdef USE_WATCHDOG_PIPE    if (watchdog_curr == 0) {	event_disable_readwrite(watchdog_pipe[0]);	(void) close(watchdog_pipe[0]);	(void) close(watchdog_pipe[1]);    }#endif    if (msg_verbose > 1)	msg_info("%s: %p", myname, (void *) wp);}
开发者ID:DabeDotCom,项目名称:postfix,代码行数:21,


示例17: flash_setup

/*---------------------------------------------------------------------------*/voidflash_setup(void){  /* disable all interrupts to protect CPU     during programming from system crash */  dint();  /* Clear interrupt flag1. */  SFRIFG1 = 0;  /* The IFG1 = 0; statement locks up contikimac - not sure if this     statement needs to be here at all. I've removed it for now, since     it seems to work, but leave this little note here in case someone     stumbles over this code at some point. */  /* Stop watchdog. */  watchdog_stop();  /* disable all NMI-Interrupt sources */  sfrie = SFRIE1;  SFRIE1 = 0x00;}
开发者ID:13416795,项目名称:contiki,代码行数:22,


示例18: SAFE_DELETE

//-----------------------------------------------------------------------------// name: shutdown()// desc: ...//-----------------------------------------------------------------------------void Digitalio::shutdown(){    if( !m_init ) return;#ifndef __DISABLE_RTAUDIO__    if( m_start )    {        //if( m_use_cb ) m_rtaudio->cancelStreamCallback();        m_rtaudio->stopStream();    }    m_rtaudio->closeStream();    SAFE_DELETE( m_rtaudio );#endif // __DISABLE_RTAUDIO__    m_init = FALSE;    m_start = FALSE;        // stop watchdog    watchdog_stop();}
开发者ID:PaulBatchelor,项目名称:tiziku,代码行数:25,


示例19: RTC_IRQHandler

void RTC_IRQHandler(void){  ENERGEST_ON(ENERGEST_TYPE_IRQ);  // Find reason of IRQ  if(RTC_IntGet() & RTC_IF_COMP0)  {    watchdog_start();    rtimer_run_next();    watchdog_stop();    // disable interrupt    RTC_IntDisable(RTC_IF_COMP0);  }  else  {    PRINTF("%s: unknown reason for RTC interrupt/r/n",__func__);  }  // Clear interrupts  RTC_IntClear(_RTC_IF_MASK);  ENERGEST_OFF(ENERGEST_TYPE_IRQ);}
开发者ID:Spike0,项目名称:Contiki_my,代码行数:23,


示例20: cfs_coffee_format

/*---------------------------------------------------------------------------*/intcfs_coffee_format(void){  unsigned i;  PRINTF("Coffee: Formatting %u sectors", COFFEE_SECTOR_COUNT);  *next_free = 0;  watchdog_stop();  for(i = 0; i < COFFEE_SECTOR_COUNT; i++) {    COFFEE_ERASE(i);    PRINTF(".");  }  watchdog_start();  /* Formatting invalidates the file information. */  memset(&protected_mem, 0, sizeof(protected_mem));  PRINTF(" done!/n");  return 0;}
开发者ID:EDAyele,项目名称:ptunes,代码行数:24,


示例21: watchdog_config_and_start

/* Program and starts the timer */static int watchdog_config_and_start(u32 newtimeout, u32 newpretimeout){	int ret;	timeout = newtimeout;	pre_timeout = newpretimeout;	pr_info("timeout=%ds, pre_timeout=%ds/n", timeout, pre_timeout);	/* Configure the watchdog */	ret = watchdog_set_timeouts_and_start(pre_timeout, timeout);	if (ret) {		pr_err("%s: Cannot configure the watchdog/n", __func__);		/* Make sure the watchdog timer is stopped */		watchdog_stop();		return ret;	}	watchdog_device.started = true;	return 0;}
开发者ID:ratsbu11,项目名称:android_kernel_asus_zenfone5,代码行数:24,


示例22: PROCESS_THREAD

/*---------------------------------------------------------------------------*/PROCESS_THREAD(preload_process, ev, data){  PROCESS_BEGIN();  etimer_set(&etimer, 5 * CLOCK_SECOND);  PROCESS_WAIT_UNTIL(etimer_expired(&etimer));  watchdog_stop();  leds_on(LEDS_RED);    preload();    leds_on(LEDS_BLUE);    printf("done/n");    leds_off(LEDS_RED + LEDS_BLUE);  watchdog_start();  while(1) {    PROCESS_WAIT_EVENT();  }  PROCESS_END();}
开发者ID:Snow-Storm,项目名称:contiki,代码行数:24,


示例23: main

int main (){    watchdog_stop();    set_mcu_speed_dco_mclk_16MHz_smclk_8MHz(); // set global clock    /* Initialisation begin */    leds_init();	// leds :')    spi_init();	//    cc2500_init();	// radio init    #if defined(USER_RFCONFIG)    cc2500_configure(& USER_RFCONFIG );    #endif    timerA_init(); // global timer    timerA_register_cb(&timer_tick_cb); // protothread timer increment callback    timerA_start_milliseconds(TIMER_PERIOD_MS);    uart_init(UART_9600_SMCLK_8MHZ); // serial link    printf("adc test application: temperature/n/n");    adc10_start(); // temperature sensor    __enable_interrupt();            /* Initialisation end */    while(1)    {        thread_periodic_capture(&pt[0]);        thread_periodic_radio(&pt[1]);        //do something    }    return 0;}
开发者ID:aauroy,项目名称:ANB-protocol,代码行数:37,


示例24: watchdog_release

static int watchdog_release(struct inode *inode, struct file *file){	struct watchdog_device *wdd = file->private_data;	int err = -EBUSY;	/*	 * We only stop the watchdog if we received the magic character	 * or if WDIOF_MAGICCLOSE is not set. If nowayout was set then	 * watchdog_stop will fail.	 */	if (!test_bit(WDOG_ACTIVE, &wdd->status))		err = 0;	else if (test_and_clear_bit(WDOG_ALLOW_RELEASE, &wdd->status) ||		 !(wdd->info->options & WDIOF_MAGICCLOSE))		err = watchdog_stop(wdd);	/* If the watchdog was not stopped, send a keepalive ping */	if (err < 0) {		mutex_lock(&wdd->lock);		if (!test_bit(WDOG_UNREGISTERED, &wdd->status))			dev_crit(wdd->dev, "watchdog did not stop!/n");		mutex_unlock(&wdd->lock);		watchdog_ping(wdd);	}	/* Allow the owner module to be unloaded again */	module_put(wdd->ops->owner);	/* make sure that /dev/watchdog can be re-opened */	clear_bit(WDOG_DEV_OPEN, &wdd->status);	/* Note wdd may be gone after this, do not use after this! */	if (wdd->ops->unref)		wdd->ops->unref(wdd);	return 0;}
开发者ID:Chong-Li,项目名称:cse522,代码行数:37,


示例25: cfs_garbage_collect

/*---------------------------------------------------------------------------*/static intcfs_garbage_collect(void){  uint16_t sector;  uint16_t active_pages, free_pages, obsolete_pages;  uint8_t sectors_in_row, longest_row;    watchdog_stop();    PRINTF("Coffee: Running the file system garbage collector.../n");    sectors_in_row = longest_row = 0;  /*    * The garbage collector erases as many sectors as possible. A sector is   * erasable if there are only free or obsolete pages in it.   */  for(sector = 0; sector < COFFEE_SIZE / COFFEE_SECTOR_SIZE; sector++) {    get_sector_status(sector, &active_pages, &free_pages, &obsolete_pages);    PRINTF("Coffee: Sector %u has %u active, %u free, and %u obsolete pages./n",	sector, active_pages, free_pages, obsolete_pages);    if(active_pages == 0 && obsolete_pages > 0) {      COFFEE_ERASE(sector);      PRINTF("Coffee: Erased sector %d!/n", sector);      ++sectors_in_row;      if(sectors_in_row > longest_row) {	longest_row = sectors_in_row;      }    } else {      sectors_in_row = 0;    }  }  watchdog_start();    return longest_row * COFFEE_PAGES_PER_SECTOR;}
开发者ID:kincki,项目名称:contiki,代码行数:37,


示例26: main

//.........这里部分代码省略.........#endif  leds_off(LEDS_GREEN);#if TIMESYNCH_CONF_ENABLED  timesynch_init();  timesynch_set_authority_level((rimeaddr_node_addr.u8[0] << 4) + 16);#endif /* TIMESYNCH_CONF_ENABLED */#if WITH_UIP  process_start(&tcpip_process, NULL);  process_start(&uip_fw_process, NULL);	/* Start IP output */  process_start(&slip_process, NULL);  slip_set_input_callback(set_gateway);  {    uip_ipaddr_t hostaddr, netmask;    uip_init();    uip_ipaddr(&hostaddr, 172,16,	       rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]);    uip_ipaddr(&netmask, 255,255,0,0);    uip_ipaddr_copy(&meshif.ipaddr, &hostaddr);    uip_sethostaddr(&hostaddr);    uip_setnetmask(&netmask);    uip_over_mesh_set_net(&hostaddr, &netmask);    /*    uip_fw_register(&slipif);*/    uip_over_mesh_set_gateway_netif(&slipif);    uip_fw_default(&meshif);    uip_over_mesh_init(UIP_OVER_MESH_CHANNEL);    printf("uIP started with IP address %d.%d.%d.%d/n",           uip_ipaddr_to_quad(&hostaddr));  }#endif /* WITH_UIP */  energest_init();  ENERGEST_ON(ENERGEST_TYPE_CPU);  watchdog_start();  /* Stop the watchdog */  watchdog_stop();#if !PROCESS_CONF_NO_PROCESS_NAMES  print_processes(autostart_processes);#else /* !PROCESS_CONF_NO_PROCESS_NAMES */  putchar('/n'); /* include putchar() */#endif /* !PROCESS_CONF_NO_PROCESS_NAMES */  autostart_start(autostart_processes);  /*   * This is the scheduler loop.   */  while(1) {    int r;    do {      /* Reset watchdog. */      watchdog_periodic();      r = process_run();    } while(r > 0);    /*     * Idle processing.     */    int s = splhigh();		/* Disable interrupts. */    /* uart1_active is for avoiding LPM3 when still sending or receiving */    if(process_nevents() != 0 || uart1_active()) {      splx(s);                  /* Re-enable interrupts. */    } else {      static unsigned long irq_energest = 0;      /* Re-enable interrupts and go to sleep atomically. */      ENERGEST_OFF(ENERGEST_TYPE_CPU);      ENERGEST_ON(ENERGEST_TYPE_LPM);      /* We only want to measure the processing done in IRQs when we	 are asleep, so we discard the processing time done when we	 were awake. */      energest_type_set(ENERGEST_TYPE_IRQ, irq_energest);      watchdog_stop();      _BIS_SR(GIE | SCG0 | SCG1 | CPUOFF); /* LPM3 sleep. This                                              statement will block                                              until the CPU is                                              woken up by an                                              interrupt that sets                                              the wake up flag. */      /* We get the current processing time for interrupts that was         done during the LPM and store it for next time around.  */      dint();      irq_energest = energest_type_time(ENERGEST_TYPE_IRQ);      eint();      watchdog_start();      ENERGEST_OFF(ENERGEST_TYPE_LPM);      ENERGEST_ON(ENERGEST_TYPE_CPU);    }  }}
开发者ID:1uk3,项目名称:contiki,代码行数:101,


示例27: PROCESS_THREAD

PROCESS_THREAD(scanning, ev, data){ PROCESS_BEGIN();  // Initial operations leds_off(LEDS_ALL); watchdog_stop();   // Avoiding wrong RSSI readings unsigned temp; CC2420_READ_REG(CC2420_AGCTST1, temp); CC2420_WRITE_REG(CC2420_AGCTST1, (temp + (1 << 8) + (1 << 13)));   // Selecting the channel	 SPI_SETCHANNEL_SUPERFAST(357+((CHANNEL-11)*5));  // Avoiding the initial wrong readings by discarding the wrong readings CC2420_SPI_ENABLE(); unsigned long k=0; for (k=0; k<=15; k++) {MY_FASTSPI_GETRSSI(temp);} CC2420_SPI_DISABLE();   static struct etimer et; while(1){	 	 	 #if VERBOSE	 printf("#START (dBm: occurrencies)/n");	 #endif	 	 // Resetting everything	 for(k=0;k<BUFFER_SIZE;k++){			buffer0[k] = 0;	 }	 	 dint();				// Disable interrupts	 boost_cpu(); 			// Temporarily boost CPU speed	 CC2420_SPI_ENABLE(); 	// Enable SPI		 // Actual scanning 	 static signed char rssi;	 for(k=0; k<MAX_VALUE; k++){				MY_FASTSPI_GETRSSI(rssi);			buffer0[rssi+55]++;	 }	 	 CC2420_SPI_DISABLE();	// Disable SPI	 restore_cpu();			// Restore CPU speed	 eint(); 				// Re-enable interrupts 	 // Printing the stored values in compressed form 	 unsigned long sum_cca = 0;	 unsigned long max = 0, max_value = 0;	 for(temp=0; temp<BUFFER_SIZE; temp++) {			sum_cca += (temp * buffer0[temp]);		if(buffer0[temp] > max){			max = buffer0[temp];			max_value = temp;		}			 }	 	 // Printing the results of the CCA	 float f_cca = (((float) sum_cca*1.0000) / MAX_VALUE)-100.0000;			 #if VERBOSE		printf("Average noise: %ld.%04u/nStatistic Mode noise: %ld/n", (long) f_cca, (unsigned)((f_cca-floor(f_cca))*10000), max_value-100);	 #else		printf("%ld.%04u/n", (long) f_cca, (unsigned)((f_cca-floor(f_cca))*10000));	 #endif	 	 #if VERBOSE		printf("#END/n");	 #endif	 	 // Waiting for timer	 etimer_set(&et, PERIOD_TIME);	 PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));	  }  PROCESS_WAIT_EVENT();  PROCESS_END();}
开发者ID:kincki,项目名称:contiki,代码行数:82,


示例28: multi_server_main

//.........这里部分代码省略.........     * on the same socket, and wakes up every process in select(). See TCP/IP     * Illustrated volume 2 page 532. We avoid select() collisions with an     * external lock file.     */    /*     * XXX Can't compete for exclusive access to the listen socket because we     * also have to monitor existing client connections for service requests.     */#if 0    if (stream == 0 && !alone) {	lock_path = concatenate(DEF_PID_DIR, "/", transport,				".", service_name, (char *) 0);	why = vstring_alloc(1);	if ((multi_server_lock = safe_open(lock_path, O_CREAT | O_RDWR, 0600,				      (struct stat *) 0, -1, -1, why)) == 0)	    msg_fatal("open lock file %s: %s", lock_path, vstring_str(why));	close_on_exec(vstream_fileno(multi_server_lock), CLOSE_ON_EXEC);	myfree(lock_path);	vstring_free(why);    }#endif    /*     * Set up call-back info.     */    multi_server_service = service;    multi_server_name = service_name;    multi_server_argv = argv + optind;    /*     * Run pre-jail initialization.     */    if (chdir(var_queue_dir) < 0)	msg_fatal("chdir(/"%s/"): %m", var_queue_dir);    if (pre_init)	pre_init(multi_server_name, multi_server_argv);    /*     * Optionally, restrict the damage that this process can do.     */    resolve_local_init();    tzset();    chroot_uid(root_dir, user_name);    /*     * Run post-jail initialization.     */    if (post_init)	post_init(multi_server_name, multi_server_argv);    /*     * Are we running as a one-shot server with the client connection on     * standard input? If so, make sure the output is written to stdout so as     * to satisfy common expectation.     */    if (stream != 0) {	vstream_control(stream,			VSTREAM_CTL_DOUBLE,			VSTREAM_CTL_WRITE_FD, STDOUT_FILENO,			VSTREAM_CTL_END);	service(stream, multi_server_name, multi_server_argv);	vstream_fflush(stream);	multi_server_exit();    }    /*     * Running as a semi-resident server. Service connection requests.     * Terminate when we have serviced a sufficient number of clients, when     * no-one has been talking to us for a configurable amount of time, or     * when the master process terminated abnormally.     */    if (var_idle_limit > 0)	event_request_timer(multi_server_timeout, (char *) 0, var_idle_limit);    for (fd = MASTER_LISTEN_FD; fd < MASTER_LISTEN_FD + socket_count; fd++) {	event_enable_read(fd, multi_server_accept, CAST_INT_TO_CHAR_PTR(fd));	close_on_exec(fd, CLOSE_ON_EXEC);    }    event_enable_read(MASTER_STATUS_FD, multi_server_abort, (char *) 0);    close_on_exec(MASTER_STATUS_FD, CLOSE_ON_EXEC);    close_on_exec(MASTER_FLOW_READ, CLOSE_ON_EXEC);    close_on_exec(MASTER_FLOW_WRITE, CLOSE_ON_EXEC);    watchdog = watchdog_create(var_daemon_timeout, (WATCHDOG_FN) 0, (char *) 0);    /*     * The event loop, at last.     */    while (var_use_limit == 0 || use_count < var_use_limit || client_count > 0) {	if (multi_server_lock != 0) {	    watchdog_stop(watchdog);	    if (myflock(vstream_fileno(multi_server_lock), INTERNAL_LOCK,			MYFLOCK_OP_EXCLUSIVE) < 0)		msg_fatal("select lock: %m");	}	watchdog_start(watchdog);	delay = loop ? loop(multi_server_name, multi_server_argv) : -1;	event_loop(delay);    }    multi_server_exit();}
开发者ID:LMDB,项目名称:postfix,代码行数:101,


示例29: watchdog_suspend

static int watchdog_suspend(struct device *dev){	struct watchdog_data *wd = dev_get_drvdata(dev);	watchdog_stop(wd);	return 0;}
开发者ID:Aaroneke,项目名称:galaxy-2636,代码行数:6,


示例30: watchdog_probe

static int watchdog_probe(struct platform_device *pdev){	struct resource *res_src, *res_tmr;	struct watchdog_data *wd;	u32 src_value;	int ret = 0;	if (pdev->id != -1) {		dev_err(&pdev->dev, "only id -1 supported/n");		return -ENODEV;	}	wd = kzalloc(sizeof(*wd), GFP_KERNEL);	if (!wd) {		dev_err(&pdev->dev, "out of memory/n");		return -ENOMEM;	}	res_src = request_mem_region(TEGRA_CLK_RESET_BASE, 4, pdev->name);	if (!res_src) {		dev_err(&pdev->dev,			"unable to request mem region TEGRA_CLK_RESET_BASE/n");		ret = -ENOMEM;		goto err_request_mem_region_reset_base;	}	res_tmr = request_mem_region(TEGRA_TMR1_BASE, TEGRA_TMR1_SIZE,				pdev->name);	if (!res_tmr) {		dev_err(&pdev->dev,			"unable to request mem region TEGRA_TMR1_BASE/n");		ret = -ENOMEM;		goto err_request_mem_region_tmr1_base;	}	wd->wdt_source = ioremap(res_src->start, resource_size(res_src));	if (!wd->wdt_source) {		dev_err(&pdev->dev, "unable to map clk_reset registers/n");		ret = -ENOMEM;		goto err_ioremap_reset_base;	}	wd->wdt_timer = ioremap(res_tmr->start, resource_size(res_tmr));	if (!wd->wdt_timer) {		dev_err(&pdev->dev, "unable to map tmr1 registers/n");		ret = -ENOMEM;		goto err_ioremap_tmr1_base;	}	src_value = readl(wd->wdt_source);	dev_info(&pdev->dev, "reset source register 0x%x/n", src_value);	if (src_value & BIT(12))		dev_info(&pdev->dev, "last reset due to watchdog timeout/n");	/* the watchdog shouldn't be running, but call stop to also clear	 * some state that might have persisted between boots	 */	watchdog_stop(wd);	wd->timeout = WDT_TIMEOUT;	wd->pet_interval = WDT_PET_INTERVAL;	wd->wq = create_workqueue("pet_watchdog");	if (!wd->wq) {		dev_err(&pdev->dev, "unable to map tmr1 registers/n");		ret = -ENOMEM;		goto err_create_workqueue;	}	INIT_DELAYED_WORK(&wd->work, watchdog_workfunc);	platform_set_drvdata(pdev, wd);	dev_info(&pdev->dev, "Starting watchdog timer/n");	watchdog_start(wd);	return 0;err_create_workqueue:	iounmap(wd->wdt_source);err_ioremap_tmr1_base:	iounmap(wd->wdt_timer);err_ioremap_reset_base:	release_mem_region(res_src->start, resource_size(res_src));err_request_mem_region_tmr1_base:	release_mem_region(res_tmr->start, resource_size(res_tmr));err_request_mem_region_reset_base:	kfree(wd);	return ret;}
开发者ID:Aaroneke,项目名称:galaxy-2636,代码行数:84,



注:本文中的watchdog_stop函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ watchdog_unregister_device函数代码示例
C++ watchdog_start函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。