本文整理汇总了C++中process_post_synch函数的典型用法代码示例。如果您正苦于以下问题:C++ process_post_synch函数的具体用法?C++ process_post_synch怎么用?C++ process_post_synch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了process_post_synch函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(etimer_process, ev, data, buf, user_data)
{
struct etimer *t;
PROCESS_BEGIN();
while(1) {
PROCESS_YIELD();
PRINTF("%s():%d timerlist %p\n", __FUNCTION__, __LINE__, timerlist);
for(t = timerlist; t != NULL; t = t->next) {
PRINTF("%s():%d timer %p remaining %d triggered %d\n",
__FUNCTION__, __LINE__,
t, timer_remaining(&t->timer), etimer_is_triggered(t));
if(etimer_expired(t) && !etimer_is_triggered(t)) {
PRINTF("%s():%d timer %p expired, process %p\n",
__FUNCTION__, __LINE__, t, t->p);
if (t->p == NULL) {
PRINTF("calling tcpip_process\n");
process_post_synch(&tcpip_process, PROCESS_EVENT_TIMER, t, NULL);
} else {
process_post_synch(t->p, PROCESS_EVENT_TIMER, t, NULL);
}
}
}
update_time();
}
PROCESS_END();
}
示例2: cc26xx_web_demo_restore_defaults
/*---------------------------------------------------------------------------*/
void
cc26xx_web_demo_restore_defaults(void)
{
cc26xx_web_demo_sensor_reading_t *reading = NULL;
leds_on(LEDS_ALL);
for(reading = list_head(sensor_list);
reading != NULL;
reading = list_item_next(reading)) {
reading->publish = 1;
}
#if CC26XX_WEB_DEMO_MQTT_CLIENT
process_post_synch(&mqtt_client_process,
cc26xx_web_demo_load_config_defaults, NULL);
#endif
#if CC26XX_WEB_DEMO_NET_UART
process_post_synch(&net_uart_process, cc26xx_web_demo_load_config_defaults,
NULL);
#endif
save_config();
leds_off(LEDS_ALL);
}
示例3: contiki_appcall
static void contiki_appcall(void *data)
{
contiki_data_t *s = (contiki_data_t *)data;
if (uip_closed() || uip_aborted() || uip_timedout()) {
//xprintf("closed or aborted or timedout\n");
if (s->state == READING || s->state == WRITTING) {
s->state = ERROR;
} else {
s->state = CLOSED;
}
process_post_synch(s->process, xively_event, s);
} else if (uip_connected()) {
s->state = CONNECTED;
PSOCK_INIT(&s->p, NULL, 0);
process_post_synch(s->process, xively_event, s);
} else if (uip_newdata()) {
if (s->state == READING) {
s->state = READ_END;
process_post_synch(s->process, xively_event, s);
}
}
if (s->state == CLOSING) {
uip_close();
}
handle_output(s);
}
示例4: tcpip_input
/*---------------------------------------------------------------------------*/
void
tcpip_input(void)
{
//printf("Guess I managed to go the stack up \n");
process_post_synch(&tcpip_process, PACKET_INPUT, NULL);
uip_clear_buf();
}
示例5: etimer_request_poll
/*---------------------------------------------------------------------------*/
clock_time_t
etimer_request_poll(void)
{
process_post_synch(&etimer_process, PROCESS_EVENT_POLL,
NULL, NULL);
return next_expiration;
}
示例6: process_start
/*---------------------------------------------------------------------------*/
void
process_start(struct process *p, const char *arg)
{
struct process *q;
/* First make sure that we don't try to start a process that is
already running. */
for(q = process_list; q != p && q != NULL; q = q->next);
/* If we found the process on the process list, we bail out. */
if(q == p) {
return;
}
/* Put on the procs list.*/
p->next = process_list;
process_list = p;
p->state = PROCESS_STATE_RUNNING;
PT_INIT(&p->pt);
PRINTF("process: starting '%s'\n", PROCESS_NAME_STRING(p));
/* Post a synchronous initialization event to the process. */
process_post_synch(p, PROCESS_EVENT_INIT, (process_data_t)arg);
}
示例7: i2cb
bool
i2cb(u8_t addr, u8_t wrlen, u8_t rdlen, u8_t buf[])
{
static i2c_t t = {.buf = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
t.addr = addr;
t.wrlen = wrlen;
t.rdlen = rdlen;
t.cb = internal_cb;
memcpy(t.buf, buf, wrlen);
i2c(&t);
pending = true;
while (pending) {
if (i2c_process.needspoll) {
process_post_synch(&i2c_process, PROCESS_EVENT_POLL, NULL);
i2c_process.needspoll = false;
}
}
memcpy(buf+wrlen,t.buf+wrlen,rdlen);
return i2c_status;
}
示例8: tsch_reset
/*---------------------------------------------------------------------------*/
static void
tsch_reset(void)
{
int i;
frame802154_set_pan_id(0xffff);
/* First make sure pending packet callbacks are sent etc */
process_post_synch(&tsch_pending_events_process, PROCESS_EVENT_POLL, NULL);
/* Empty all neighbor queues */
/* tsch_queue_flush_all(); */
/* Remove unused neighbors */
tsch_queue_free_unused_neighbors();
tsch_queue_update_time_source(NULL);
/* Initialize global variables */
tsch_join_priority = 0xff;
ASN_INIT(current_asn, 0, 0);
current_link = NULL;
/* Reset timeslot timing to defaults */
for(i = 0; i < tsch_ts_elements_count; i++) {
tsch_timing[i] = US_TO_RTIMERTICKS(tsch_default_timing_us[i]);
}
#ifdef TSCH_CALLBACK_LEAVING_NETWORK
TSCH_CALLBACK_LEAVING_NETWORK();
#endif
#if TSCH_AUTOSELECT_TIME_SOURCE
best_neighbor_eb_count = 0;
nbr_table_register(eb_stats, NULL);
tsch_set_eb_period(TSCH_EB_PERIOD);
#endif
}
示例9: tcpip_input
/*---------------------------------------------------------------------------*/
void
tcpip_input(void)
{
process_post_synch(&tcpip_process, PACKET_INPUT, NULL);
uip_len = 0;
#if UIP_CONF_IPV6
uip_ext_len = 0;
#endif /*UIP_CONF_IPV6*/
}
示例10: complete_pending
static void complete_pending(mqtt_state_t* state, int event_type)
{
mqtt_event_data_t event_data;
state->pending_msg_type = 0;
mqtt_flags |= MQTT_FLAG_READY;
event_data.type = event_type;
process_post_synch(state->calling_process, mqtt_event, &event_data);
}
示例11: tcpip_icmp6_call
void
tcpip_icmp6_call(uint8_t type)
{
if(uip_icmp6_conns.appstate.p != PROCESS_NONE) {
/* XXX: This is a hack that needs to be updated. Passing a pointer (&type)
like this only works with process_post_synch. */
process_post_synch(uip_icmp6_conns.appstate.p, tcpip_icmp6_event, &type);
}
return;
}
示例12: PT_THREAD
static PT_THREAD(handle_output(contiki_data_t *s))
{
PSOCK_BEGIN(&s->p);
if (s->state == WRITTING) {
PSOCK_SEND(&s->p, s->out_buf, s->out_len);
s->state = WRITE_END;
process_post_synch(s->process, xively_event, s);
}
PSOCK_END(&s->p);
}
示例13: net_context_tcp_send
int net_context_tcp_send(struct net_buf *buf)
{
/* Prepare data to be sent */
process_post_synch(&ip_buf_context(buf)->tcp,
tcpip_event,
INT_TO_POINTER(TCP_WRITE_EVENT),
buf);
return ip_buf_sent_status(buf);
}
示例14: tcpip_input
/*---------------------------------------------------------------------------*/
void
tcpip_input(void)
{
// printf("Tcpip: input");
// rpl_trace(rpl_dataptr_from_packetbuf());
process_post_synch(&tcpip_process, PACKET_INPUT, NULL);
uip_len = 0;
#if UIP_CONF_IPV6
uip_ext_len = 0;
#endif /*UIP_CONF_IPV6*/
}
示例15: response_handler
void response_handler(ChannelState *state, DataPayload *dp){
if (state->state != STATE_CONNECTED && state->state != STATE_PING){
PRINTF("Not connected to device!\n");
return;
}
state->ticks = 100;
ResponseMsg *rmsg = (ResponseMsg *)dp->data;
PRINTF("%s %d\n", rmsg->name, uip_ntohs(rmsg->data));
/*RESET PING TIMER*/
ctimer_restart(&(state->timer));
process_post_synch(state->ccb.client_process, KNOT_EVENT_DATA_READY, rmsg);
}