From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-yx0-f177.google.com ([209.85.213.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SelPx-0005jP-6Z for barebox@lists.infradead.org; Wed, 13 Jun 2012 11:07:18 +0000 Received: by yenr9 with SMTP id r9so398060yen.36 for ; Wed, 13 Jun 2012 04:07:15 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1339581710-5460-1-git-send-email-s.trumtrar@pengutronix.de> References: <1339581710-5460-1-git-send-email-s.trumtrar@pengutronix.de> Date: Wed, 13 Jun 2012 15:07:15 +0400 Message-ID: From: Antony Pavlov List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: barebox-bounces@lists.infradead.org Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH] commands: add msleep command To: Steffen Trumtrar Cc: barebox@lists.infradead.org On 13 June 2012 14:01, Steffen Trumtrar wrote: > Add a command to sleep for n milliseconds. > May be will be better to upgrade sleep? SYNOPSIS sleep NUMBER DESCRIPTION Pause for NUMBER seconds. The NUMBER may be an arbitrary floating point number. > Signed-off-by: Steffen Trumtrar > --- > =A0commands/Kconfig =A0| =A0 =A04 ++++ > =A0commands/Makefile | =A0 =A01 + > =A0commands/msleep.c | =A0 40 ++++++++++++++++++++++++++++++++++++++++ > =A03 files changed, 45 insertions(+) > =A0create mode 100644 commands/msleep.c > > diff --git a/commands/Kconfig b/commands/Kconfig > index 52e1f17..adc0914 100644 > --- a/commands/Kconfig > +++ b/commands/Kconfig > @@ -25,6 +25,10 @@ config CMD_SLEEP > =A0 =A0 =A0 =A0tristate > =A0 =A0 =A0 =A0prompt "sleep" > > +config CMD_MSLEEP > + =A0 =A0 =A0 tristate > + =A0 =A0 =A0 prompt "msleep" > + > =A0config CMD_SAVEENV > =A0 =A0 =A0 =A0tristate > =A0 =A0 =A0 =A0select ENV_HANDLING > diff --git a/commands/Makefile b/commands/Makefile > index 4c8a0a9..0970ba3 100644 > --- a/commands/Makefile > +++ b/commands/Makefile > @@ -10,6 +10,7 @@ obj-$(CONFIG_CMD_MTEST) =A0 =A0 =A0 =A0 =A0 =A0 =A0 += =3D memtest.o > =A0obj-$(CONFIG_CMD_EDIT) =A0 =A0 =A0 =A0 +=3D edit.o > =A0obj-$(CONFIG_CMD_EXEC) =A0 =A0 =A0 =A0 +=3D exec.o > =A0obj-$(CONFIG_CMD_SLEEP) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0+=3D sleep.o > +obj-$(CONFIG_CMD_MSLEEP) =A0 =A0 =A0 +=3D msleep.o > =A0obj-$(CONFIG_CMD_RESET) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0+=3D reset.o > =A0obj-$(CONFIG_CMD_GO) =A0 =A0 =A0 =A0 =A0 +=3D go.o > =A0obj-$(CONFIG_NET) =A0 =A0 =A0 =A0 =A0 =A0 =A0+=3D net.o > diff --git a/commands/msleep.c b/commands/msleep.c > new file mode 100644 > index 0000000..c9fa23c > --- /dev/null > +++ b/commands/msleep.c > @@ -0,0 +1,40 @@ > +/* > + * msleep.c - delay execution for n milliseconds > + * > + * Copyright (c) 2012 Steffen Trumtrar , Peng= utronix > + * > + * derived from commands/sleep.c > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 > + * as published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. =A0See the > + * GNU General Public License for more details. > + * > + */ > + > +#include > +#include > +#include > + > +static int do_msleep(int argc, char *argv[]) > +{ > + =A0 =A0 =A0 ulong delay; > + > + =A0 =A0 =A0 if (argc !=3D 2) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return COMMAND_ERROR_USAGE; > + > + =A0 =A0 =A0 delay =3D simple_strtoul(argv[1], NULL, 10); > + > + =A0 =A0 =A0 mdelay(delay); > + > + =A0 =A0 =A0 return 0; > +} > + > +BAREBOX_CMD_START(msleep) > + =A0 =A0 =A0 .cmd =A0 =A0 =A0 =A0 =A0 =A0=3D do_msleep, > + =A0 =A0 =A0 .usage =A0 =A0 =A0 =A0 =A0=3D "delay execution for n millis= econds", > +BAREBOX_CMD_END > -- > 1.7.10 > > > _______________________________________________ > barebox mailing list > barebox@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/barebox -- = Best regards, =A0 Antony Pavlov _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox