/** * @brief Maybe you are a golfer?! */ int main(void) { shell_t shell; ng_netreg_entry_t dump; puts("ZEP module test"); /* initialize and register pktdump */ dump.pid = ng_pktdump_getpid(); if (dump.pid <= KERNEL_PID_UNDEF) { puts("Error starting pktdump thread"); return -1; } dump.demux_ctx = NG_NETREG_DEMUX_CTX_ALL; ng_netreg_register(NG_NETTYPE_NETIF, &dump); /* start the shell */ puts("Initialization OK, starting shell now"); shell_init(&shell, NULL, SHELL_BUFSIZE, getchar, putchar); shell_run(&shell); return 0; }
/** * @brief Maybe you are a golfer?! */ int main(void) { shell_t shell; ng_netreg_entry_t dump; puts("AT86RF2xx device driver test"); /* register the pktdump thread */ puts("Register the packet dump thread for NG_NETTYPE_UNDEF packets"); dump.pid = ng_pktdump_getpid(); dump.demux_ctx = NG_NETREG_DEMUX_CTX_ALL; ng_netreg_register(NG_NETTYPE_UNDEF, &dump); /* start the shell */ puts("Initialization successful - starting the shell now"); (void) posix_open(uart0_handler_pid, 0); shell_init(&shell, NULL, SHELL_BUFSIZE, uart0_readc, uart0_putc); shell_run(&shell); return 0; }
static void start_server(char *port_str) { uint16_t port; /* check if server is already running */ if (server.pid != KERNEL_PID_UNDEF) { printf("Error: server already running on port %" PRIu32 "\n", server.demux_ctx); return; } /* parse port */ port = (uint16_t)atoi(port_str); if (port == 0) { puts("Error: invalid port specified"); return; } /* start server (which means registering pktdump for the chosen port) */ server.pid = ng_pktdump_getpid(); server.demux_ctx = (uint32_t)port; ng_netreg_register(NG_NETTYPE_UDP, &server); printf("Success: started UDP server on port %" PRIu16 "\n", port); }