Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
602ff0cd76
commit
1140bebfc0
@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* examples/cpuhog/cpuhog_main.c
|
* apps/examples/cpuhog/cpuhog_main.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@ -58,7 +58,6 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -112,7 +111,7 @@ int main(int argc, FAR char *argv[])
|
|||||||
printf("cpuhog initialized\n");
|
printf("cpuhog initialized\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
while(1)
|
while (1)
|
||||||
{
|
{
|
||||||
/* To test semaphore interaction (debugging system crashes...) */
|
/* To test semaphore interaction (debugging system crashes...) */
|
||||||
|
|
||||||
|
@ -77,6 +77,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* Configuration ************************************************************/
|
/* Configuration ************************************************************/
|
||||||
|
|
||||||
#if !defined(CONFIG_IEEE802154_I8SAK_NINSTANCES) || CONFIG_IEEE802154_I8SAK_NINSTANCES <= 0
|
#if !defined(CONFIG_IEEE802154_I8SAK_NINSTANCES) || CONFIG_IEEE802154_I8SAK_NINSTANCES <= 0
|
||||||
@ -93,7 +94,8 @@
|
|||||||
struct i8sak_command_s
|
struct i8sak_command_s
|
||||||
{
|
{
|
||||||
FAR const char *name;
|
FAR const char *name;
|
||||||
CODE void (*handler)(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[]);
|
CODE void (*handler)(FAR struct i8sak_s *i8sak,
|
||||||
|
int argc, FAR char *argv[]);
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -181,8 +183,10 @@ int i8sak_requestdaemon(FAR struct i8sak_s *i8sak)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
i8sak->daemon_shutdown = false;
|
i8sak->daemon_shutdown = false;
|
||||||
i8sak->daemon_pid = task_create(daemonname, CONFIG_IEEE802154_I8SAK_PRIORITY,
|
i8sak->daemon_pid = task_create(daemonname,
|
||||||
CONFIG_IEEE802154_I8SAK_STACKSIZE, i8sak_daemon,
|
CONFIG_IEEE802154_I8SAK_PRIORITY,
|
||||||
|
CONFIG_IEEE802154_I8SAK_STACKSIZE,
|
||||||
|
i8sak_daemon,
|
||||||
NULL);
|
NULL);
|
||||||
if (i8sak->daemon_pid < 0)
|
if (i8sak->daemon_pid < 0)
|
||||||
{
|
{
|
||||||
@ -191,7 +195,7 @@ int i8sak_requestdaemon(FAR struct i8sak_s *i8sak)
|
|||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use the signal semaphore to wait for daemon to start before returning */
|
/* Use the semaphore to wait for daemon to start before returning */
|
||||||
|
|
||||||
ret = sem_wait(&i8sak->sigsem);
|
ret = sem_wait(&i8sak->sigsem);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@ -389,7 +393,8 @@ uint8_t i8sak_char2nibble(char ch)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ERROR: Unexpected character in hex value: %02x\n", ch);
|
fprintf(stderr, "ERROR: Unexpected character in hex value: %02x\n",
|
||||||
|
ch);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -571,8 +576,8 @@ static void i8sak_switch_instance(FAR char *ifname)
|
|||||||
|
|
||||||
sq_addlast((FAR sq_entry_t *)i8sak, &g_i8sak_instances);
|
sq_addlast((FAR sq_entry_t *)i8sak, &g_i8sak_instances);
|
||||||
|
|
||||||
/* Update our "sticky" i8sak instance. Must come before call to setup so that
|
/* Update our "sticky" i8sak instance. Must come before call to setup
|
||||||
* the shared active global i8sak is correct.
|
* so that the shared active global i8sak is correct.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
g_activei8sak = i8sak;
|
g_activei8sak = i8sak;
|
||||||
@ -605,6 +610,7 @@ static int i8sak_setup(FAR struct i8sak_s *i8sak, FAR const char *ifname)
|
|||||||
fprintf(stderr, "ERROR: ifname too long\n");
|
fprintf(stderr, "ERROR: ifname too long\n");
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(&i8sak->ifname[0], ifname);
|
strcpy(&i8sak->ifname[0], ifname);
|
||||||
|
|
||||||
i8sak->chan = 11;
|
i8sak->chan = 11;
|
||||||
@ -616,21 +622,21 @@ static int i8sak_setup(FAR struct i8sak_s *i8sak, FAR const char *ifname)
|
|||||||
/* Initialize the default remote endpoint address */
|
/* Initialize the default remote endpoint address */
|
||||||
|
|
||||||
for (i = 0; i < IEEE802154_EADDRSIZE; i++)
|
for (i = 0; i < IEEE802154_EADDRSIZE; i++)
|
||||||
{
|
{
|
||||||
i8sak->ep_addr.eaddr[i] =
|
i8sak->ep_addr.eaddr[i] =
|
||||||
(uint8_t)((CONFIG_IEEE802154_I8SAK_DEFAULT_EP_EADDR >> (i*8)) & 0xFF);
|
(CONFIG_IEEE802154_I8SAK_DEFAULT_EP_EADDR >> (i * 8)) & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < IEEE802154_SADDRSIZE; i++)
|
for (i = 0; i < IEEE802154_SADDRSIZE; i++)
|
||||||
{
|
{
|
||||||
i8sak->ep_addr.saddr[i] =
|
i8sak->ep_addr.saddr[i] =
|
||||||
(uint8_t)((CONFIG_IEEE802154_I8SAK_DEFAULT_EP_SADDR >> (i*8)) & 0xFF);
|
(CONFIG_IEEE802154_I8SAK_DEFAULT_EP_SADDR >> (i * 8)) & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < IEEE802154_PANIDSIZE; i++)
|
for (i = 0; i < IEEE802154_PANIDSIZE; i++)
|
||||||
{
|
{
|
||||||
i8sak->ep_addr.panid[i] =
|
i8sak->ep_addr.panid[i] =
|
||||||
(uint8_t)((CONFIG_IEEE802154_I8SAK_DEFAULT_EP_PANID >> (i*8)) & 0xFF);
|
(CONFIG_IEEE802154_I8SAK_DEFAULT_EP_PANID >> (i * 8)) & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_NET_6LOWPAN
|
#ifdef CONFIG_NET_6LOWPAN
|
||||||
@ -647,12 +653,12 @@ static int i8sak_setup(FAR struct i8sak_s *i8sak, FAR const char *ifname)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
for (i = 0; i < IEEE802154_SADDRSIZE; i++)
|
for (i = 0; i < IEEE802154_SADDRSIZE; i++)
|
||||||
{
|
{
|
||||||
i8sak->next_saddr[i] =
|
i8sak->next_saddr[i] =
|
||||||
(uint8_t)(((CONFIG_IEEE802154_I8SAK_DEFAULT_EP_SADDR + 1) >> (i*8)) & 0xFF);
|
((CONFIG_IEEE802154_I8SAK_DEFAULT_EP_SADDR + 1) >> (i * 8)) & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if argument starts with /dev/ */
|
/* Check if argument starts with /dev/ */
|
||||||
|
|
||||||
if (strncmp(ifname, "/dev/", 5) == 0)
|
if (strncmp(ifname, "/dev/", 5) == 0)
|
||||||
{
|
{
|
||||||
@ -668,7 +674,8 @@ static int i8sak_setup(FAR struct i8sak_s *i8sak, FAR const char *ifname)
|
|||||||
fd = open(i8sak->ifname, O_RDWR);
|
fd = open(i8sak->ifname, O_RDWR);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ERROR: cannot open %s, errno=%d\n", i8sak->ifname, errno);
|
fprintf(stderr, "ERROR: cannot open %s, errno=%d\n",
|
||||||
|
i8sak->ifname, errno);
|
||||||
i8sak_cmd_error(i8sak);
|
i8sak_cmd_error(i8sak);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -710,7 +717,8 @@ static int i8sak_setup(FAR struct i8sak_s *i8sak, FAR const char *ifname)
|
|||||||
sq_init(&i8sak->eventreceivers_free);
|
sq_init(&i8sak->eventreceivers_free);
|
||||||
for (i = 0; i < CONFIG_I8SAK_NEVENTRECEIVERS; i++)
|
for (i = 0; i < CONFIG_I8SAK_NEVENTRECEIVERS; i++)
|
||||||
{
|
{
|
||||||
sq_addlast((FAR sq_entry_t *)&i8sak->eventreceiver_pool[i], &i8sak->eventreceivers_free);
|
sq_addlast((FAR sq_entry_t *)&i8sak->eventreceiver_pool[i],
|
||||||
|
&i8sak->eventreceivers_free);
|
||||||
}
|
}
|
||||||
|
|
||||||
i8sak->blasterperiod = 1000;
|
i8sak->blasterperiod = 1000;
|
||||||
@ -738,7 +746,8 @@ static int i8sak_daemon(int argc, FAR char *argv[])
|
|||||||
i8sak->fd = open(i8sak->ifname, O_RDWR);
|
i8sak->fd = open(i8sak->ifname, O_RDWR);
|
||||||
if (i8sak->fd < 0)
|
if (i8sak->fd < 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ERROR: cannot open %s, errno=%d\n", i8sak->ifname, errno);
|
fprintf(stderr, "ERROR: cannot open %s, errno=%d\n",
|
||||||
|
i8sak->ifname, errno);
|
||||||
ret = errno;
|
ret = errno;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -775,8 +784,8 @@ static int i8sak_daemon(int argc, FAR char *argv[])
|
|||||||
i8sak->blasterenabled = true;
|
i8sak->blasterenabled = true;
|
||||||
i8sak->startblaster = false;
|
i8sak->startblaster = false;
|
||||||
|
|
||||||
ret = pthread_create(&i8sak->blaster_threadid, NULL, i8sak_blaster_thread,
|
ret = pthread_create(&i8sak->blaster_threadid, NULL,
|
||||||
(void *)i8sak);
|
i8sak_blaster_thread, (void *)i8sak);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "failed to start blaster thread: %d\n", ret);
|
fprintf(stderr, "failed to start blaster thread: %d\n", ret);
|
||||||
@ -789,8 +798,8 @@ static int i8sak_daemon(int argc, FAR char *argv[])
|
|||||||
i8sak->snifferenabled = true;
|
i8sak->snifferenabled = true;
|
||||||
i8sak->startsniffer = false;
|
i8sak->startsniffer = false;
|
||||||
|
|
||||||
ret = pthread_create(&i8sak->sniffer_threadid, NULL, i8sak_sniffer_thread,
|
ret = pthread_create(&i8sak->sniffer_threadid, NULL,
|
||||||
(void *)i8sak);
|
i8sak_sniffer_thread, (void *)i8sak);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "failed to start sniffer thread: %d\n", ret);
|
fprintf(stderr, "failed to start sniffer thread: %d\n", ret);
|
||||||
@ -815,7 +824,8 @@ static int i8sak_daemon(int argc, FAR char *argv[])
|
|||||||
|
|
||||||
static int i8sak_showusage(FAR const char *progname, int exitcode)
|
static int i8sak_showusage(FAR const char *progname, int exitcode)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Usage (Use the -h option on any command to get more info): %s\n"
|
fprintf(stderr,
|
||||||
|
"Usage (Use the -h option on any command to get more info): %s\n"
|
||||||
" acceptassoc [-h|e]\n"
|
" acceptassoc [-h|e]\n"
|
||||||
" assoc [-h|p|e|s|w|r|t]\n"
|
" assoc [-h|p|e|s|w|r|t]\n"
|
||||||
" blaster [-h|q|f|p]\n"
|
" blaster [-h|q|f|p]\n"
|
||||||
@ -867,7 +877,6 @@ int main(int argc, FAR char *argv[])
|
|||||||
if ((strncmp(argv[argind], "/dev/", 5) == 0) ||
|
if ((strncmp(argv[argind], "/dev/", 5) == 0) ||
|
||||||
(strncmp(argv[argind], "wpan", 4) == 0))
|
(strncmp(argv[argind], "wpan", 4) == 0))
|
||||||
{
|
{
|
||||||
|
|
||||||
i8sak_switch_instance(argv[argind]);
|
i8sak_switch_instance(argv[argind]);
|
||||||
argind++;
|
argind++;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user