apps/nshlib: Add irqinfo command.

This commit is contained in:
Gregory Nutt 2018-01-12 17:58:44 -06:00
parent d96c236b31
commit 661718ee19
5 changed files with 62 additions and 17 deletions

View File

@ -125,7 +125,7 @@ static int xmlrpc_getelement(struct parsebuf_s * pbuf, char *data, int dataSize)
int j = 0;
int ret = XMLRPC_NO_ERROR;
while (!isprint(pbuf->buf[pbuf->index]))
while (pbuf->index < pbuf->len && !isprint(pbuf->buf[pbuf->index]))
{
pbuf->index++;
}
@ -162,7 +162,9 @@ static int xmlrpc_getelement(struct parsebuf_s * pbuf, char *data, int dataSize)
{
data[j++] = pbuf->buf[pbuf->index++];
if (j >= dataSize)
ret = XMLRPC_PARSE_ERROR;
{
ret = XMLRPC_PARSE_ERROR;
}
}
}
@ -229,12 +231,15 @@ static int xmlrpc_parseparam(struct parsebuf_s * pbuf)
case 'b':
g_xmlcall.arguments[g_xmlcall.argsize].u.i = atoi(g_data);
break;
case 'd':
g_xmlcall.arguments[g_xmlcall.argsize].u.d = atof(g_data);
break;
case 's':
strcpy(g_xmlcall.arguments[g_xmlcall.argsize].u.string, g_data);
break;
default:
return XMLRPC_PARSE_ERROR;
}

View File

@ -590,6 +590,18 @@ o insmod <file-path> <module-name>
NAME INIT UNINIT ARG TEXT SIZE DATA SIZE
mydriver 20404659 20404625 0 20404580 552 204047a8 0
o irqinfo
Show the current count of interrupts taken on all attached interrupts.
Example:
nsh> irqinfo
IRQ HANDLER ARGUMENT COUNT RATE
3 00001b3d 00000000 156 19.122
15 0000800d 00000000 817 100.000
30 00000fd5 20000018 20 2.490
o kill -<signal> <pid>
Send the <signal> to the task identified by <pid>.
@ -1325,6 +1337,7 @@ Command Dependencies on Configuration Settings
ifdown CONFIG_NET && CONFIG_FS_PROCFS && !CONFIG_FS_PROCFS_EXCLUDE_NET
ifup CONFIG_NET && CONFIG_FS_PROCFS && !CONFIG_FS_PROCFS_EXCLUDE_NET
insmod CONFIG_MODULE
irqinfo CONFIG_FS_PROCFS && CONFIG_SCHED_IRQMONITOR
kill !CONFIG_DISABLE_SIGNALS
losetup !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_DEV_LOOP
ln CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_PSEUDOFS_SOFTLINK

View File

