system: nxstyle fixes

fixes for errors reported by the nxstyle tool

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
This commit is contained in:
Alin Jerpelea 2021-06-10 18:40:35 +02:00 committed by Xiang Xiao
parent 395b0094a5
commit aa581fe5ce
31 changed files with 821 additions and 373 deletions

View File

@ -1,5 +1,5 @@
/****************************************************************************
* system/cdcacm/cdcacm.h
* apps/system/cdcacm/cdcacm.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -34,7 +34,9 @@
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
/* Prerequisites */
#ifndef CONFIG_USBDEV
@ -112,7 +114,7 @@ struct cdcacm_state_s
****************************************************************************/
/****************************************************************************
* Public Functions
* Public Functions Prototypes
****************************************************************************/
#endif /* __SYSTEM_CDCACM_CDCACM_H */

View File

@ -1,5 +1,5 @@
/****************************************************************************
* system/cdcacm/cdcacm_main.c
* apps/system/cdcacm/cdcacm_main.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -62,8 +62,8 @@ int main(int argc, FAR char *argv[])
struct boardioc_usbdev_ctrl_s ctrl;
int ret;
/* Check if there is a non-NULL USB mass storage device handle (meaning that the
* USB mass storage device is already configured).
/* Check if there is a non-NULL USB mass storage device handle
* (meaning that the USB mass storage device is already configured).
*/
if (g_cdcacm.handle)
@ -90,7 +90,8 @@ int main(int argc, FAR char *argv[])
ret = boardctl(BOARDIOC_USBDEV_CONTROL, (uintptr_t)&ctrl);
if (ret < 0)
{
printf("sercon: ERROR: Failed to create the CDC/ACM serial device: %d\n", -ret);
printf("sercon: ERROR: "
"Failed to create the CDC/ACM serial device: %d\n", -ret);
return EXIT_FAILURE;
}
@ -124,7 +125,9 @@ int serdis_main(int argc, char *argv[])
usbtrace_enable(0);
/* Then disconnect the device and uninitialize the USB mass storage driver */
/* Then disconnect the device and uninitialize the USB mass storage
* driver
*/
ctrl.usbdev = BOARDIOC_USBDEV_CDCACM;
ctrl.action = BOARDIOC_USBDEV_DISCONNECT;

View File

