Skip to content

Commit

Permalink
tests, examples: adapt to simplified shell
Browse files Browse the repository at this point in the history
  • Loading branch information
kaspar030 committed Jul 14, 2015
1 parent 8730833 commit 265c128
Show file tree
Hide file tree
Showing 24 changed files with 55 additions and 192 deletions.
1 change: 0 additions & 1 deletion examples/ccn-lite-client/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ BOARD_BLACKLIST := chronos msb-430h telosb wsn430-v1_3b wsn430-v1_4 z1 redbee-ec

USEMODULE += shell
USEMODULE += shell_commands
USEMODULE += uart0
USEMODULE += ps
USEMODULE += random
USEMODULE += defaulttransceiver
Expand Down
13 changes: 3 additions & 10 deletions examples/ccn-lite-client/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@

#include "msg.h"
#include "thread.h"
#include "posix_io.h"
#include "shell.h"
#include "board_uart0.h"
#include "transceiver.h"
#include "vtimer.h"
#include "ps.h"
Expand All @@ -54,8 +52,6 @@ static volatile kernel_pid_t _relay_pid = KERNEL_PID_UNDEF, _appserver_pid = KER
#define SHELL_MSG_BUFFER_SIZE (64)
msg_t msg_buffer_shell[SHELL_MSG_BUFFER_SIZE];

shell_t shell;

unsigned char big_buf[3 * 1024];
char small_buf[PAYLOAD_SIZE];

Expand Down Expand Up @@ -355,12 +351,9 @@ int main(void)
riot_ccn_relay_start();

puts("starting shell...");
puts(" posix open");
posix_open(uart0_handler_pid, 0);
puts(" shell init");
shell_init(&shell, sc, UART0_BUFSIZE, uart0_readc, uart0_putc);
puts(" shell run");
shell_run(&shell);

char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(sc, line_buf, SHELL_DEFAULT_BUFSIZE);

return 0;
}
1 change: 0 additions & 1 deletion examples/default/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ QUIET ?= 1

# Modules to include:

USEMODULE += uart0
USEMODULE += shell
USEMODULE += shell_commands
USEMODULE += ps
Expand Down
9 changes: 2 additions & 7 deletions examples/default/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@
#include <string.h>

#include "thread.h"
#include "posix_io.h"
#include "shell.h"
#include "shell_commands.h"
#include "board_uart0.h"

#if FEATURE_PERIPH_RTC
#include "periph/rtc.h"
Expand Down Expand Up @@ -137,9 +135,6 @@ void init_transceiver(void)

int main(void)
{
shell_t shell;
(void) posix_open(uart0_handler_pid, 0);

#ifdef MODULE_LTC4150
ltc4150_start();
#endif
Expand All @@ -154,8 +149,8 @@ int main(void)

(void) puts("Welcome to RIOT!");

shell_init(&shell, NULL, UART0_BUFSIZE, uart0_readc, uart0_putc);
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);

shell_run(&shell);
return 0;
}
3 changes: 1 addition & 2 deletions examples/ng_networking/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ USEMODULE += ng_udp
USEMODULE += ng_pktdump
# Additional networking modules that can be dropped if not needed
USEMODULE += ng_icmpv6_echo
# Add also the shell, some shell commands (which are based on uart0 in this app)
USEMODULE += uart0
# Add also the shell, some shell commands
USEMODULE += shell
USEMODULE += shell_commands
USEMODULE += ps
Expand Down
9 changes: 2 additions & 7 deletions examples/ng_networking/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
#include <stdio.h>

#include "shell.h"
#include "board_uart0.h"
#include "posix_io.h"

extern int udp_cmd(int argc, char **argv);

Expand All @@ -33,15 +31,12 @@ static const shell_command_t shell_commands[] = {

int main(void)
{
shell_t shell;

puts("RIOT network stack example application");

/* start shell */
puts("All up, running the shell now");
posix_open(uart0_handler_pid, 0);
shell_init(&shell, shell_commands, UART0_BUFSIZE, uart0_readc, uart0_putc);
shell_run(&shell);
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);

/* should be never reached */
return 0;
Expand Down
1 change: 0 additions & 1 deletion examples/rpl_udp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ BOARD_BLACKLIST := arduino-mega2560

USEMODULE += shell
USEMODULE += shell_commands
USEMODULE += uart0
USEMODULE += ps
USEMODULE += vtimer
USEMODULE += defaulttransceiver
Expand Down
10 changes: 3 additions & 7 deletions examples/rpl_udp/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
#include <stdio.h>

#include "net_if.h"
#include "posix_io.h"
#include "shell.h"
#include "shell_commands.h"
#include "board_uart0.h"
#include "udp.h"

#include "rpl_udp.h"
Expand All @@ -43,14 +41,12 @@ int main(void)
{
puts("RPL router v"APP_VERSION);

/* start shell */
posix_open(uart0_handler_pid, 0);
net_if_set_src_address_mode(0, NET_IF_TRANS_ADDR_M_SHORT);
id = net_if_get_hardware_address(0);

shell_t shell;
shell_init(&shell, shell_commands, UART0_BUFSIZE, uart0_readc, uart0_putc);
/* start shell */
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);

shell_run(&shell);
return 0;
}
14 changes: 3 additions & 11 deletions tests/driver_at86rf2xx/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,14 @@

#include "shell.h"
#include "shell_commands.h"
#include "posix_io.h"
#include "board_uart0.h"
#include "net/ng_pktdump.h"
#include "net/ng_netbase.h"

/**
* @brief Buffer size used by the shell
*/
#define SHELL_BUFSIZE (64U)

