Exemplo n.º 1
0
int main(void)
{
    /* initialization */
    gnrc_pktbuf_init();
    msg_init_queue(_main_msg_queue, _MAIN_MSG_QUEUE_SIZE);
    netdev2_test_setup(&_dev, NULL);
    netdev2_test_set_isr_cb(&_dev, _dev_isr);
    netdev2_test_set_recv_cb(&_dev, _dev_recv);
    netdev2_test_set_send_cb(&_dev, _dev_send);
    netdev2_test_set_get_cb(&_dev, NETOPT_ADDRESS, _dev_get_addr);
    netdev2_test_set_set_cb(&_dev, NETOPT_ADDRESS, _dev_set_addr);
    gnrc_netdev2_eth_init(&_gnrc_dev, (netdev2_t *)(&_dev));
    _mac_pid = gnrc_netdev2_init(_mac_stack, _MAC_STACKSIZE, _MAC_PRIO,
                                 "gnrc_netdev_eth_test", &_gnrc_dev);
    if (_mac_pid <= KERNEL_PID_UNDEF) {
        puts("Could not start MAC thread\n");
        return 1;
    }

    /* test execution */
    EXECUTE(test_get_addr);
    EXECUTE(test_send);
    EXECUTE(test_receive);
    EXECUTE(test_set_addr);
    puts("ALL TESTS SUCCESSFUL");

    return 0;
}
Exemplo n.º 2
0
void auto_init_netdev2_tap(void)
{
    gnrc_netdev2_eth_init(&_gnrc_netdev2_tap, (netdev2_t*)&netdev2_tap);

    gnrc_netdev2_init(_netdev2_eth_stack, TAP_MAC_STACKSIZE,
            TAP_MAC_PRIO, "gnrc_netdev2_tap", &_gnrc_netdev2_tap);
}
Exemplo n.º 3
0
void auto_init_xbee(void)
{
    for (size_t i = 0; i < XBEE_NUM; i++) {
        DEBUG("Initializing XBee radio #%u\n", i);

        xbee_setup(&xbee_devs[i], &xbee_params[i]);
        gnrc_netdev2_xbee_init(&gnrc_adpt[i], &xbee_devs[i]);
        gnrc_netdev2_init(stacks[i], XBEE_MAC_STACKSIZE, XBEE_MAC_PRIO,
                              "xbee", &gnrc_adpt[i]);
    }
}
Exemplo n.º 4
0
void auto_init_enc28j60(void)
{
    for (int i = 0; i < ENC28J60_NUM; i++) {
        DEBUG("auto_init_enc28j60(): initializing device [%i]...\n", i);
        /* setup netdev2 device */
        enc28j60_setup(&dev[i], &enc28j60_params[i]);
        /* initialize netdev2 <-> gnrc adapter state */
        gnrc_netdev2_eth_init(&gnrc_adpt[i], (netdev2_t *)&dev[i]);
        /* start gnrc netdev2 thread */
        gnrc_netdev2_init(stack[i], ENC28J60_MAC_STACKSIZE, ENC28J60_MAC_PRIO,
                          "gnrc_enc28j60", &gnrc_adpt[i]);
    }
}
Exemplo n.º 5
0
void auto_init_cc110x(void)
{
    for (int i = 0; i < CC110X_NUM; i++) {
        const cc110x_params_t *p = &cc110x_params[i];
        DEBUG("Initializing CC110X radio at SPI_%i\n", p->spi);
        int res = netdev2_cc110x_setup(&cc110x_devs[i], p);
        if (res < 0) {
            DEBUG("Error initializing CC110X radio device!\n");
        }
        else {
            gnrc_netdev2_cc110x_init(&_gnrc_netdev2_devs[i], &cc110x_devs[i]);
            res = gnrc_netdev2_init(_stacks[i], CC110X_MAC_STACKSIZE,
                    CC110X_MAC_PRIO, "cc110x", &_gnrc_netdev2_devs[i]);
            if (res < 0) {
                DEBUG("Error starting gnrc_cc110x thread for CC110X!\n");
            }
        }
    }
}
Exemplo n.º 6
0
void auto_init_at86rf2xx(void)
{
    for (unsigned i = 0; i < AT86RF2XX_NUM; i++) {
        const at86rf2xx_params_t *p = &at86rf2xx_params[i];
        int res;

        DEBUG("Initializing AT86RF2xx radio at SPI_%i\n", p->spi);
        at86rf2xx_setup(&at86rf2xx_devs[i], (at86rf2xx_params_t*) p);
        res = gnrc_netdev2_ieee802154_init(&gnrc_adpt[i],
                                           (netdev2_ieee802154_t *)&at86rf2xx_devs[i]);

        if (res < 0) {
            DEBUG("Error initializing AT86RF2xx radio device!\n");
        }
        else {
            gnrc_netdev2_init(_at86rf2xx_stacks[i],
                              AT86RF2XX_MAC_STACKSIZE,
                              AT86RF2XX_MAC_PRIO,
                              "at86rf2xx",
                              &gnrc_adpt[i]);
        }
    }
}
Exemplo n.º 7
0
void auto_init_at86rf2xx(void)
{
    for (unsigned i = 0; i < AT86RF2XX_NUM; i++) {
        const at86rf2xx_params_t *p = &at86rf2xx_params[i];
        int res;

        LOG_DEBUG("[auto_init_netif] initializing at86rf2xx #%u\n", i);

        at86rf2xx_setup(&at86rf2xx_devs[i], (at86rf2xx_params_t*) p);
        res = gnrc_netdev2_ieee802154_init(&gnrc_adpt[i],
                                           (netdev2_ieee802154_t *)&at86rf2xx_devs[i]);

        if (res < 0) {
            LOG_ERROR("[auto_init_netif] error initializing at86rf2xx radio #%u\n", i);
        }
        else {
            gnrc_netdev2_init(_at86rf2xx_stacks[i],
                              AT86RF2XX_MAC_STACKSIZE,
                              AT86RF2XX_MAC_PRIO,
                              "at86rf2xx",
                              &gnrc_adpt[i]);
        }
    }
}