Esempio n. 1
0
/**
 * \brief XOMP channel connect callback called by the Flounder backend
 *
 * \param st    Supplied worker state
 * \param err   outcome of the connect attempt
 * \param xb    XOMP Flounder binding
 */
static void master_bind_cb(void *st,
                           errval_t err,
                           struct xomp_binding *xb)
{
    XWI_DEBUG("bound to master: %s\n", err_getstring(err));

    txq_init(&txq, xb, xb->waitset, (txq_register_fn_t) xb->register_send,
             sizeof(struct xomp_msg_st));

    xb->rx_vtbl = rx_vtbl;
    xbinding = xb;

    is_bound = 0x1;
}
Esempio n. 2
0
/**
 * \brief XOMP channel connect callback called by the Flounder backend
 *
 * \param st    Supplied worker state
 * \param err   outcome of the connect attempt
 * \param xb    XOMP Flounder binding
 */
static void bomp_thread_connect_cb(void *st,
                                   errval_t err,
                                   struct bomp_binding *b)
{
    struct bomp_thread *t = st;

    BOMP_DEBUG_THREAD("connected to node master.\n");

    t->ctrl = b;

    txq_init(&t->txq, b, b->waitset, (txq_register_fn_t) b->register_send,
             sizeof(struct bomp_msg_st));

    b->rx_vtbl.execute = execute__rx;
}
Esempio n. 3
0
void send_mesg_test_mode()
{
   	lcd_init();
	init_push_buttons();

	usart_init();
	txq_init();
	usart_drain_rx();

	lcd_puts("Send Mesg Test Mode");
	wait_ms(1000);
	lcd_clear();

	char echo_mesg[] = "foobar";  // Assumed to be less than DATA_FRAME_MAX_LEN.
 
	while (true)
	{
		switch (wait_button("Select Message")) {
		case mesg_ping:

			txq_enqueue(signal_start);
			txq_enqueue(mesg_ping);
			txq_enqueue(signal_stop);
			txq_drain();
			break;

		case mesg_echo:

			txq_enqueue(signal_start);
			txq_enqueue(mesg_echo);

			// Copy the echo message into the `control`:
			strcpy(control.data, echo_mesg);
			control.data_len = strlen(echo_mesg);

			// Enqueue the frame. No more frames coming.
			tx_frame(false);

			txq_enqueue(signal_start);
			txq_drain();
			break;

		default:
			wait_button("Invalid selection.");
			break;
		}
	}
}
Esempio n. 4
0
/**
 * \brief callback when the BOMP thread connects to the node
 *
 * \param st    state pointer
 * \param err   status of the connect
 * \param _b    created BOMP binding
 */
static void bomp_thread_accept_cb(void *st,
                                  errval_t err,
                                  struct bomp_binding *_b)
{
    struct bomp_thread *t = st;

    BOMP_DEBUG_THREAD("connection accepted. tid=%" PRIuCOREID "\n", t->coreid);

    t->thread_err = err;

    txq_init(&t->txq, _b, _b->waitset, (txq_register_fn_t) _b->register_send,
                 sizeof(struct bomp_msg_st));

    _b->st = st;
    t->ctrl = _b;

    _b->rx_vtbl.done = done__rx;
}