@ -658,10 +658,16 @@
# endif
#endif
#undef HAVE_IRQINFO
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_PROCFS) && \
defined(CONFIG_SCHED_IRQMONITOR)
# define HAVE_IRQINFO 1
#endif
#undef HAVE_MOUNT_LIST
#if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_NSH_DISABLE_MOUNT) && \
!defined(CONFIG_FS_PROCFS_EXCLUDE_MOUNT)
# define HAVE_MOUNT_LIST 1
# define HAVE_MOUNT_LIST 1
#endif
#if !defined(CONFIG_FS_PROCFS) || defined(CONFIG_FS_PROCFS_EXCLUDE_MEMINFO)
@ -684,13 +690,14 @@
# undef NSH_HAVE_TRIMDIR
#endif
/* nsh_catfile used by cat, ifconfig, ifup/down, df, free, and mount (with
/* nsh_catfile used by cat, ifconfig, ifup/down, df, free, irqinfo, and mount (with
* no arguments).
*/
#if !defined(CONFIG_NSH_DISABLE_CAT) && !defined(CONFIG_NSH_DISABLE_IFCONFIG) && \
!defined(CONFIG_NSH_DISABLE_IFUPDOWN) && !defined(CONFIG_NSH_DISABLE_DF) && \
!defined(CONFIG_NSH_DISABLE_FREE) && !defined(HAVE_MOUNT_LIST)
!defined(CONFIG_NSH_DISABLE_FREE) && !defined(HAVE_IRQINFO) && \
!defined(HAVE_MOUNT_LIST)
# undef NSH_HAVE_CATFILE
#endif
@ -1044,6 +1051,10 @@ int cmd_lsmod(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#endif
#ifdef HAVE_IRQINFO
int cmd_irqinfo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#if !defined(CONFIG_NSH_DISABLESCRIPT) && !defined(CONFIG_NSH_DISABLE_TEST)
int cmd_test(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_lbracket(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);

View File

@ -192,14 +192,6 @@ static const struct cmdmap_s g_cmdmap[] =
# endif
#endif
#ifndef CONFIG_NSH_DISABLE_PRINTF
# ifndef CONFIG_DISABLE_ENVIRON
{ "printf", cmd_printf, 1, CONFIG_NSH_MAXARGUMENTS, "[\\xNN] [\\n\\r\\t] [<string|$name> [<string|$name>...]]" },
# else
{ "printf", cmd_printf, 1, CONFIG_NSH_MAXARGUMENTS, "[\\xNN] [\\n\\r\\t] [<string> [<string>...]]" },
# endif
#endif
#ifndef CONFIG_NSH_DISABLE_EXEC
{ "exec", cmd_exec, 2, 3, "<hex-address>" },
#endif
@ -245,13 +237,17 @@ static const struct cmdmap_s g_cmdmap[] =
{ "ifconfig", cmd_ifconfig, 1, 11, "[interface [<ip-address>|dhcp]] [dr|gw|gateway <dr-address>] [netmask <net-mask>] [dns <dns-address>] [hw <hw-mac>]" },
# endif
# ifndef CONFIG_NSH_DISABLE_IFUPDOWN
{ "ifdown", cmd_ifdown, 2, 2, "<interface>" },
{ "ifup", cmd_ifup, 2, 2, "<interface>" },
{ "ifdown", cmd_ifdown, 2, 2, "<interface>" },
{ "ifup", cmd_ifup, 2, 2, "<interface>" },
# endif
#endif
#if defined(CONFIG_MODULE) && !defined(CONFIG_NSH_DISABLE_MODCMDS)
{ "insmod", cmd_insmod, 3, 3, "<file-path> <module-name>" },
{ "insmod", cmd_insmod, 3, 3, "<file-path> <module-name>" },
#endif
#ifdef HAVE_IRQINFO
{ "irqinfo", cmd_irqinfo, 1, 1, NULL },
#endif
#ifndef CONFIG_DISABLE_SIGNALS
@ -385,6 +381,14 @@ static const struct cmdmap_s g_cmdmap[] =
{ "poweroff", cmd_poweroff, 1, 1, NULL },
#endif
#ifndef CONFIG_NSH_DISABLE_PRINTF
# ifndef CONFIG_DISABLE_ENVIRON
{ "printf", cmd_printf, 1, CONFIG_NSH_MAXARGUMENTS, "[\\xNN] [\\n\\r\\t] [<string|$name> [<string|$name>...]]" },
# else
{ "printf", cmd_printf, 1, CONFIG_NSH_MAXARGUMENTS, "[\\xNN] [\\n\\r\\t] [<string> [<string>...]]" },
# endif
#endif
#ifndef CONFIG_NSH_DISABLE_PS
{ "ps", cmd_ps, 1, 1, NULL },
#endif

View File

@ -1,7 +1,8 @@
/****************************************************************************
* apps/nshlib/dbg_dbgcmds.c
*
* Copyright (C) 2008-2009, 2011-2012, 2015, 2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009, 2011-2012, 2015, 2017-2018 Gregory Nutt. All
* rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -500,3 +501,14 @@ int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
}
#endif
#endif
/****************************************************************************
* Name: cmd_irqinfo
****************************************************************************/
#ifdef HAVE_IRQINFO
int cmd_irqinfo(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
{
return nsh_catfile(vtbl, argv[0], CONFIG_NSH_PROC_MOUNTPOINT "/irqs");
}
#endif