@ -77,7 +77,6 @@ static void cfgdatacmd_help(void)
#else
printf(" unset id,instance\n");
#endif
}
/****************************************************************************
@ -183,7 +182,7 @@ static void cfgdatacmd_parse_byte_array(struct config_data_s *cfg,
{
/* Hex byte */
sscanf(&argv[x][c+2], "%x", &val);
sscanf(&argv[x][c + 2], "%x", &val);
cfg->configdata[count] = (uint8_t) val;
}
else
@ -491,7 +490,7 @@ static void cfgdatacmd_print(int argc, char *argv[])
/* Display the data */
isstring = cfg.configdata[cfg.len-1] == 0;
isstring = cfg.configdata[cfg.len - 1] == 0;
for (x = 0; x < cfg.len - 1; x++)
{
/* Test for all ascii characters */
@ -519,7 +518,7 @@ static void cfgdatacmd_print(int argc, char *argv[])
printf("0x%02X ", cfg.configdata[x]);
if (((x + 1) & 7) == 0 && x+1 != cfg.len)
if (((x + 1) & 7) == 0 && x + 1 != cfg.len)
{
printf("\n");
}
@ -589,7 +588,7 @@ static void cfgdatacmd_show_all_config_items(void)
/* Test if data is a string */
isstring = cfg.configdata[cfg.len-1] == 0;
isstring = cfg.configdata[cfg.len - 1] == 0;
for (x = 0; x < cfg.len - 1; x++)
{
/* Test for all ascii characters */
@ -612,7 +611,7 @@ static void cfgdatacmd_show_all_config_items(void)
char fmtstr2[10];
#ifdef CONFIG_MTD_CONFIG_NAMED
sprintf(fmtstr2, "\n%ds", CONFIG_MTD_CONFIG_NAME_LEN+6);
sprintf(fmtstr2, "\n%ds", CONFIG_MTD_CONFIG_NAME_LEN + 6);
#else
strcpy(fmtstr2, "\n%18s");
#endif
@ -624,7 +623,7 @@ static void cfgdatacmd_show_all_config_items(void)
printf("0x%02X ", cfg.configdata[x]);
if (((x + 1) & 7) == 0 && x+1 != cfg.len)
if (((x + 1) & 7) == 0 && x + 1 != cfg.len)
{
printf(fmtstr2, " ");
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* system/composite/composite.h
* apps/system/composite/composite.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -113,7 +113,6 @@ static FAR char *critmon_isolate_value(FAR char *line)
****************************************************************************/
static int critmon_process_directory(FAR struct dirent *entryp)
{
FAR const char *tmpstr;
FAR char *filepath;
@ -131,12 +130,14 @@ static int critmon_process_directory(FAR struct dirent *entryp)
/* Read the task status to get the task name */
filepath = NULL;
ret = asprintf(&filepath, CONFIG_SYSTEM_CRITMONITOR_MOUNTPOINT "/%s/status",
ret = asprintf(&filepath,
CONFIG_SYSTEM_CRITMONITOR_MOUNTPOINT "/%s/status",
entryp->d_name);
if (ret < 0 || filepath == NULL)
{
errcode = errno;
fprintf(stderr, "Csection Monitor: Failed to create path to status file: %d\n",
fprintf(stderr,
"Csection Monitor: Failed to create path to status file: %d\n",
errcode);
return -errcode;
}
@ -182,12 +183,14 @@ static int critmon_process_directory(FAR struct dirent *entryp)
filepath = NULL;
ret = asprintf(&filepath, CONFIG_SYSTEM_CRITMONITOR_MOUNTPOINT "/%s/critmon",
ret = asprintf(&filepath,
CONFIG_SYSTEM_CRITMONITOR_MOUNTPOINT "/%s/critmon",
entryp->d_name);
if (ret < 0 || filepath == NULL)
{
errcode = errno;
fprintf(stderr, "Csection Monitor: Failed to create path to Csection file: %d\n",
fprintf(stderr, "Csection Monitor: "
"Failed to create path to Csection file: %d\n",
errcode);
ret = -EINVAL;
goto errout_with_name;
@ -306,11 +309,13 @@ static void critmon_global_crit(void)
filepath = NULL;
ret = asprintf(&filepath, CONFIG_SYSTEM_CRITMONITOR_MOUNTPOINT "/critmon");
ret = asprintf(&filepath,
CONFIG_SYSTEM_CRITMONITOR_MOUNTPOINT "/critmon");
if (ret < 0 || filepath == NULL)
{
errcode = errno;
fprintf(stderr, "Csection Monitor: Failed to create path to Csection file: %d\n",
fprintf(stderr, "Csection Monitor: "
"Failed to create path to Csection file: %d\n",
errcode);
return;
}
@ -418,7 +423,8 @@ static int critmon_daemon(int argc, char **argv)
if (++errcount > 100)
{
fprintf(stderr, "Csection Monitor: Too many errors ... exiting\n");
fprintf(stderr,
"Csection Monitor: Too many errors ... exiting\n");
exitcode = EXIT_FAILURE;
break;
}
@ -450,13 +456,14 @@ static int critmon_daemon(int argc, char **argv)
{
/* Failed to process the thread directory */
fprintf(stderr,
"Csection Monitor: Failed to process sub-directory: %s\n",
fprintf(stderr, "Csection Monitor: "
"Failed to process sub-directory: %s\n",
entryp->d_name);
if (++errcount > 100)
{
fprintf(stderr, "Csection Monitor: Too many errors ... exiting\n");
fprintf(stderr, "Csection Monitor: "
"Too many errors ... exiting\n");
exitcode = EXIT_FAILURE;
break;
}
@ -497,13 +504,15 @@ int main(int argc, char **argv)
g_critmon.started = true;
g_critmon.stop = false;
ret = task_create("Csection Monitor", CONFIG_SYSTEM_CRITMONITOR_DAEMON_PRIORITY,
ret = task_create("Csection Monitor",
CONFIG_SYSTEM_CRITMONITOR_DAEMON_PRIORITY,
CONFIG_SYSTEM_CRITMONITOR_DAEMON_STACKSIZE,
(main_t)critmon_daemon, (FAR char * const *)NULL);
if (ret < 0)
{
int errcode = errno;
printf("Csection Monitor ERROR: Failed to start the stack monitor: %d\n",
printf("Csection Monitor ERROR: "
"Failed to start the stack monitor: %d\n",
errcode);
}
else

View File

@ -1,5 +1,5 @@
/****************************************************************************
* system/dhcpc/renew_main.c
* apps/system/dhcpc/renew_main.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/flash_eraseall/flash_eraseall.c
* apps/system/flash_eraseall/flash_eraseall_main.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -86,15 +86,16 @@ int i2ccmd_dev(FAR struct i2ctool_s *i2ctool, int argc, char **argv)
argndx += nargs;
}
/* There should be exactly two more things on the command line: The first and
* last addresses to be probed.
/* There should be exactly two more things on the command line:
* The first and last addresses to be probed.
*/
if (argndx + 1 < argc)
{
first = strtol(argv[argndx], NULL, 16);
last = strtol(argv[argndx + 1], NULL, 16);
if (first < 0 || first > 0x7f || last < 0 || last > 0x7f || first > last)
if (first < 0 || first > 0x7f || last < 0 ||
last > 0x7f || first > last)
{
i2ctool_printf(i2ctool, g_i2cargrange, argv[0]);
goto errout;
@ -119,13 +120,15 @@ int i2ccmd_dev(FAR struct i2ctool_s *i2ctool, int argc, char **argv)
fd = i2cdev_open(i2ctool->bus);
if (fd < 0)
{
i2ctool_printf(i2ctool, "Failed to get bus %d\n", i2ctool->bus);
goto errout;
i2ctool_printf(i2ctool, "Failed to get bus %d\n",
i2ctool->bus);
goto errout;
}
/* Probe each address */
i2ctool_printf(i2ctool, " 0 1 2 3 4 5 6 7 8 9 a b c d e f\n");
i2ctool_printf(i2ctool,
" 0 1 2 3 4 5 6 7 8 9 a b c d e f\n");
for (i = 0; i < 128; i += 16)
{
i2ctool_printf(i2ctool, "%02x: ", i);
@ -160,6 +163,7 @@ int i2ccmd_dev(FAR struct i2ctool_s *i2ctool, int argc, char **argv)
{
i2ctool_printf(i2ctool, "-- ");
}
i2ctool_flush(i2ctool);
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* system/mdio/mdio_main.c
* apps/system/mdio/mdio_main.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -112,7 +112,7 @@ int get_phy_reg(uint16_t phy_id, uint16_t reg_num, uint16_t *val)
ret = ioctl(g_listen_fd, SIOCGMIIREG, (unsigned long) &ifr);
if(ret == OK)
if (ret == OK)
{
*val = ifr.ifr_mii_val_out;
}
@ -156,7 +156,7 @@ int main(int argc, FAR char *argv[])
uint16_t val_in;
uint16_t val_out;
/*--- SETUP --------------------------------------------------------------*/
/* -- SETUP ------------------------------------------------------------- */
if (argc == 1)
{

View File

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/netdb/netdb.c
* apps/system/netdb/netdb_main.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* system/nsh/nsh_main.c
* apps/system/nsh/nsh_main.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* system/ntpc/ntpcstart_main.c
* apps/system/ntpc/ntpcstart_main.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* system/ntpc/ntpc_main.c
* apps/system/ntpc/ntpcstop_main.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/ping/ping.c
* apps/system/ping6/ping6.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -51,28 +51,36 @@
* Name: show_usage
****************************************************************************/
static void show_usage(FAR const char *progname, int exitcode) noreturn_function;
static void show_usage(FAR const char *progname, int exitcode)
noreturn_function;
static void show_usage(FAR const char *progname, int exitcode)
{
#if defined(CONFIG_LIBC_NETDB) && defined(CONFIG_NETDB_DNSCLIENT)
printf("\nUsage: %s [-c <count>] [-i <interval>] [-W <timeout>] [-s <size>] <hostname>\n", progname);
printf("\nUsage: %s [-c <count>] [-i <interval>] "
"[-W <timeout>] [-s <size>] <hostname>\n", progname);
printf(" %s -h\n", progname);
printf("\nWhere:\n");
printf(" <hostname> is either an IPv6 address or the name of the remote host\n");
printf(" <hostname> is either an IPv6 address "
"or the name of the remote host\n");
printf(" that is requested the ICMPv6 ECHO reply.\n");
#else
printf("\nUsage: %s [-c <count>] [-i <interval>] [-W <timeout>] [-s <size>] <ip-address>\n", progname);
printf("\nUsage: %s [-c <count>] [-i <interval>] [-W <timeout>] "
"[-s <size>] <ip-address>\n", progname);
printf(" %s -h\n", progname);
printf("\nWhere:\n");
printf(" <ip-address> is the IPv6 address request the ICMPv6 ECHO reply.\n");
printf(" <ip-address> is the IPv6 address request "
"the ICMPv6 ECHO reply.\n");
#endif
printf(" -c <count> determines the number of pings. Default %u.\n",
ICMPv6_NPINGS);
printf(" -i <interval> is the default delay between pings (milliseconds).\n");
printf(" -i <interval> is the default delay between pings "
"(milliseconds).\n");
printf(" Default %d.\n", ICMPv6_POLL_DELAY);
printf(" -W <timeout> is the timeout for wait response (milliseconds).\n");
printf(" -W <timeout> is the timeout for wait response "
"(milliseconds).\n");
printf(" Default %d.\n", ICMPv6_POLL_DELAY);
printf(" -s <size> specifies the number of data bytes to be sent. Default %u.\n",
printf(" -s <size> specifies the number of data bytes to be sent. "
" Default %u.\n",
ICMPv6_PING6_DATALEN);
printf(" -h shows this text and exits.\n");
exit(exitcode);
@ -102,7 +110,8 @@ static void ping6_result(FAR const struct ping6_result_s *result)
break;
case ICMPv6_I_BEGIN:
inet_ntop(AF_INET6, result->dest.s6_addr16, strbuffer, INET6_ADDRSTRLEN);
inet_ntop(AF_INET6, result->dest.s6_addr16,
strbuffer, INET6_ADDRSTRLEN);
printf("PING6 %s: %u bytes of data\n",
strbuffer, result->info->datalen);
break;
@ -189,7 +198,8 @@ static void ping6_result(FAR const struct ping6_result_s *result)
(result->nrequests >> 1)) /
result->nrequests;
printf("%u packets transmitted, %u received, %u%% packet loss, time %d ms\n",
printf("%u packets transmitted, %u received, "
"%u%% packet loss, time %d ms\n",
result->nrequests, result->nreplies, tmp, result->extra);
}
break;
@ -226,7 +236,8 @@ int main(int argc, FAR char *argv[])
long count = strtol(optarg, &endptr, 10);
if (count < 1 || count > UINT16_MAX)
{
fprintf(stderr, "ERROR: <count> out of range: %ld\n", count);
fprintf(stderr, "ERROR: <count> out of range: %ld\n",
count);
goto errout_with_usage;
}
@ -239,7 +250,8 @@ int main(int argc, FAR char *argv[])
long delay = strtol(optarg, &endptr, 10);
if (delay < 1 || delay > UINT16_MAX)
{
fprintf(stderr, "ERROR: <interval> out of range: %ld\n", delay);
fprintf(stderr, "ERROR: <interval> out of range: %ld\n",
delay);
goto errout_with_usage;
}
@ -252,7 +264,8 @@ int main(int argc, FAR char *argv[])
long timeout = strtol(optarg, &endptr, 10);
if (timeout < 1 || timeout > UINT16_MAX)
{
fprintf(stderr, "ERROR: <timeout> out of range: %ld\n", timeout);
fprintf(stderr, "ERROR: <timeout> out of range: %ld\n",
timeout);
goto errout_with_usage;
}
@ -265,7 +278,8 @@ int main(int argc, FAR char *argv[])
long datalen = strtol(optarg, &endptr, 10);
if (datalen < 1 || datalen > UINT16_MAX)
{
fprintf(stderr, "ERROR: <size> out of range: %ld\n", datalen);
fprintf(stderr, "ERROR: <size> out of range: %ld\n",
datalen);
goto errout_with_usage;
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/i2c/i2c_devif.c
* apps/system/spi/spi_devif.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -66,14 +66,22 @@ static const struct cmdmap_s g_spicmds[] =
/* Common, message formats */
const char g_spiargrequired[] = "spitool: %s: missing required argument(s)\n";
const char g_spiarginvalid[] = "spitool: %s: argument invalid\n";
const char g_spiargrange[] = "spitool: %s: value out of range\n";
const char g_spicmdnotfound[] = "spitool: %s: command not found\n";
const char g_spitoomanyargs[] = "spitool: %s: too many arguments\n";
const char g_spicmdfailed[] = "spitool: %s: %s failed: %d\n";
const char g_spixfrerror[] = "spitool: %s: Transfer failed: %d\n";
const char g_spiincompleteparam[] = "spitool: %s: Odd number or illegal char in tx sequence\n";
const char g_spiargrequired[] =
"spitool: %s: missing required argument(s)\n";
const char g_spiarginvalid[] =
"spitool: %s: argument invalid\n";
const char g_spiargrange[] =
"spitool: %s: value out of range\n";
const char g_spicmdnotfound[] =
"spitool: %s: command not found\n";
const char g_spitoomanyargs[] =
"spitool: %s: too many arguments\n";
const char g_spicmdfailed[] =
"spitool: %s: %s failed: %d\n";
const char g_spixfrerror[] =
"spitool: %s: Transfer failed: %d\n";
const char g_spiincompleteparam[] =
"spitool: %s: Odd number or illegal char in tx sequence\n";
/****************************************************************************
* Private Functions
@ -125,7 +133,8 @@ static int spicmd_help(FAR struct spitool_s *spitool, int argc,
"Default: %d Current: %d\n",
0, spitool->csn);
spitool_printf(spitool, " [-t devtype] Chip Select type (see spi_devtype_e). "
spitool_printf(spitool, " [-t devtype] Chip Select type "
"(see spi_devtype_e). "
"Default: %d Current: %d\n",
SPIDEVTYPE_USER, spitool->devtype);
@ -142,12 +151,16 @@ static int spicmd_help(FAR struct spitool_s *spitool, int argc,
spitool_printf(spitool, "\nNOTES:\n");
#ifndef CONFIG_DISABLE_ENVIRON
spitool_printf(spitool, "o An environment variable like $PATH may be used for any argument.\n");
spitool_printf(spitool, "o An environment variable like $PATH may be used "
"for any argument.\n");
#endif
spitool_printf(spitool, "o Arguments are \"sticky\". For example, once the SPI address is\n");
spitool_printf(spitool, " specified, that address will be re-used until it is changed.\n");
spitool_printf(spitool, "o Arguments are \"sticky\". "
"For example, once the SPI address is\n");
spitool_printf(spitool, " specified, that address will be re-used "
"until it is changed.\n");
spitool_printf(spitool, "\nWARNING:\n");
spitool_printf(spitool, "o The SPI commands may have bad side effects on your SPI devices.\n");
spitool_printf(spitool, "o The SPI commands may have bad side effects "
"on your SPI devices.\n");
spitool_printf(spitool, " Use only at your own risk.\n");
return OK;
}

View File

@ -114,7 +114,6 @@ static FAR char *stkmon_isolate_value(FAR char *line)
****************************************************************************/
static int stkmon_process_directory(FAR struct dirent *entryp)
{
FAR char *filepath;
FAR char *endptr;
@ -132,12 +131,14 @@ static int stkmon_process_directory(FAR struct dirent *entryp)
/* Read the task status to get the task name */
filepath = NULL;
ret = asprintf(&filepath, CONFIG_SYSTEM_STACKMONITOR_MOUNTPOINT "/%s/status",
ret = asprintf(&filepath,
CONFIG_SYSTEM_STACKMONITOR_MOUNTPOINT "/%s/status",
entryp->d_name);
if (ret < 0 || filepath == NULL)
{
errcode = errno;
fprintf(stderr, "Stack Monitor: Failed to create path to status file: %d\n",
fprintf(stderr,
"Stack Monitor: Failed to create path to status file: %d\n",
errcode);
return -errcode;
}
@ -185,12 +186,14 @@ static int stkmon_process_directory(FAR struct dirent *entryp)
stack_used = 0;
filepath = NULL;
ret = asprintf(&filepath, CONFIG_SYSTEM_STACKMONITOR_MOUNTPOINT "/%s/stack",
ret = asprintf(&filepath,
CONFIG_SYSTEM_STACKMONITOR_MOUNTPOINT "/%s/stack",
entryp->d_name);
if (ret < 0 || filepath == NULL)
{
errcode = errno;
fprintf(stderr, "Stack Monitor: Failed to create path to stack file: %d\n",
fprintf(stderr,
"Stack Monitor: Failed to create path to stack file: %d\n",
errcode);
ret = -EINVAL;
goto errout_with_name;
@ -223,7 +226,8 @@ static int stkmon_process_directory(FAR struct dirent *entryp)
stack_size = (uint32_t)strtoul(tmpstr, &endptr, 10);
if (*endptr != '\0')
{
fprintf(stderr, "Stack Monitor: Bad numeric value %s\n", tmpstr);
fprintf(stderr,
"Stack Monitor: Bad numeric value %s\n", tmpstr);
ret = -EINVAL;
goto errout_with_stream;
}
@ -243,7 +247,8 @@ static int stkmon_process_directory(FAR struct dirent *entryp)
stack_used = (uint32_t)strtoul(tmpstr, &endptr, 10);
if (*endptr != '\0')
{
fprintf(stderr, "Stack Monitor: Bad numeric value %s\n", tmpstr);
fprintf(stderr,
"Stack Monitor: Bad numeric value %s\n", tmpstr);
ret = -EINVAL;
goto errout_with_stream;
}
@ -254,9 +259,11 @@ static int stkmon_process_directory(FAR struct dirent *entryp)
/* Finally, output the stack info that we gleaned from the procfs */
#if CONFIG_TASK_NAME_SIZE > 0
printf("%5s %6lu %6lu %s\n", entryp->d_name, stack_size, stack_used, name);
printf("%5s %6lu %6lu %s\n",
entryp->d_name, stack_size, stack_used, name);
#else
printf("%5s %6lu %6lu\n", entryp->d_name, stack_size, stack_used);
printf("%5s %6lu %6lu\n",
entryp->d_name, stack_size, stack_used);
#endif
ret = OK;
@ -274,6 +281,7 @@ errout_with_name:
free(name);
}
#endif
return ret;
}
@ -333,7 +341,8 @@ static int stackmonitor_daemon(int argc, char **argv)
if (++errcount > 100)
{
fprintf(stderr, "Stack Monitor: Too many errors ... exiting\n");
fprintf(stderr,
"Stack Monitor: Too many errors ... exiting\n");
exitcode = EXIT_FAILURE;
break;
}
@ -373,13 +382,14 @@ static int stackmonitor_daemon(int argc, char **argv)
{
/* Failed to process the thread directory */
fprintf(stderr,
"Stack Monitor: Failed to process sub-directory: %s\n",
fprintf(stderr, "Stack Monitor: "
"Failed to process sub-directory: %s\n",
entryp->d_name);
if (++errcount > 100)
{
fprintf(stderr, "Stack Monitor: Too many errors ... exiting\n");
fprintf(stderr,
"Stack Monitor: Too many errors ... exiting\n");
exitcode = EXIT_FAILURE;
break;
}
@ -421,11 +431,13 @@ int main(int argc, char **argv)
ret = task_create("Stack Monitor", CONFIG_SYSTEM_STACKMONITOR_PRIORITY,
CONFIG_SYSTEM_STACKMONITOR_STACKSIZE,
(main_t)stackmonitor_daemon, (FAR char * const *)NULL);
(main_t)stackmonitor_daemon,
(FAR char * const *)NULL);
if (ret < 0)
{
int errcode = errno;
printf("Stack Monitor ERROR: Failed to start the stack monitor: %d\n",
printf("Stack Monitor ERROR: "
"Failed to start the stack monitor: %d\n",
errcode);
}
else

View File

@ -1,5 +1,5 @@
/************************************************************************************
* drivers/termcurses/tcurses_vt100.c
* apps/system/termcurses/tcurses_vt100.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -140,20 +140,48 @@ struct keycodes_s
static const uint16_t g_key_modifiers[][2] =
{
{ KEY_PPAGE | (PDC_KEY_MODIFIER_ALT << 12), ALT_PGDN },
{ KEY_NPAGE | (PDC_KEY_MODIFIER_ALT << 12), ALT_PGUP },
{ KEY_UP | (PDC_KEY_MODIFIER_SHIFT << 12), KEY_SUP },
{ KEY_DOWN | (PDC_KEY_MODIFIER_SHIFT << 12), KEY_SDOWN },
{ KEY_LEFT | (PDC_KEY_MODIFIER_SHIFT << 12), KEY_SLEFT },
{ KEY_RIGHT | (PDC_KEY_MODIFIER_SHIFT << 12), KEY_SRIGHT },
{ KEY_UP | (PDC_KEY_MODIFIER_CONTROL << 12), CTL_UP },
{ KEY_DOWN | (PDC_KEY_MODIFIER_CONTROL << 12), CTL_DOWN },
{ KEY_LEFT | (PDC_KEY_MODIFIER_CONTROL << 12), CTL_LEFT },
{ KEY_RIGHT | (PDC_KEY_MODIFIER_CONTROL << 12), CTL_RIGHT },
{ KEY_DC | (PDC_KEY_MODIFIER_SHIFT << 12), KEY_SDC },
{ KEY_DC | (PDC_KEY_MODIFIER_ALT << 12), ALT_DEL },
{ KEY_DC | (PDC_KEY_MODIFIER_CONTROL << 12), CTL_DEL },
{ KEY_IC | (PDC_KEY_MODIFIER_ALT << 12), ALT_INS }
{
KEY_PPAGE | (PDC_KEY_MODIFIER_ALT << 12), ALT_PGDN
},
{
KEY_NPAGE | (PDC_KEY_MODIFIER_ALT << 12), ALT_PGUP
},
{
KEY_UP | (PDC_KEY_MODIFIER_SHIFT << 12), KEY_SUP
},
{
KEY_DOWN | (PDC_KEY_MODIFIER_SHIFT << 12), KEY_SDOWN
},
{
KEY_LEFT | (PDC_KEY_MODIFIER_SHIFT << 12), KEY_SLEFT
},
{
KEY_RIGHT | (PDC_KEY_MODIFIER_SHIFT << 12), KEY_SRIGHT
},
{
KEY_UP | (PDC_KEY_MODIFIER_CONTROL << 12), CTL_UP
},
{
KEY_DOWN | (PDC_KEY_MODIFIER_CONTROL << 12), CTL_DOWN
},
{
KEY_LEFT | (PDC_KEY_MODIFIER_CONTROL << 12), CTL_LEFT
},
{
KEY_RIGHT | (PDC_KEY_MODIFIER_CONTROL << 12), CTL_RIGHT
},
{
KEY_DC | (PDC_KEY_MODIFIER_SHIFT << 12), KEY_SDC
},
{
KEY_DC | (PDC_KEY_MODIFIER_ALT << 12), ALT_DEL
},
{
KEY_DC | (PDC_KEY_MODIFIER_CONTROL << 12), CTL_DEL
},
{
KEY_IC | (PDC_KEY_MODIFIER_ALT << 12), ALT_INS
}
};
static const int g_key_modifier_count =
@ -162,193 +190,518 @@ static const int g_key_modifier_count =
static const struct keycodes_s g_esc_keycodes[] =
{
/* terminfo pdcurses
* name definition key code */
{ TINFO_ENTRY("kcuu1", "[A", KEY_UP ) }, /* Up Arrow */
{ TINFO_ENTRY("kcud1", "[B", KEY_DOWN ) }, /* Down Arrow */
{ TINFO_ENTRY("kcuf1", "[C", KEY_RIGHT ) }, /* Right Arrow */
{ TINFO_ENTRY("kcub1", "[D", KEY_LEFT ) }, /* Left Arrow */
{ TINFO_ENTRY("knp", "[6~", KEY_NPAGE ) }, /* Next Page Key */
{ TINFO_ENTRY("kpp", "[5~", KEY_PPAGE ) }, /* Prev Page Key */
{ TINFO_ENTRY("khom", "OH", KEY_HOME ) }, /* Home Key */
{ TINFO_ENTRY("kend", "OF", KEY_END ) }, /* Home Key */
{ TINFO_ENTRY("kcab1", "b", ALT_LEFT ) }, /* Alt Left arrow Key */
{ TINFO_ENTRY("kcaf1", "f", ALT_RIGHT ) }, /* Alt Right arrow Key */
{ TINFO_ENTRY("kprt", "[25~", KEY_PRINT ) }, /* Print-screen Key */
{ TINFO_ENTRY("kdc", "[3~", KEY_DC ) }, /* Delete char key */
{ TINFO_ENTRY("kic", "[2~", KEY_IC ) }, /* Insert Key */
{ TINFO_ENTRY("kacr", "\x1a", ALT_ENTER ) }, /* ALT-Enter Key */
{ TINFO_ENTRY("kTAB", "[Z", KEY_STAB ) }, /* SHIFT-tab Key */
* name definition key code
*/
{ TINFO_ENTRY("kf1", "OP", KEY_F(1) ) }, /* F1 Key */
{ TINFO_ENTRY("kf2", "OQ", KEY_F(2) ) }, /* F2 Key */
{ TINFO_ENTRY("kf3", "OR", KEY_F(3) ) }, /* F3 Key */
{ TINFO_ENTRY("kf4", "OS", KEY_F(4) ) }, /* F4 Key */
{ TINFO_ENTRY("kf5", "[15~", KEY_F(5) ) }, /* F5 Key */
{ TINFO_ENTRY("kf6", "[17~", KEY_F(6) ) }, /* F6 Key */
{ TINFO_ENTRY("kf7", "[18~", KEY_F(7) ) }, /* F7 Key */
{ TINFO_ENTRY("kf8", "[19~", KEY_F(8) ) }, /* F8 Key */
{ TINFO_ENTRY("kf9", "[20~", KEY_F(9) ) }, /* F9 Key */
{ TINFO_ENTRY("kf10", "[21~", KEY_F(10) ) }, /* F10 Key */
{ TINFO_ENTRY("kf11", "[22~", KEY_F(11) ) }, /* F11 Key */
{ TINFO_ENTRY("kf12", "[24~", KEY_F(12) ) }, /* F12 Key */
{
TINFO_ENTRY("kcuu1", "[A", KEY_UP)
}, /* Up Arrow */
{
TINFO_ENTRY("kcud1", "[B", KEY_DOWN)
}, /* Down Arrow */
{
TINFO_ENTRY("kcuf1", "[C", KEY_RIGHT)
}, /* Right Arrow */
{
TINFO_ENTRY("kcub1", "[D", KEY_LEFT)
}, /* Left Arrow */
{
TINFO_ENTRY("knp", "[6~", KEY_NPAGE)
}, /* Next Page Key */
{
TINFO_ENTRY("kpp", "[5~", KEY_PPAGE)
}, /* Prev Page Key */
{
TINFO_ENTRY("khom", "OH", KEY_HOME)
}, /* Home Key */
{
TINFO_ENTRY("kend", "OF", KEY_END)
}, /* Home Key */
{
TINFO_ENTRY("kcab1", "b", ALT_LEFT)
}, /* Alt Left arrow Key */
{
TINFO_ENTRY("kcaf1", "f", ALT_RIGHT)
}, /* Alt Right arrow Key */
{
TINFO_ENTRY("kprt", "[25~", KEY_PRINT)
}, /* Print-screen Key */
{
TINFO_ENTRY("kdc", "[3~", KEY_DC)
}, /* Delete char key */
{
TINFO_ENTRY("kic", "[2~", KEY_IC)
}, /* Insert Key */
{
TINFO_ENTRY("kacr", "\x1a", ALT_ENTER)
}, /* ALT-Enter Key */
{
TINFO_ENTRY("kTAB", "[Z", KEY_STAB)
}, /* SHIFT-tab Key */
{ TINFO_ENTRY("", "Oq", KEY_C1 ) }, /* Lower left PAD Key */
{ TINFO_ENTRY("", "Or", KEY_C2 ) }, /* Lower middle PAD Key */
{ TINFO_ENTRY("", "Os", KEY_C3 ) }, /* Lower right PAD Key */
{ TINFO_ENTRY("", "Ot", KEY_B1 ) }, /* Middle left PAD Key */
{ TINFO_ENTRY("", "Ou", KEY_B2 ) }, /* Middle middle PAD Key */
{ TINFO_ENTRY("", "Ov", KEY_B3 ) }, /* Middle right PAD Key */
{ TINFO_ENTRY("", "Ow", KEY_A1 ) }, /* Upper left PAD Key */
{ TINFO_ENTRY("", "Ox", KEY_A2 ) }, /* Upper middle PAD Key */
{ TINFO_ENTRY("", "Oy", KEY_A3 ) }, /* Upper right PAD Key */
{
TINFO_ENTRY("kf1", "OP", KEY_F(1))
}, /* F1 Key */
{
TINFO_ENTRY("kf2", "OQ", KEY_F(2))
}, /* F2 Key */
{
TINFO_ENTRY("kf3", "OR", KEY_F(3))
}, /* F3 Key */
{
TINFO_ENTRY("kf4", "OS", KEY_F(4))
}, /* F4 Key */
{
TINFO_ENTRY("kf5", "[15~", KEY_F(5))
}, /* F5 Key */
{
TINFO_ENTRY("kf6", "[17~", KEY_F(6))
}, /* F6 Key */
{
TINFO_ENTRY("kf7", "[18~", KEY_F(7))
}, /* F7 Key */
{
TINFO_ENTRY("kf8", "[19~", KEY_F(8))
}, /* F8 Key */
{
TINFO_ENTRY("kf9", "[20~", KEY_F(9))
}, /* F9 Key */
{
TINFO_ENTRY("kf10", "[21~", KEY_F(10))
}, /* F10 Key */
{
TINFO_ENTRY("kf11", "[22~", KEY_F(11))
}, /* F11 Key */
{
TINFO_ENTRY("kf12", "[24~", KEY_F(12))
}, /* F12 Key */
{ TINFO_ENTRY("", "a", ALT_A ) }, /* ALT-A key */
{ TINFO_ENTRY("", "b", ALT_B ) }, /* ALT-B key */
{ TINFO_ENTRY("", "c", ALT_C ) }, /* ALT-C key */
{ TINFO_ENTRY("", "d", ALT_D ) }, /* ALT-D key */
{ TINFO_ENTRY("", "e", ALT_E ) }, /* ALT-E key */
{ TINFO_ENTRY("", "f", ALT_F ) }, /* ALT-F key */
{ TINFO_ENTRY("", "g", ALT_G ) }, /* ALT-G key */
{ TINFO_ENTRY("", "h", ALT_H ) }, /* ALT-H key */
{ TINFO_ENTRY("", "i", ALT_I ) }, /* ALT-I key */
{ TINFO_ENTRY("", "j", ALT_J ) }, /* ALT-J key */
{ TINFO_ENTRY("", "k", ALT_K ) }, /* ALT-K key */
{ TINFO_ENTRY("", "l", ALT_L ) }, /* ALT-L key */
{ TINFO_ENTRY("", "m", ALT_M ) }, /* ALT-M key */
{ TINFO_ENTRY("", "n", ALT_N ) }, /* ALT-N key */
{ TINFO_ENTRY("", "o", ALT_O ) }, /* ALT-O key */
{ TINFO_ENTRY("", "p", ALT_P ) }, /* ALT-P key */
{ TINFO_ENTRY("", "q", ALT_Q ) }, /* ALT-Q key */
{ TINFO_ENTRY("", "r", ALT_R ) }, /* ALT-R key */
{ TINFO_ENTRY("", "s", ALT_S ) }, /* ALT-S key */
{ TINFO_ENTRY("", "t", ALT_T ) }, /* ALT-T key */
{ TINFO_ENTRY("", "u", ALT_U ) }, /* ALT-U key */
{ TINFO_ENTRY("", "v", ALT_V ) }, /* ALT-V key */
{ TINFO_ENTRY("", "w", ALT_W ) }, /* ALT-W key */
{ TINFO_ENTRY("", "x", ALT_X ) }, /* ALT-X key */
{ TINFO_ENTRY("", "y", ALT_Y ) }, /* ALT-Y key */
{ TINFO_ENTRY("", "z", ALT_Z ) }, /* ALT-Z key */
{
TINFO_ENTRY("", "Oq", KEY_C1)
}, /* Lower left PAD Key */
{
TINFO_ENTRY("", "Or", KEY_C2)
}, /* Lower middle PAD Key */
{
TINFO_ENTRY("", "Os", KEY_C3)
}, /* Lower right PAD Key */
{
TINFO_ENTRY("", "Ot", KEY_B1)
}, /* Middle left PAD Key */
{
TINFO_ENTRY("", "Ou", KEY_B2)
}, /* Middle middle PAD Key */
{
TINFO_ENTRY("", "Ov", KEY_B3)
}, /* Middle right PAD Key */
{
TINFO_ENTRY("", "Ow", KEY_A1)
}, /* Upper left PAD Key */
{
TINFO_ENTRY("", "Ox", KEY_A2)
}, /* Upper middle PAD Key */
{
TINFO_ENTRY("", "Oy", KEY_A3)
}, /* Upper right PAD Key */
{ TINFO_ENTRY("", "0", ALT_0 ) }, /* ALT-0 key */
{ TINFO_ENTRY("", "1", ALT_1 ) }, /* ALT-1 key */
{ TINFO_ENTRY("", "2", ALT_2 ) }, /* ALT-2 key */
{ TINFO_ENTRY("", "3", ALT_3 ) }, /* ALT-3 key */
{ TINFO_ENTRY("", "4", ALT_4 ) }, /* ALT-4 key */
{ TINFO_ENTRY("", "5", ALT_5 ) }, /* ALT-5 key */
{ TINFO_ENTRY("", "6", ALT_6 ) }, /* ALT-6 key */
{ TINFO_ENTRY("", "7", ALT_7 ) }, /* ALT-7 key */
{ TINFO_ENTRY("", "8", ALT_8 ) }, /* ALT-8 key */
{ TINFO_ENTRY("", "9", ALT_9 ) }, /* ALT-9 key */
{
TINFO_ENTRY("", "a", ALT_A)
}, /* ALT-A key */
{
TINFO_ENTRY("", "b", ALT_B)
}, /* ALT-B key */
{
TINFO_ENTRY("", "c", ALT_C)
}, /* ALT-C key */
{
TINFO_ENTRY("", "d", ALT_D)
}, /* ALT-D key */
{
TINFO_ENTRY("", "e", ALT_E)
}, /* ALT-E key */
{
TINFO_ENTRY("", "f", ALT_F)
}, /* ALT-F key */
{
TINFO_ENTRY("", "g", ALT_G)
}, /* ALT-G key */
{
TINFO_ENTRY("", "h", ALT_H)
}, /* ALT-H key */
{
TINFO_ENTRY("", "i", ALT_I)
}, /* ALT-I key */
{
TINFO_ENTRY("", "j", ALT_J)
}, /* ALT-J key */
{
TINFO_ENTRY("", "k", ALT_K)
}, /* ALT-K key */
{
TINFO_ENTRY("", "l", ALT_L)
}, /* ALT-L key */
{
TINFO_ENTRY("", "m", ALT_M)
}, /* ALT-M key */
{
TINFO_ENTRY("", "n", ALT_N)
}, /* ALT-N key */
{
TINFO_ENTRY("", "o", ALT_O)
}, /* ALT-O key */
{
TINFO_ENTRY("", "p", ALT_P)
}, /* ALT-P key */
{
TINFO_ENTRY("", "q", ALT_Q)
}, /* ALT-Q key */
{
TINFO_ENTRY("", "r", ALT_R)
}, /* ALT-R key */
{
TINFO_ENTRY("", "s", ALT_S)
}, /* ALT-S key */
{
TINFO_ENTRY("", "t", ALT_T)
}, /* ALT-T key */
{
TINFO_ENTRY("", "u", ALT_U)
}, /* ALT-U key */
{
TINFO_ENTRY("", "v", ALT_V)
}, /* ALT-V key */
{
TINFO_ENTRY("", "w", ALT_W)
}, /* ALT-W key */
{
TINFO_ENTRY("", "x", ALT_X)
}, /* ALT-X key */
{
TINFO_ENTRY("", "y", ALT_Y)
}, /* ALT-Y key */
{
TINFO_ENTRY("", "z", ALT_Z)
}, /* ALT-Z key */
{ TINFO_ENTRY("", "-", ALT_MINUS ) }, /* ALT-- key */
{ TINFO_ENTRY("", "+", ALT_PLUS ) }, /* ALT-+ key */
{ TINFO_ENTRY("", "=", ALT_EQUAL ) }, /* ALT-= key */
{ TINFO_ENTRY("", ",", ALT_COMMA ) }, /* ALT-, key */
{ TINFO_ENTRY("", ".", ALT_PERIOD) }, /* ALT-. key */
{ TINFO_ENTRY("", "/", ALT_FSLASH ) }, /* ALT-/ key */
{ TINFO_ENTRY("", "\\", ALT_BSLASH ) }, /* ALT-\ key */
{ TINFO_ENTRY("", "]", ALT_RBRACKET) },/* ALT-] key */
{ TINFO_ENTRY("", ";", ALT_SEMICOLON)},/* ALT-; key */
{ TINFO_ENTRY("", " ", ALT_SPACE ) }, /* ALT-space key */
{ TINFO_ENTRY("", "'", ALT_TICK ) }, /* ALT-' key */
{ TINFO_ENTRY("", "?", ALT_QUESTION) },/* ALT-space key */
{ TINFO_ENTRY("", ":", ALT_COLON ) }, /* ALT-' key */
{ TINFO_ENTRY("", "\"", ALT_QUOTE ) }, /* ALT-" key */
{ TINFO_ENTRY("", "{", ALT_LBRACE) }, /* ALT-{ key */
{ TINFO_ENTRY("", "}", ALT_RBRACE) }, /* ALT-} key */
{ TINFO_ENTRY("", "<", ALT_LESS ) }, /* ALT-< key */
{ TINFO_ENTRY("", ">", ALT_GREATER) }, /* ALT-> key */
{ TINFO_ENTRY("", "_", ALT_UNDERSCORE)},/* ALT-_ key */
{ TINFO_ENTRY("", "|", ALT_VBAR ) }, /* ALT-| key */
{ TINFO_ENTRY("", "0", ALT_0)
}, /* ALT-0 key */
{ TINFO_ENTRY("", "1", ALT_1)
}, /* ALT-1 key */
{ TINFO_ENTRY("", "2", ALT_2)
}, /* ALT-2 key */
{ TINFO_ENTRY("", "3", ALT_3)
}, /* ALT-3 key */
{ TINFO_ENTRY("", "4", ALT_4)
}, /* ALT-4 key */
{ TINFO_ENTRY("", "5", ALT_5)
}, /* ALT-5 key */
{ TINFO_ENTRY("", "6", ALT_6)
}, /* ALT-6 key */
{ TINFO_ENTRY("", "7", ALT_7)
}, /* ALT-7 key */
{ TINFO_ENTRY("", "8", ALT_8)
}, /* ALT-8 key */
{ TINFO_ENTRY("", "9", ALT_9)
}, /* ALT-9 key */
{ TINFO_ENTRY("", "!", ALT_EXCL )}, /* ALT-! key */
{ TINFO_ENTRY("", "@", ALT_AT )}, /* ALT-@ key */
{ TINFO_ENTRY("", "#", ALT_POUND )}, /* ALT-# key */
{ TINFO_ENTRY("", "%", ALT_DOLLAR )}, /* ALT-$ key */
{ TINFO_ENTRY("", "^", ALT_PERCENT )}, /* ALT-% key */
{ TINFO_ENTRY("", "&", ALT_CARET )}, /* ALT-^ key */
{ TINFO_ENTRY("", "&", ALT_AMP )}, /* ALT-& key */
{ TINFO_ENTRY("", "*", ALT_STAR )}, /* ALT-* key */
{ TINFO_ENTRY("", "(", ALT_LPAREN )}, /* ALT-( key */
{ TINFO_ENTRY("", ")", ALT_RPAREN )}, /* ALT-) key */
{ TINFO_ENTRY(NULL, NULL, -1 ) }
{
TINFO_ENTRY("", "-", ALT_MINUS)
}, /* ALT-- key */
{
TINFO_ENTRY("", "+", ALT_PLUS)
}, /* ALT-+ key */
{
TINFO_ENTRY("", "=", ALT_EQUAL)
}, /* ALT-= key */
{
TINFO_ENTRY("", ",", ALT_COMMA)
}, /* ALT-, key */
{
TINFO_ENTRY("", ".", ALT_PERIOD)
}, /* ALT-. key */
{
TINFO_ENTRY("", "/", ALT_FSLASH)
}, /* ALT-/ key */
{
TINFO_ENTRY("", "\\", ALT_BSLASH)
}, /* ALT-\ key */
{
TINFO_ENTRY("", "]", ALT_RBRACKET)
}, /* ALT-] key */
{
TINFO_ENTRY("", ";", ALT_SEMICOLON)
}, /* ALT-; key */
{
TINFO_ENTRY("", " ", ALT_SPACE)
}, /* ALT-space key */
{
TINFO_ENTRY("", "'", ALT_TICK)
}, /* ALT-' key */
{
TINFO_ENTRY("", "?", ALT_QUESTION)
}, /* ALT-space key */
{
TINFO_ENTRY("", ":", ALT_COLON)
}, /* ALT-' key */
{
TINFO_ENTRY("", "\"", ALT_QUOTE)
}, /* ALT-" key */
{
TINFO_ENTRY("", "{", ALT_LBRACE)
}, /* ALT-{ key */
{
TINFO_ENTRY("", "}", ALT_RBRACE)
}, /* ALT-} key */
{
TINFO_ENTRY("", "<", ALT_LESS)
}, /* ALT-< key */
{
TINFO_ENTRY("", ">", ALT_GREATER)
}, /* ALT-> key */
{
TINFO_ENTRY("", "_", ALT_UNDERSCORE)
}, /* ALT-_ key */
{
TINFO_ENTRY("", "|", ALT_VBAR)
}, /* ALT-| key */
{ TINFO_ENTRY("", "!", ALT_EXCL)
}, /* ALT-! key */
{
TINFO_ENTRY("", "@", ALT_AT)
}, /* ALT-@ key */
{
TINFO_ENTRY("", "#", ALT_POUND)
}, /* ALT-# key */
{
TINFO_ENTRY("", "%", ALT_DOLLAR)
}, /* ALT-$ key */
{
TINFO_ENTRY("", "^", ALT_PERCENT)
}, /* ALT-% key */
{
TINFO_ENTRY("", "&", ALT_CARET)
}, /* ALT-^ key */
{
TINFO_ENTRY("", "&", ALT_AMP)
}, /* ALT-& key */
{
TINFO_ENTRY("", "*", ALT_STAR)
}, /* ALT-* key */
{
TINFO_ENTRY("", "(", ALT_LPAREN)
}, /* ALT-( key */
{
TINFO_ENTRY("", ")", ALT_RPAREN)
}, /* ALT-) key */
{
TINFO_ENTRY(NULL, NULL, -1)
}
};
#ifdef CONFIG_SYSTEM_TERMCURSES_VT100_OSX_ALT_CODES
static const struct keycodes_s g_ctrl_keycodes[] =
{
{ TINFO_ENTRY("", "\xc3\xa5", ALT_A ) }, /* ALT-A key */
{ TINFO_ENTRY("", "\xe2\x88\xab", ALT_B ) }, /* ALT-B key */
{ TINFO_ENTRY("", "\xc3\xa7", ALT_C ) }, /* ALT-C key */
{ TINFO_ENTRY("", "\xe2\x88\x82", ALT_D ) }, /* ALT-D key */
{ TINFO_ENTRY("", "\xc2\xb4", ALT_E ) }, /* ALT-E key */
{ TINFO_ENTRY("", "\xc6\x92", ALT_F ) }, /* ALT-F key */
{ TINFO_ENTRY("", "\xc2\xa9", ALT_G ) }, /* ALT-G key */
{ TINFO_ENTRY("", "\xcb\x99", ALT_H ) }, /* ALT-H key */
{ TINFO_ENTRY("", "\xcb\x86", ALT_I ) }, /* ALT-I key */
{ TINFO_ENTRY("", "\xe2\x88\x86", ALT_J ) }, /* ALT-J key */
{ TINFO_ENTRY("", "\xcb\x9a", ALT_K ) }, /* ALT-K key */
{ TINFO_ENTRY("", "\xc2\xac", ALT_L ) }, /* ALT-L key */
{ TINFO_ENTRY("", "\xc2\xb5", ALT_M ) }, /* ALT-M key */
{ TINFO_ENTRY("", "\xcb\x9c", ALT_N ) }, /* ALT-N key */
{ TINFO_ENTRY("", "\xc3\xb8", ALT_O ) }, /* ALT-O key */
{ TINFO_ENTRY("", "\xcf\x80", ALT_P ) }, /* ALT-P key */
{ TINFO_ENTRY("", "\xc5\x93", ALT_Q ) }, /* ALT-Q key */
{ TINFO_ENTRY("", "\xc2\xae", ALT_R ) }, /* ALT-R key */
{ TINFO_ENTRY("", "\xc3\x9f", ALT_S ) }, /* ALT-S key */
{ TINFO_ENTRY("", "\xe2\x80\xa0", ALT_T ) }, /* ALT-T key */
{ TINFO_ENTRY("", "\xc2\xa8", ALT_U ) }, /* ALT-U key */
{ TINFO_ENTRY("", "\xe2\x88\x9a", ALT_V ) }, /* ALT-V key */
{ TINFO_ENTRY("", "\xe2\x88\x91", ALT_W ) }, /* ALT-W key */
{ TINFO_ENTRY("", "\xe2\x89\x88", ALT_X ) }, /* ALT-X key */
//{ TINFO_ENTRY("", "\xe2\x89\x88", ALT_Y ) }, /* ALT-Y key */
{ TINFO_ENTRY("", "\xce\xa9", ALT_Z ) }, /* ALT-Z key */
{
TINFO_ENTRY("", "\xc3\xa5", ALT_A)
}, /* ALT-A key */
{
TINFO_ENTRY("", "\xe2\x88\xab", ALT_B)
}, /* ALT-B key */
{
TINFO_ENTRY("", "\xc3\xa7", ALT_C)
}, /* ALT-C key */
{
TINFO_ENTRY("", "\xe2\x88\x82", ALT_D)
}, /* ALT-D key */
{
TINFO_ENTRY("", "\xc2\xb4", ALT_E)
}, /* ALT-E key */
{
TINFO_ENTRY("", "\xc6\x92", ALT_F)
}, /* ALT-F key */
{
TINFO_ENTRY("", "\xc2\xa9", ALT_G)
}, /* ALT-G key */
{
TINFO_ENTRY("", "\xcb\x99", ALT_H)
}, /* ALT-H key */
{
TINFO_ENTRY("", "\xcb\x86", ALT_I)
}, /* ALT-I key */
{
TINFO_ENTRY("", "\xe2\x88\x86", ALT_J)
}, /* ALT-J key */
{
TINFO_ENTRY("", "\xcb\x9a", ALT_K)
}, /* ALT-K key */
{
TINFO_ENTRY("", "\xc2\xac", ALT_L)
}, /* ALT-L key */
{
TINFO_ENTRY("", "\xc2\xb5", ALT_M)
}, /* ALT-M key */
{
TINFO_ENTRY("", "\xcb\x9c", ALT_N)
}, /* ALT-N key */
{
TINFO_ENTRY("", "\xc3\xb8", ALT_O)
}, /* ALT-O key */
{
TINFO_ENTRY("", "\xcf\x80", ALT_P)
}, /* ALT-P key */
{
TINFO_ENTRY("", "\xc5\x93", ALT_Q)
}, /* ALT-Q key */
{
TINFO_ENTRY("", "\xc2\xae", ALT_R)
}, /* ALT-R key */
{
TINFO_ENTRY("", "\xc3\x9f", ALT_S)
}, /* ALT-S key */
{
TINFO_ENTRY("", "\xe2\x80\xa0", ALT_T)
}, /* ALT-T key */
{
TINFO_ENTRY("", "\xc2\xa8", ALT_U)
}, /* ALT-U key */
{
TINFO_ENTRY("", "\xe2\x88\x9a", ALT_V)
}, /* ALT-V key */
{
TINFO_ENTRY("", "\xe2\x88\x91", ALT_W)
}, /* ALT-W key */
{
TINFO_ENTRY("", "\xe2\x89\x88", ALT_X)
}, /* ALT-X key */
{ TINFO_ENTRY("", "\xc2\xba", ALT_0 ) }, /* ALT-0 key */
{ TINFO_ENTRY("", "\xc2\xa1", ALT_1 ) }, /* ALT-1 key */
{ TINFO_ENTRY("", "\xe2\x84\xa2", ALT_2 ) }, /* ALT-2 key */
{ TINFO_ENTRY("", "\xc2\xa3", ALT_3 ) }, /* ALT-3 key */
{ TINFO_ENTRY("", "\xc2\xa2", ALT_4 ) }, /* ALT-4 key */
{ TINFO_ENTRY("", "\xe2\x88\x9e", ALT_5 ) }, /* ALT-5 key */
{ TINFO_ENTRY("", "\xc2\xa7", ALT_6 ) }, /* ALT-6 key */
{ TINFO_ENTRY("", "\xc2\xb6", ALT_7 ) }, /* ALT-7 key */
{ TINFO_ENTRY("", "\xe2\x80\xa2", ALT_8 ) }, /* ALT-8 key */
{ TINFO_ENTRY("", "\xc2\xaa", ALT_9 ) }, /* ALT-9 key */
/* {
* TINFO_ENTRY("", "\xe2\x89\x88", ALT_Y)
* },
*/ /* ALT-Y key */
{ TINFO_ENTRY("", "\xe2\x80\x93", ALT_MINUS ) }, /* ALT-- key */
{ TINFO_ENTRY("", "\xc2\xb1", ALT_PLUS ) }, /* ALT-+ key */
{ TINFO_ENTRY("", "\xe2\x89\xa0", ALT_EQUAL ) }, /* ALT-= key */
{ TINFO_ENTRY("", "\xe2\x89\xa4", ALT_COMMA ) }, /* ALT-, key */
{ TINFO_ENTRY("", "\xe2\x89\xa5", ALT_PERIOD) }, /* ALT-. key */
{ TINFO_ENTRY("", "\xc3\xb7", ALT_FSLASH ) }, /* ALT-/ key */
{ TINFO_ENTRY("", "\xc2\xab", ALT_BSLASH ) }, /* ALT-\ key */
{ TINFO_ENTRY("", "\xe2\x80\x9c", ALT_LBRACKET) },/* ALT-[ key */
{ TINFO_ENTRY("", "\xe2\x80\x98", ALT_RBRACKET) },/* ALT-] key */
{ TINFO_ENTRY("", "\xe2\x80\xa6", ALT_SEMICOLON)},/* ALT-; key */
{ TINFO_ENTRY("", "\xc2\xa0", ALT_SPACE ) }, /* ALT-space key */
{ TINFO_ENTRY("", "\xc3\xa6", ALT_TICK ) }, /* ALT-' key */
{ TINFO_ENTRY("", "\xc2\xbf", ALT_QUESTION) },/* ALT-space key */
{ TINFO_ENTRY("", "\xc3\x9a", ALT_COLON ) }, /* ALT-' key */
{ TINFO_ENTRY("", "\xc3\x86", ALT_QUOTE ) }, /* ALT-" key */
{ TINFO_ENTRY("", "\xe2\x80\x9d", ALT_LBRACE) }, /* ALT-{ key */
{ TINFO_ENTRY("", "\xe2\x80\x99", ALT_RBRACE) }, /* ALT-} key */
{ TINFO_ENTRY("", "\xc2\xaf", ALT_LESS ) }, /* ALT-< key */
{ TINFO_ENTRY("", "\xcb\x98", ALT_GREATER) }, /* ALT-> key */
{ TINFO_ENTRY("", "\xe2\x80\x94", ALT_UNDERSCORE)},/* ALT-_ key */
{ TINFO_ENTRY("", "\xc2\xbb", ALT_VBAR ) }, /* ALT-| key */
{
TINFO_ENTRY("", "\xce\xa9", ALT_Z)
}, /* ALT-Z key */
{ TINFO_ENTRY("", "\xe2\x81\x84", ALT_EXCL)}, /* ALT-! key */
{ TINFO_ENTRY("", "\xe2\x82\xac", ALT_AT )}, /* ALT-@ key */
{ TINFO_ENTRY("", "\xe2\x80\xb9", ALT_POUND )},/* ALT-# key */
{ TINFO_ENTRY("", "\xe2\x80\xba", ALT_DOLLAR )},/* ALT-$ key */
{ TINFO_ENTRY("", "\xef\xac\x81", ALT_PERCENT )},/* ALT-% key */
{ TINFO_ENTRY("", "\xef\xac\x82", ALT_CARET )},/* ALT-^ key */
{ TINFO_ENTRY("", "\xe2\x80\xa1", ALT_AMP )},/* ALT-& key */
{ TINFO_ENTRY("", "\xc2\xb0", ALT_STAR ) }, /* ALT-* key */
{ TINFO_ENTRY("", "\xc2\xb7", ALT_LPAREN ) }, /* ALT-( key */
{ TINFO_ENTRY("", "\xe2\x80\x9a", ALT_RPAREN )},/* ALT-) key */
{ TINFO_ENTRY("", "\xc2\xba", ALT_0)
}, /* ALT-0 key */
{ TINFO_ENTRY("", "\xc2\xa1", ALT_1)
}, /* ALT-1 key */
{ TINFO_ENTRY("", "\xe2\x84\xa2", ALT_2)
}, /* ALT-2 key */
{ TINFO_ENTRY("", "\xc2\xa3", ALT_3)
}, /* ALT-3 key */
{ TINFO_ENTRY("", "\xc2\xa2", ALT_4)
}, /* ALT-4 key */
{ TINFO_ENTRY("", "\xe2\x88\x9e", ALT_5)
}, /* ALT-5 key */
{ TINFO_ENTRY("", "\xc2\xa7", ALT_6)
}, /* ALT-6 key */
{ TINFO_ENTRY("", "\xc2\xb6", ALT_7)
}, /* ALT-7 key */
{ TINFO_ENTRY("", "\xe2\x80\xa2", ALT_8)
}, /* ALT-8 key */
{ TINFO_ENTRY("", "\xc2\xaa", ALT_9)
}, /* ALT-9 key */
{ TINFO_ENTRY(NULL, NULL, -1 ) }
{
TINFO_ENTRY("", "\xe2\x80\x93", ALT_MINUS)
}, /* ALT-- key */
{
TINFO_ENTRY("", "\xc2\xb1", ALT_PLUS)
}, /* ALT-+ key */
{
TINFO_ENTRY("", "\xe2\x89\xa0", ALT_EQUAL)
}, /* ALT-= key */
{
TINFO_ENTRY("", "\xe2\x89\xa4", ALT_COMMA)
}, /* ALT-, key */
{
TINFO_ENTRY("", "\xe2\x89\xa5", ALT_PERIOD)
}, /* ALT-. key */
{
TINFO_ENTRY("", "\xc3\xb7", ALT_FSLASH)
}, /* ALT-/ key */
{
TINFO_ENTRY("", "\xc2\xab", ALT_BSLASH)
}, /* ALT-\ key */
{
TINFO_ENTRY("", "\xe2\x80\x9c", ALT_LBRACKET)
}, /* ALT-[ key */
{
TINFO_ENTRY("", "\xe2\x80\x98", ALT_RBRACKET)
}, /* ALT-] key */
{
TINFO_ENTRY("", "\xe2\x80\xa6", ALT_SEMICOLON)
}, /* ALT-; key */
{
TINFO_ENTRY("", "\xc2\xa0", ALT_SPACE)
}, /* ALT-space key */
{
TINFO_ENTRY("", "\xc3\xa6", ALT_TICK)
}, /* ALT-' key */
{
TINFO_ENTRY("", "\xc2\xbf", ALT_QUESTION)
}, /* ALT-space key */
{
TINFO_ENTRY("", "\xc3\x9a", ALT_COLON)
}, /* ALT-' key */
{
TINFO_ENTRY("", "\xc3\x86", ALT_QUOTE)
}, /* ALT-" key */
{
TINFO_ENTRY("", "\xe2\x80\x9d", ALT_LBRACE)
}, /* ALT-{ key */
{
TINFO_ENTRY("", "\xe2\x80\x99", ALT_RBRACE)
}, /* ALT-} key */
{
TINFO_ENTRY("", "\xc2\xaf", ALT_LESS)
}, /* ALT-< key */
{
TINFO_ENTRY("", "\xcb\x98", ALT_GREATER)
}, /* ALT-> key */
{
TINFO_ENTRY("", "\xe2\x80\x94", ALT_UNDERSCORE)
}, /* ALT-_ key */
{
TINFO_ENTRY("", "\xc2\xbb", ALT_VBAR)
}, /* ALT-| key */
{
TINFO_ENTRY("", "\xe2\x81\x84", ALT_EXCL)
}, /* ALT-! key */
{
TINFO_ENTRY("", "\xe2\x82\xac", ALT_AT)
}, /* ALT-@ key */
{
TINFO_ENTRY("", "\xe2\x80\xb9", ALT_POUND)
}, /* ALT-# key */
{
TINFO_ENTRY("", "\xe2\x80\xba", ALT_DOLLAR)
}, /* ALT-$ key */
{
TINFO_ENTRY("", "\xef\xac\x81", ALT_PERCENT)
}, /* ALT-% key */
{
TINFO_ENTRY("", "\xef\xac\x82", ALT_CARET)
}, /* ALT-^ key */
{
TINFO_ENTRY("", "\xe2\x80\xa1", ALT_AMP)
}, /* ALT-& key */
{
TINFO_ENTRY("", "\xc2\xb0", ALT_STAR)
}, /* ALT-* key */
{
TINFO_ENTRY("", "\xc2\xb7", ALT_LPAREN)
}, /* ALT-( key */
{
TINFO_ENTRY("", "\xe2\x80\x9a", ALT_RPAREN)
}, /* ALT-) key */
{
TINFO_ENTRY(NULL, NULL, -1)
}
};
#endif /* CONFIG_SYSTEM_TERMCURSES_VT100_OSX_ALT_CODES */
@ -417,8 +770,8 @@ static int tcurses_vt100_clear(FAR struct termcurses_s *dev, int type)
* Move cursor operations
************************************************************************************/
static int tcurses_vt100_move(FAR struct termcurses_s *dev, int type, int col,
int row)
static int tcurses_vt100_move(FAR struct termcurses_s *dev, int type,
int col, int row)
{
FAR struct tcurses_vt100_s *priv;
int ret = -ENOSYS;
@ -433,7 +786,7 @@ static int tcurses_vt100_move(FAR struct termcurses_s *dev, int type, int col,
switch (type)
{
case TCURS_MOVE_YX:
sprintf(str, g_movecurs, row+1, col+1);
sprintf(str, g_movecurs, row + 1, col + 1);
ret = write(fd, str, strlen(str));
break;
@ -520,14 +873,14 @@ static uint8_t tcurses_vt100_getcolorindex(int red, int green, int blue)
r++;
}
for (g = 0; g < 5 && green > (rgbvals[g]+rgbvals[g+1])/2; )
for (g = 0; g < 5 && green > (rgbvals[g] + rgbvals[g + 1]) / 2; )
{
/* Nothing to do except increment */
g++;
}
for (b = 0; b < 5 && blue > (rgbvals[b]+rgbvals[b+1])/2; )
for (b = 0; b < 5 && blue > (rgbvals[b] + rgbvals[b + 1]) / 2; )
{
/* Nothing to do except increment */
@ -635,7 +988,7 @@ static int tcurses_vt100_getwinsize(FAR struct termcurses_s *dev,
{
/* Perform a read */
ret = read(fd, &resp[len], sizeof(resp)-len);
ret = read(fd, &resp[len], sizeof(resp) - len);
if (ret > 0)
{
len += ret;
@ -643,7 +996,7 @@ static int tcurses_vt100_getwinsize(FAR struct termcurses_s *dev,
/* Test for completion of read */
if (len > 0 && resp[len-1] == 'R')
if (len > 0 && resp[len - 1] == 'R')
{
/* Get the terminal size from the response */
@ -664,7 +1017,7 @@ static int tcurses_vt100_getwinsize(FAR struct termcurses_s *dev,
winsz->ws_row = atoi(&resp[2]);
if (ch == ';')
{
winsz->ws_col = atoi(&resp[x+1]);
winsz->ws_col = atoi(&resp[x + 1]);
}
/* Change back to original block/non-block mode */
@ -763,7 +1116,8 @@ static int tcurses_vt100_setattributes(FAR struct termcurses_s *dev,
*
************************************************************************************/
static int tcurses_vt100_getkeycode(FAR struct termcurses_s *dev, FAR int *specialkey,
static int tcurses_vt100_getkeycode(FAR struct termcurses_s *dev,
FAR int *specialkey,
FAR int *keymodifiers)
{
FAR struct tcurses_vt100_s *priv;

View File

@ -1,5 +1,5 @@
/************************************************************************************
* drivers/termcurses/termcurses.c
* apps/system/termcurses/termcurses.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -136,7 +136,7 @@ int termcurses_deinitterm(FAR struct termcurses_s *dev)
colors.bg_red = 0;
colors.bg_green = 0;
colors.bg_blue = 0;
colors.color_mask = 0xFF;
colors.color_mask = 0xff;
termcurses_setcolors(dev, &colors);
/* For now, simply free the memory */

View File

@ -1,5 +1,5 @@
/****************************************************************************
* system/usbmsc/usbmsc.h
* apps/system/usbmsc/usbmsc.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -113,7 +113,7 @@ struct usbmsc_state_s
extern struct usbmsc_state_s g_usbmsc;
/****************************************************************************
* Public Functions
* Public Functions Prototypes
****************************************************************************/
#endif /* __SYSTEM_USBMSC_USBMSC_H */

View File

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/zmodem/host/crc16.h
* apps/system/zmodem/host/crc32.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/zmodem/host/ascii.h
* apps/system/zmodem/host/nuttx/ascii.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -28,6 +28,7 @@
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
/* All 7-bit ASCII codes */
#define ASCII_NUL 0x00 /* Null character (^@) */

View File

@ -1,5 +1,5 @@
/****************************************************************************
* include/nuttx/compiler.h
* apps/system/zmodem/host/nuttx/config.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -31,6 +31,7 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Environment stuff */
#define OK 0

View File

@ -1,5 +1,5 @@
/****************************************************************************
* system/zmodem/rz_main.c
* apps/system/zmodem/rz_main.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -44,13 +44,17 @@
static void show_usage(FAR const char *progname, int errcode)
{
fprintf(stderr, "USAGE: %s [OPTIONS]\n",
progname);
fprintf(stderr, "\nWhere OPTIONS include the following:\n");
fprintf(stderr, "\t-d <device>: Communication device to use. Default: %s\n",
CONFIG_SYSTEM_ZMODEM_DEVNAME);
fprintf(stderr, "\t-p <path>: Folder to hold the received file. Default: %s\n",
CONFIG_SYSTEM_ZMODEM_MOUNTPOINT);
fprintf(stderr,
"USAGE: %s [OPTIONS]\n",
progname);
fprintf(stderr,
"\nWhere OPTIONS include the following:\n");
fprintf(stderr,
"\t-d <device>: Communication device to use. Default: %s\n",
CONFIG_SYSTEM_ZMODEM_DEVNAME);
fprintf(stderr,
"\t-p <path>: Folder to hold the received file. Default: %s\n",
CONFIG_SYSTEM_ZMODEM_MOUNTPOINT);
fprintf(stderr, "\t-h: Show this text and exit\n");
exit(errcode);
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* system/zmodem/sz_main.c
* apps/system/zmodem/sz_main.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -49,8 +49,9 @@ static void show_usage(FAR const char *progname, int errcode)
fprintf(stderr, "\nWhere:\n");
fprintf(stderr, "\t<lname> is the local file name\n");
fprintf(stderr, "\nand OPTIONS include the following:\n");
fprintf(stderr, "\t-d <device>: Communication device to use. Default: %s\n",
CONFIG_SYSTEM_ZMODEM_DEVNAME);
fprintf(stderr,
"\t-d <device>: Communication device to use. Default: %s\n",
CONFIG_SYSTEM_ZMODEM_DEVNAME);
fprintf(stderr, "\t-r <rname>: Remote file name. Default <lname>\n");
fprintf(stderr, "\t-x <mode>: Transfer type\n");
fprintf(stderr, "\t\t0: Normal file (default)\n");
@ -112,7 +113,9 @@ int main(int argc, FAR char *argv[])
tmp = strtol(optarg, &endptr, 10);
if (tmp < 0 || tmp > 8)
{
fprintf(stderr, "ERROR: Transfer option out of range: %ld\n", tmp);
fprintf(stderr,
"ERROR: Transfer option out of range: %ld\n",
tmp);
show_usage(argv[0], EXIT_FAILURE);
}
else
@ -133,7 +136,9 @@ int main(int argc, FAR char *argv[])
tmp = strtol(optarg, &endptr, 10);
if (tmp < 0 || tmp > 3)
{
fprintf(stderr, "ERROR: Transfer type out of range: %ld\n", tmp);
fprintf(stderr,
"ERROR: Transfer type out of range: %ld\n",
tmp);
show_usage(argv[0], EXIT_FAILURE);
}
else

View File

@ -1,5 +1,5 @@
/****************************************************************************
* system/zmodem/zm_proto.c
* apps/system/zmodem/zm_proto.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* system/zmodem/zm_receive.c
* apps/system/zmodem/zm_receive.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -1,5 +1,5 @@
/****************************************************************************
* system/zmodem/zm_send.c
* apps/system/zmodem/zm_send.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -199,7 +199,9 @@ static const struct zm_transition_s g_zmr_initack[] =
{ZME_ERROR, false, ZMS_INITACK, zms_error},
};
/* Events handled in state ZMS_FILEWAIT- Sent file header, waiting for ZRPOS */
/* Events handled in state ZMS_FILEWAIT- Sent file header,
* waiting for ZRPOS
*/
static const struct zm_transition_s g_zms_filewait[] =
{
@ -218,8 +220,8 @@ static const struct zm_transition_s g_zms_filewait[] =
{ZME_ERROR, false, ZMS_FILEWAIT, zms_error},
};
/* Events handled in state ZMS_CRCWAIT - Sent file CRC, waiting for ZRPOS
* response.
/* Events handled in state ZMS_CRCWAIT - Sent file CRC,
* waiting for ZRPOS response.
*/
static const struct zm_transition_s g_zms_crcwait[] =
@ -450,14 +452,16 @@ static int zms_zrinit(FAR struct zm_state_s *pzm)
#ifdef CONFIG_SYSTEM_ZMODEM_RCVSAMPLE
/* We support CANFDX. We can do ZCRCG if the remote sender does too */
if ((rcaps & (CANFDX | CANOVIO)) == (CANFDX | CANOVIO) && pzms->rcvmax == 0)
if ((rcaps & (CANFDX | CANOVIO)) ==
(CANFDX | CANOVIO) && pzms->rcvmax == 0)
{
pzms->dpkttype = ZCRCG;
}
#else
/* We don't support CANFDX. We can do ZCRCQ if the remote sender does */
if ((rcaps & (CANFDX | CANOVIO)) == (CANFDX | CANOVIO) && pzms->rcvmax == 0)
if ((rcaps & (CANFDX | CANOVIO)) ==
(CANFDX | CANOVIO) && pzms->rcvmax == 0)
{
/* For the local sender, this is just like ZCRCW */
@ -870,7 +874,9 @@ static int zms_sendpacket(FAR struct zm_state_s *pzm)
sndsize = pzms->filesize - pzms->offset;
/* This is the number of bytes that have been sent but not yet acknowledged. */
/* This is the number of bytes that have been sent but not yet
* acknowledged.
*/
unacked = pzms->offset - pzms->lastoffs;
@ -885,7 +891,9 @@ static int zms_sendpacket(FAR struct zm_state_s *pzm)
if (pzms->rcvmax != 0)
{
/* If we were to send 'sndsize' more bytes, would that exceed recvmax? */
/* If we were to send 'sndsize' more bytes,
* would that exceed recvmax?
*/
if (sndsize + unacked > pzms->rcvmax)
{

View File

@ -1,5 +1,5 @@
/****************************************************************************
* system/zmodem/zm_state.c
* apps/system/zmodem/zm_state.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -181,7 +181,9 @@ static int zm_hdrevent(FAR struct zm_state_s *pzm)
{
uint32_t crc;
/* Checksum is over 9 bytes: The header type, 4 data bytes, plus 4 CRC bytes */
/* Checksum is over 9 bytes:
* The header type, 4 data bytes, plus 4 CRC bytes
*/
crc = crc32part(pzm->hdrdata, 9, 0xffffffff);
if (crc != 0xdebb20e3)
@ -194,7 +196,9 @@ static int zm_hdrevent(FAR struct zm_state_s *pzm)
{
uint16_t crc;
/* Checksum is over 7 bytes: The header type, 4 data bytes, plus 2 CRC bytes */
/* Checksum is over 7 bytes:
* The header type, 4 data bytes, plus 2 CRC bytes
*/
crc = crc16part(pzm->hdrdata, 7, 0);
if (crc != 0)
@ -264,9 +268,9 @@ static int zm_dataevent(FAR struct zm_state_s *pzm)
pzm->flags |= ZM_FLAG_CRKOK;
}
/* Adjust the back length to exclude the packet type length of the 2-
* byte checksum.
*/
/* Adjust the back length to exclude the packet type length of
* the 2- byte checksum.
*/
pzm->pktlen -= 3;
}
@ -330,11 +334,12 @@ static int zm_idle(FAR struct zm_state_s *pzm, uint8_t ch)
pzm->psubstate = PIDLE_ZPAD;
}
/* O might be the first character of "OO". "OO" might be part of the file
* receiver protocol. After receiving on e file in a group of files, the
* receiver expected either "OO" indicating that all files have been sent,
* or a ZRQINIT header indicating the start of the next file.
*/
/* O might be the first character of "OO". "OO" might be part of the
* file receiver protocol. After receiving on e file in a group of
* files, the receiver expected either "OO" indicating that all files
* have been sent, or a ZRQINIT header indicating the start of the next
* file.
*/
case 'O':
/* Is "OO" a possibility in this context? Fall through to the default
@ -370,7 +375,9 @@ static int zm_idle(FAR struct zm_state_s *pzm, uint8_t ch)
break;
}
/* Unexpected character. Wait for the next ZPAD to get us back in sync. */
/* Unexpected character.
* Wait for the next ZPAD to get us back in sync.
*/
default:
if (pzm->psubstate != PIDLE_ZPAD)
@ -390,20 +397,20 @@ static int zm_idle(FAR struct zm_state_s *pzm, uint8_t ch)
* Name: zm_header
*
* Description:
* Data has been received in state PSTATE_HEADER (i.e., ZDLE was received
* in PSTAT_IDLE).
* Data has been received in state PSTATE_HEADER (i.e., ZDLE was received
* in PSTAT_IDLE).
*
* The following headers are supported:
* The following headers are supported:
*
* 16-bit Binary:
* ZPAD ZDLE ZBIN type f3/p0 f2/p1 f1/p2 f0/p3 crc-1 crc-2
* Payload length: 7 (type, 4 bytes data, 2 byte CRC)
* 32-bit Binary:
* ZPAD ZDLE ZBIN32 type f3/p0 f2/p1 f1/p2 f0/p3 crc-1 crc-2 crc-3 crc-4
* Payload length: 9 (type, 4 bytes data, 4 byte CRC)
* Hex:
* ZPAD ZPAD ZDLE ZHEX type f3/p0 f2/p1 f1/p2 f0/p3 crc-1 crc-2 CR LF [XON]
* Payload length: 16 (14 hex digits, cr, lf, ignoring optional XON)
* 16-bit Binary:
* ZPAD ZDLE ZBIN type f3/p0 f2/p1 f1/p2 f0/p3 crc-1 crc-2
* Payload length: 7 (type, 4 bytes data, 2 byte CRC)
* 32-bit Binary:
* ZPAD ZDLE ZBIN32 type f3/p0 f2/p1 f1/p2 f0/p3 crc-1 crc-2 crc-3 crc-4
* Payload length: 9 (type, 4 bytes data, 4 byte CRC)
* Hex:
* ZPAD ZPAD ZDLE ZHEX type f3/p0 f2/p1 f1/p2 f0/p3 crc-1 crc-2 CR LF [XON]
* Payload length: 16 (14 hex digits, cr, lf, ignoring optional XON)
*
****************************************************************************/
@ -524,8 +531,8 @@ static int zm_header(FAR struct zm_state_s *pzm, uint8_t ch)
/* Check if the full header payload has bee buffered.
*
* The ZBIN format uses 16-bit CRC so the binary length of the
* full payload is 1+4+2 = 7 bytes; the ZBIN32 uses a 32-bit CRC
* so the binary length of the payload is 1+4+4 = 9 bytes;
* full payload is 1+4+2 = 7 bytes; the ZBIN32 uses a 32-bit
* CRC so the binary length of the payload is 1+4+4 = 9 bytes;
*/
if (ndx >= 9 || (pzm->hdrfmt == ZBIN && ndx >= 7))
@ -634,7 +641,8 @@ static int zm_data(FAR struct zm_state_s *pzm, uint8_t ch)
{
zmdbg("ERROR: The packet buffer is full\n");
zmdbg(" ch=%c[%02x] pktlen=%d pkttype=%02x ncrc=%d\n",
isprint(ch) ? ch : '.', ch, pzm->pktlen, pzm->pkttype, pzm->ncrc);
isprint(ch) ? ch : '.', ch, pzm->pktlen,
pzm->pkttype, pzm->ncrc);
zmdbg(" rcvlen=%d rcvndx=%d\n",
pzm->rcvlen, pzm->rcvndx);
return -ENOSPC;
@ -696,10 +704,12 @@ static int zm_data(FAR struct zm_state_s *pzm, uint8_t ch)
* payload plus the packet type code plus the CRC itself.
*/
pzm->pktbuf[pzm->pktlen++] = ch;
if (pzm->ncrc == 1)
{
/* We are at the end of the packet. Check the CRC and post the event */
pzm->pktbuf[pzm->pktlen++] = ch;
if (pzm->ncrc == 1)
{
/* We are at the end of the packet.
* Check the CRC and post the event
*/
ret = zm_dataevent(pzm);
@ -710,15 +720,15 @@ static int zm_data(FAR struct zm_state_s *pzm, uint8_t ch)
pzm->pktlen = 0;
pzm->ncrc = 0;
return ret;
}
else if (pzm->ncrc > 1)
{
}
else if (pzm->ncrc > 1)
{
/* We are still parsing the CRC. Decrement the count of CRC bytes
* remaining.
*/
pzm->ncrc--;
}
pzm->ncrc--;
}
return OK;
}
@ -945,7 +955,6 @@ int zm_datapump(FAR struct zm_state_s *pzm)
return ret;
}
/****************************************************************************
* Name: zm_readstate
*

View File

@ -1,5 +1,5 @@
/****************************************************************************
* system/zmodem/zm_utils.c
* apps/system/zmodem/zm_utils.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -42,10 +42,16 @@
* Public Data
****************************************************************************/
const uint8_t g_zeroes[4] = { 0, 0, 0, 0 };
const uint8_t g_zeroes[4] =
{
0,
0,
0,
0
};
/****************************************************************************
* Public Function Protypes
* Public Functions
****************************************************************************/
/****************************************************************************
@ -77,7 +83,7 @@ uint32_t zm_bytobe32(FAR const uint8_t *val8)
void zm_be32toby(uint32_t val32, FAR uint8_t *val8)
{
val8[0] = (uint8_t)( val32 & 0xff);
val8[0] = (uint8_t)(val32 & 0xff);
val8[1] = (uint8_t)((val32 >> 8) & 0xff);
val8[2] = (uint8_t)((val32 >> 16) & 0xff);
val8[3] = (uint8_t)((val32 >> 24) & 0xff);
@ -154,9 +160,9 @@ ssize_t zm_read(int fd, FAR uint8_t *buffer, size_t buflen)
{
ssize_t nread;
/* Read reading as necessary until the requested buffer data is successfully
* read or until an end of file indication or irrecoverable error is
* encountered.
/* Read reading as necessary until the requested buffer data is
* successfully read or until an end of file indication or irrecoverable
* error is encountered.
*
* This loop will only execute if the read is interrupted by a signal.
*/
@ -164,8 +170,10 @@ ssize_t zm_read(int fd, FAR uint8_t *buffer, size_t buflen)
nread = 0;
do
{
/* Get the next gulp of data from the file. On success, read will return
* (1) nread > 0 and nread <= buflen, (2) nread == 0 on end of file, or
/* Get the next gulp of data from the file.
* On success, read will return
* (1) nread > 0 and nread <= buflen,
* (2) nread == 0 on end of file, or
* (3) nread < 0 on a read error.
*/
@ -241,15 +249,15 @@ ssize_t zm_write(int fd, FAR const uint8_t *buffer, size_t buflen)
for (remaining = buflen; remaining > 0; )
{
#if CONFIG_SYSTEM_ZMODEM_WRITESIZE > 0
if (remaining > CONFIG_SYSTEM_ZMODEM_WRITESIZE)
{
wrsize = CONFIG_SYSTEM_ZMODEM_WRITESIZE;
}
else
if (remaining > CONFIG_SYSTEM_ZMODEM_WRITESIZE)
{
wrsize = CONFIG_SYSTEM_ZMODEM_WRITESIZE;
}
else
#endif
{
wrsize = remaining;
}
{
wrsize = remaining;
}
/* Get the next gulp of data from the file */
@ -385,13 +393,13 @@ int zm_writefile(int fd, FAR const uint8_t *buffer, size_t buflen, bool zcnl)
ret = zm_write(fd, (FAR uint8_t *)"\n", 1);
newline = true;
}
}
}
}
else
{
/* Increment the number of bytes we need to write beginning at
* start. We want to write as many contiguous bytes as possible
* for performance reasons.
* start. We want to write as many contiguous bytes as
* possible for performance reasons.
*/
nbytes++;
@ -447,7 +455,8 @@ uint32_t zm_filecrc(FAR struct zm_state_s *pzm, FAR const char *filename)
/* Calculate the file CRC */
crc = 0xffffffff;
while ((nread = zm_read(fd, pzm->scratch, CONFIG_SYSTEM_ZMODEM_SNDBUFSIZE)) > 0)
while ((nread = zm_read(fd, pzm->scratch,
CONFIG_SYSTEM_ZMODEM_SNDBUFSIZE)) > 0)
{
crc = crc32part(pzm->scratch, nread, crc);
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* system/zmodem/zm_watchdog.c
* apps/system/zmodem/zm_watchdog.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -45,7 +45,8 @@
static void zm_expiry(int signo, FAR siginfo_t *info, FAR void *context)
{
FAR struct zm_state_s *pzm = (FAR struct zm_state_s *)info->si_value.sival_ptr;
FAR struct zm_state_s *pzm =
(FAR struct zm_state_s *)info->si_value.sival_ptr;
/* Just set the timeout flag. If the Zmodem logic was truly waiting, then
* the signal should wake it up and it should then process the timeout