/**
* @brief Maybe you are a golfer?!
*/
int main(void)
{
shell_t shell;
ng_netreg_entry_t dump;

puts("AT86RF2xx device driver test");
Expand All @@ -50,9 +42,9 @@ int main(void)

/* 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);

char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);

return 0;
}
14 changes: 3 additions & 11 deletions tests/driver_kw2xrf/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,11 @@

#include "shell.h"
#include "shell_commands.h"
#include "posix_io.h"
#include "board_uart0.h"
#include "net/ng_netbase.h"
#include "net/ng_pktdump.h"

/**
* @brief Buffer size used by the shell
*/
#define SHELL_BUFSIZE (64U)

int main(void)
{
shell_t shell;
ng_netreg_entry_t dump;

puts("KW2XRF device driver test");
Expand All @@ -46,9 +38,9 @@ int main(void)

/* 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);

char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);

return 0;
}
10 changes: 2 additions & 8 deletions tests/driver_netdev_eth/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,11 @@
#include "net/dev_eth.h"
#include "dev_eth_tap.h"

/**
* @brief Buffer size used by the shell
*/
#define SHELL_BUFSIZE (64U)

/**
* @brief Maybe you are a golfer?!
*/
int main(void)
{
shell_t shell;
ng_netreg_entry_t dump;

puts("netdev ethernet device driver test");
Expand All @@ -60,8 +54,8 @@ int main(void)
ng_netreg_register(NG_NETTYPE_UNDEF, &dump);

/* start the shell */
shell_init(&shell, NULL, SHELL_BUFSIZE, getchar, putchar);
shell_run(&shell);
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);

return 0;
}
10 changes: 2 additions & 8 deletions tests/driver_nrf24l01p_lowlevel/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@

#define TEST_RX_MSG 1

#define SHELL_BUFFER_SIZE 128

static int cmd_send(int argc, char **argv);
static int cmd_print_regs(int argc, char **argv);
static int cmd_its(int argc, char **argv);
Expand Down Expand Up @@ -325,14 +323,10 @@ int cmd_print_regs(int argc, char **argv)

int main(void)
{
shell_t shell;

puts("Welcome to RIOT!");

puts("Initializing shell...");
shell_init(&shell, shell_commands, SHELL_BUFFER_SIZE, getchar, putchar);

puts("Starting shell...");
shell_run(&shell);
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);
return 0;
}
11 changes: 2 additions & 9 deletions tests/driver_nrfmin/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,15 @@
#include <stdio.h>

#include "shell.h"
#include "posix_io.h"
#include "board_uart0.h"
#include "nrfmin.h"
#include "net/ng_netbase.h"
#include "net/ng_nomac.h"
#include "net/ng_pktdump.h"

#define SHELL_BUFSIZE (UART0_BUFSIZE)

static char nomac_stack[THREAD_STACKSIZE_DEFAULT];

int main(void)
{
shell_t shell;
ng_netdev_t dev;
ng_netreg_entry_t netobj;

Expand All @@ -51,10 +46,8 @@ int main(void)
ng_netreg_register(NG_NETTYPE_UNDEF, &netobj);

/* initialize and run the shell */
board_uart0_init();
posix_open(uart0_handler_pid, 0);
shell_init(&shell, NULL, SHELL_BUFSIZE, uart0_readc, uart0_putc);
shell_run(&shell);
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);

return 0;
}
12 changes: 3 additions & 9 deletions tests/driver_pcd8544/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,9 @@
#include <string.h>
#include <stdlib.h>

#include "posix_io.h"
#include "board_uart0.h"
#include "shell.h"
#include "pcd8544.h"

#define SHELL_BUFSIZE (64U)

static pcd8544_t dev;

static int _contrast(int argc, char **argv)
Expand Down Expand Up @@ -158,8 +154,6 @@ static const shell_command_t shell_commands[] = {

int main(void)
{
shell_t shell;

puts("PCD8544 LCD display test application\n");
printf("Initializing PCD8544 LCD at SPI_%i... ", TEST_PCD8544_SPI);
if (pcd8544_init(&dev, TEST_PCD8544_SPI, TEST_PCD8544_CS,
Expand All @@ -170,9 +164,9 @@ int main(void)

/* run shell */
puts("All OK, running shell now");
(void) posix_open(uart0_handler_pid, 0);
shell_init(&shell, shell_commands, SHELL_BUFSIZE, uart0_readc, uart0_putc);
shell_run(&shell);

char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);

return 0;
}
11 changes: 3 additions & 8 deletions tests/driver_xbee/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,11 @@
#include "net/ng_netbase.h"
#include "net/ng_pktdump.h"

/**
* @brief Buffer size used by the shell
*/
#define SHELL_BUFSIZE (64U)

/**
* @brief Maybe you are a golfer?!
*/
int main(void)
{
shell_t shell;
ng_netreg_entry_t dump;

puts("Xbee S1 device driver test");
Expand All @@ -51,8 +45,9 @@ int main(void)

/* start the shell */
puts("Initialization OK, starting shell now");
shell_init(&shell, NULL, SHELL_BUFSIZE, getchar, putchar);
shell_run(&shell);

char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);

return 0;
}
1 change: 0 additions & 1 deletion tests/netdev/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include "netdev/default.h"

#ifdef NETDEV_DEFAULT
#define SHELL_BUFSIZE (UART0_BUFSIZE)

static size_t dev_address_len = 0;
static netdev_t *dev = NULL;
Expand Down
Loading

0 comments on commit 265c128

Please sign in to comment.