Commit bccfebd2 authored by Alessandro Rubini's avatar Alessandro Rubini

shell: added "sleep" command (not built by default)

This adds "sleep" that is used to verify the usleep function.
It is not build by default nor by a Kconfig option, because it is
not expected to be generally useful.

To build, add "CONFIG_CMD_SLEEP=y" to the command line of make.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 3497d157
/*
* This work is part of the White Rabbit project
*
* Copyright (C) 2013 CERN (www.cern.ch)
* Author: Alessandro Rubini <rubini@gnudd.com>
*
* Released according to the GNU GPL, version 2 or any later version.
*/
#include <wrc.h>
#include <shell.h>
static int cmd_sleep(const char *args[])
{
int sec = 1;
if (args[0])
fromdec(args[0], &sec);
while (sec--)
usleep(1000 * 1000);
return 0;
}
DEFINE_WRC_COMMAND(sleep) = {
.name = "sleep",
.exec = cmd_sleep,
};
......@@ -18,3 +18,4 @@ obj-y += \
obj-$(CONFIG_ETHERBONE) += shell/cmd_ip.o
obj-$(CONFIG_PPSI_RUNTIME_VERBOSITY) += shell/cmd_verbose.o
obj-$(CONFIG_CMD_CONFIG) += shell/cmd_config.o
obj-$(CONFIG_CMD_SLEEP) += shell/cmd_sleep.o
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment