void motors_state_init(void) { ASSERT_ONCE(); ASSERT_NULL(spinning_socket); spinning_socket = scl_get_socket("motors_spinning"); scl_send_static(spinning_socket, "false", 5); ASSERT_NOT_NULL(spinning_socket); etimer_init(&timer, 1.5); }
/*============================================================================*/ void ctimer_init(void) { if (gc_init) return; etimer_init(); struct ctimer *c; list_init(gp_ctimList); for(c = list_head(gp_ctimList); c != NULL; c = c->next) { etimer_set(&c->etimer, c->etimer.timer.interval, ctimer_refresh); } gc_init = 1; }
uint8_t board_conf(s_ns_t *ps_nStack) { if (ps_nStack != NULL) { ps_nStack->inif = &emb6_netdev2_driver; etimer_init(); return ps_nStack->inif->init(ps_nStack); } else { DEBUG("Network stack pointer is NULL"); return 0; } }
int pi_rrd_start (rrd_ctxt_t * rrd) { struct stat statbuf; /* if the file does not exist, we must create the RRD */ if (stat (rrd->filename, &statbuf) < 0) { rrd_ctxt_datapoint_t *dp; unsigned int argc = 0; char *argv[256]; unsigned char period[64]; /* if ENOENT is returned, we need to create the archive file */ if (errno != ENOENT) return -1; argv[argc++] = "create"; argv[argc++] = rrd->filename; /* we add the argument to set a non-standard step */ if (rrd->period != 300) { snprintf (period, 64, "%lu", rrd->period); argv[argc++] = "-s"; argv[argc++] = period; } /* we add the data points */ for (dp = rrd->points.next; (dp != &rrd->points) && (argc < 255); dp = dp->next) argv[argc++] = dp->spec; /* we add the RRAs */ for (dp = rrd->rras.next; (dp != &rrd->rras) && (argc < 255); dp = dp->next) argv[argc++] = dp->spec; argv[argc] = NULL; /* create the rrd! */ errno = 0; if (rrd_create (argc, argv) < 0) return -1; } /* init the timer */ etimer_init (&rrd->timer, (etimer_handler_t *) pi_rrd_update, rrd); /* set the timer for a multiple of the period */ etimer_set (&rrd->timer, (rrd->period - (now.tv_sec % rrd->period)) * 1000); return 0; }
void netInit() { POSTASK_t t; int i; uipGiant = posSemaCreate(0); uipMutex = posMutexCreate(); pollTicks = INFINITE; P_ASSERT("netInit", uipGiant != NULL && uipMutex != NULL); POS_SETEVENTNAME(uipGiant, "uip:giant"); POS_SETEVENTNAME(uipMutex, "uip:mutex"); // uosFS setup netFS.base.mountPoint = "/socket"; netFS.base.cf = &netFSConf; uosMount(&netFS.base); // Initialize contiki-style timers (used by uip code) etimer_init(); dataToSend = 0; for(i = 0; i < UIP_CONNS; i++) uip_conns[i].appstate.file = NULL; #if UIP_UDP for(i = 0; i < UIP_UDP_CONNS; i++) uip_udp_conns[i].appstate.file = NULL; #endif /* UIP_UDP */ netInterfaceInit(); uip_init(); #if NETSTACK_CONF_WITH_IPV6 == 0 uip_arp_init(); #endif t = posTaskCreate(netMainThread, NULL, NETCFG_TASK_PRIORITY, NETCFG_STACK_SIZE); P_ASSERT("netInit2", t != NULL); POS_SETTASKNAME(t, "uip:main"); }