system: Fix nxstyle errors

error: Long line found
This commit is contained in:
simbit18 2023-05-10 13:13:03 +02:00 committed by CeDeROM
parent cb292d0608
commit b810ac0b7e
2 changed files with 119 additions and 102 deletions

View File

@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* apps/system/sched_note/note_main.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -16,11 +16,11 @@
* License for the specific language governing permissions and limitations
* under the License.
*
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -36,18 +36,18 @@
#include <nuttx/sched_note.h>
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
# define syslog_time(priority, fmt, ...) \
syslog(priority, "%08lx: " fmt, \
(unsigned long)systime, \
__VA_ARGS__)
/************************************************************************************
/****************************************************************************
* Private Data
************************************************************************************/
****************************************************************************/
static bool g_note_daemon_started;
static uint8_t g_note_buffer[CONFIG_SYSTEM_NOTE_BUFFERSIZE];
@ -73,13 +73,13 @@ static FAR const char *g_statenames[] =
#define NSTATES (sizeof(g_statenames)/sizeof(FAR const char *))
#endif
/************************************************************************************
/****************************************************************************
* Private Functions
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Name: trace_dump_unflatten
************************************************************************************/
****************************************************************************/
static void trace_dump_unflatten(FAR void *dst,
FAR uint8_t *src, size_t len)
@ -95,9 +95,9 @@ static void trace_dump_unflatten(FAR void *dst,
#endif
}
/************************************************************************************
/****************************************************************************
* Name: dump_notes
************************************************************************************/
****************************************************************************/
static void dump_notes(size_t nread)
{
@ -175,8 +175,8 @@ static void dump_notes(size_t nread)
#ifdef CONFIG_SMP
syslog_time(LOG_INFO,
"Task %u stopped, CPU%u, priority %u\n",
(unsigned int)pid,
(unsigned int)note->nc_cpu, (unsigned int)note->nc_priority);
(unsigned int)pid, (unsigned int)note->nc_cpu,
(unsigned int)note->nc_priority);
#else
syslog_time(LOG_INFO,
"Task %u stopped, priority %u\n",
@ -391,21 +391,23 @@ static void dump_notes(size_t nread)
return;
}
trace_dump_unflatten(&count, note_preempt->npr_count, sizeof(count));
trace_dump_unflatten(&count, note_preempt->npr_count,
sizeof(count));
if (note->nc_type == NOTE_PREEMPT_LOCK)
{
#ifdef CONFIG_SMP
syslog_time(LOG_INFO,
"Task %u locked, CPU%u, priority %u, count=%u\n",
(unsigned int)pid,
(unsigned int)note->nc_cpu,
(unsigned int)note->nc_priority, (unsigned int)count);
(unsigned int)pid, (unsigned int)note->nc_cpu,
(unsigned int)note->nc_priority,
(unsigned int)count);
#else
syslog_time(LOG_INFO,
"Task %u locked, priority %u, count=%u\n",
(unsigned int)pid,
(unsigned int)note->nc_priority, (unsigned int)count);
(unsigned int)note->nc_priority,
(unsigned int)count);
#endif
}
else
@ -413,14 +415,15 @@ static void dump_notes(size_t nread)
#ifdef CONFIG_SMP
syslog_time(LOG_INFO,
"Task %u unlocked, CPU%u, priority %u, count=%u\n",
(unsigned int)pid,
(unsigned int)note->nc_cpu,
(unsigned int)note->nc_priority, (unsigned int)count);
(unsigned int)pid, (unsigned int)note->nc_cpu,
(unsigned int)note->nc_priority,
(unsigned int)count);
#else
syslog_time(LOG_INFO,
"Task %u unlocked, priority %u, count=%u\n",
(unsigned int)pid,
(unsigned int)note->nc_priority, (unsigned int)count);
(unsigned int)note->nc_priority,
(unsigned int)count);
#endif
}
}
@ -447,38 +450,41 @@ static void dump_notes(size_t nread)
}
#ifdef CONFIG_SMP
trace_dump_unflatten(&count, note_csection->ncs_count, sizeof(count));
trace_dump_unflatten(&count, note_csection->ncs_count,
sizeof(count));
if (note->nc_type == NOTE_CSECTION_ENTER)
{
syslog_time(LOG_INFO,
"Task %u enter csection, CPU%u, priority %u, "
"count=%u\n",
(unsigned int)pid,
(unsigned int)note->nc_cpu,
(unsigned int)note->nc_priority, (unsigned int)count);
(unsigned int)pid, (unsigned int)note->nc_cpu,
(unsigned int)note->nc_priority,
(unsigned int)count);
}
else
{
syslog_time(LOG_INFO,
"Task %u leave csection, CPU%u, priority %u, "
"count=%u\n",
(unsigned int)pid,
(unsigned int)note->nc_cpu,
(unsigned int)note->nc_priority, (unsigned int)count);
(unsigned int)pid, (unsigned int)note->nc_cpu,
(unsigned int)note->nc_priority,
(unsigned int)count);
}
#else
if (note->nc_type == NOTE_CSECTION_ENTER)
{
syslog_time(LOG_INFO, "Task %u enter csection, priority %u\n",
(unsigned int)pid,
(unsigned int)note->nc_priority);
syslog_time(LOG_INFO,
"Task %u enter csection, priority %u\n",
(unsigned int)pid,
(unsigned int)note->nc_priority);
}
else
{
syslog_time(LOG_INFO, "Task %u leave csection, priority %u\n",
(unsigned int)pid,
(unsigned int)note->nc_priority);
syslog_time(LOG_INFO,
"Task %u leave csection, priority %u\n",
(unsigned int)pid,
(unsigned int)note->nc_priority);
}
#endif
}
@ -552,8 +558,8 @@ static void dump_notes(size_t nread)
case NOTE_SPINLOCK_ABORT:
{
syslog_time(LOG_INFO,
"Task %u CPU%u abort wait on spinlock=%p value=%u "
"priority %u\n",
"Task %u CPU%u abort wait on spinlock=%p "
"value=%u priority %u\n",
(unsigned int)pid,
(unsigned int)note->nc_cpu,
spinlock,
@ -623,7 +629,8 @@ static void dump_notes(size_t nread)
if (note->nc_length < SIZEOF_NOTE_SYSCALL_ENTER(0))
{
syslog(LOG_ERR,
"Size incorrect for \"SYSCALL enter\" note: %d\n",
"Size incorrect for \"SYSCALL enter\" note: "
"%d\n",
note->nc_length);
return;
}
@ -641,10 +648,12 @@ static void dump_notes(size_t nread)
(FAR struct note_syscall_leave_s *)note;
uintptr_t result;
if (note->nc_length != sizeof(struct note_syscall_leave_s))
if (note->nc_length !=
sizeof(struct note_syscall_leave_s))
{
syslog(LOG_ERR,
"Size incorrect for \"SYSCALL leave\" note: %d\n",
"Size incorrect for \"SYSCALL leave\" note: "
"%d\n",
note->nc_length);
return;
}
@ -677,10 +686,10 @@ static void dump_notes(size_t nread)
}
syslog_time(LOG_INFO,
"Task %u %s IRQ %d\n",
(unsigned int)pid,
note->nc_type == NOTE_IRQ_ENTER ? "Enter" : "Leave",
note_irq->nih_irq);
"Task %u %s IRQ %d\n",
(unsigned int)pid,
note->nc_type == NOTE_IRQ_ENTER ? "Enter" : "Leave",
note_irq->nih_irq);
}
break;
#endif
@ -717,7 +726,8 @@ static void dump_notes(size_t nread)
int ret = 0;
int i;
count = note->nc_length - sizeof(struct note_binary_s) + 1;
count =
note->nc_length - sizeof(struct note_binary_s) + 1;
if (count < 0)
{
@ -759,9 +769,9 @@ static void dump_notes(size_t nread)
}
}
/************************************************************************************
/****************************************************************************
* Name: note_daemon
************************************************************************************/
****************************************************************************/
static int note_daemon(int argc, char *argv[])
{
@ -780,7 +790,8 @@ static int note_daemon(int argc, char *argv[])
if (fd < 0)
{
int errcode = errno;
syslog(LOG_ERR, "note_daemon: ERROR: Failed to open /dev/note/ram: %d\n",
syslog(LOG_ERR, "note_daemon: ERROR: Failed to open /dev/note/ram: "
"%d\n",
errcode);
goto errout;
}
@ -807,13 +818,13 @@ errout:
return EXIT_FAILURE;
}
/************************************************************************************
/****************************************************************************
* Public Functions
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Name: note_main
************************************************************************************/
****************************************************************************/
int main(int argc, FAR char *argv[])
{

View File

@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* apps/system/termcurses/tcurses_vt100.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -16,11 +16,11 @@
* License for the specific language governing permissions and limitations
* under the License.
*
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -44,9 +44,9 @@
#include <sys/ioctl.h>
#include <nuttx/kmalloc.h>
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
#define KEY_DOWN 0x102 /* Down arrow key */
#define KEY_UP 0x103 /* Up arrow key */
@ -61,9 +61,9 @@
#define TINFO_ENTRY(n, d, c) d, c
#endif
/************************************************************************************
/****************************************************************************
* Private Types
************************************************************************************/
****************************************************************************/
struct tcurses_vt100_s
{
@ -78,14 +78,15 @@ struct tcurses_vt100_s
tcflag_t lflag;
};
/************************************************************************************
/****************************************************************************
* Private Function Prototypes
************************************************************************************/
****************************************************************************/
static FAR struct termcurses_s *tcurses_vt100_initialize(int in_fd, int out_fd);
static FAR struct termcurses_s *tcurses_vt100_initialize(int in_fd,
int out_fd);
static int tcurses_vt100_clear(FAR struct termcurses_s *dev, int type);
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);
static int tcurses_vt100_getwinsize(FAR struct termcurses_s *dev,
FAR struct winsize *winsz);
static int tcurses_vt100_setcolors(FAR struct termcurses_s *dev,
@ -97,9 +98,9 @@ static int tcurses_vt100_getkeycode(FAR struct termcurses_s *dev,
static bool tcurses_vt100_checkkey(FAR struct termcurses_s *dev);
static int tcurses_vt100_terminate(FAR struct termcurses_s *dev);
/************************************************************************************
/****************************************************************************
* Private Data
************************************************************************************/
****************************************************************************/
static const struct termcurses_ops_s g_vt100_ops =
{
@ -713,9 +714,9 @@ static const struct keycodes_s g_ctrl_keycodes[] =
};
#endif /* CONFIG_SYSTEM_TERMCURSES_VT100_OSX_ALT_CODES */
/************************************************************************************
/****************************************************************************
* Public Data
************************************************************************************/
****************************************************************************/
struct termcurses_dev_s g_vt100_tcurs =
{
@ -724,13 +725,13 @@ struct termcurses_dev_s g_vt100_tcurs =
"vt100, vt102, ansi" /* List of supported terminals */
};
/************************************************************************************
/****************************************************************************
* Private Functions
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Clear screen / line operations
************************************************************************************/
****************************************************************************/
static int tcurses_vt100_clear(FAR struct termcurses_s *dev, int type)
{
@ -774,9 +775,9 @@ static int tcurses_vt100_clear(FAR struct termcurses_s *dev, int type)
return ret;
}
/************************************************************************************
/****************************************************************************
* Move cursor operations
************************************************************************************/
****************************************************************************/
static int tcurses_vt100_move(FAR struct termcurses_s *dev, int type,
int col, int row)
@ -812,9 +813,9 @@ static int tcurses_vt100_move(FAR struct termcurses_s *dev, int type,
return ret;
}
/************************************************************************************
/****************************************************************************
* Calculates an ANSI 256 color index based on the 24-bit RGB value given.
************************************************************************************/
****************************************************************************/
static uint8_t tcurses_vt100_getcolorindex(int red, int green, int blue)
{
@ -898,9 +899,9 @@ static uint8_t tcurses_vt100_getcolorindex(int red, int green, int blue)
return 16 + r * 36 + g * 6 + b;
}
/************************************************************************************
/****************************************************************************
* Set fg / bg colors
************************************************************************************/
****************************************************************************/
static int tcurses_vt100_setcolors(FAR struct termcurses_s *dev,
FAR struct termcurses_colors_s *colors)
@ -927,7 +928,8 @@ static int tcurses_vt100_setcolors(FAR struct termcurses_s *dev,
if ((colors->color_mask & TCURS_COLOR_BG) != 0)
{
if (colors->bg_red != 0 || colors->bg_green != 0 || colors->bg_blue != 0)
if (colors->bg_red != 0 || colors->bg_green != 0 ||
colors->bg_blue != 0)
{
colors->bg_red = 0;
}
@ -948,9 +950,9 @@ static int tcurses_vt100_setcolors(FAR struct termcurses_s *dev,
return ret;
}
/************************************************************************************
/****************************************************************************
* Get windows size from terminal emulator connected to serial port
************************************************************************************/
****************************************************************************/
static int tcurses_vt100_getwinsize(FAR struct termcurses_s *dev,
FAR struct winsize *winsz)
@ -1045,9 +1047,9 @@ static int tcurses_vt100_getwinsize(FAR struct termcurses_s *dev,
return -ENOSYS;
}
/************************************************************************************
/****************************************************************************
* Set display attributes
************************************************************************************/
****************************************************************************/
static int tcurses_vt100_setattributes(FAR struct termcurses_s *dev,
unsigned long attrib)
@ -1118,11 +1120,11 @@ static int tcurses_vt100_setattributes(FAR struct termcurses_s *dev,
return ret;
}
/************************************************************************************
/****************************************************************************
* Get keycode from the terminal, translating special escape sequences into
* special key values.
*
************************************************************************************/
****************************************************************************/
static int tcurses_vt100_getkeycode(FAR struct termcurses_s *dev,
FAR int *specialkey,
@ -1168,7 +1170,9 @@ static int tcurses_vt100_getkeycode(FAR struct termcurses_s *dev,
tv.tv_sec = 0;
tv.tv_usec = 1000;
/* Loop until we have a valid key code, taking escape sequences into account */
/* Loop until we have a valid key code, taking escape sequences
* into account
*/
keycode = -1;
*keymodifiers = 0;
@ -1237,7 +1241,7 @@ static int tcurses_vt100_getkeycode(FAR struct termcurses_s *dev,
continue;
}
/* No more characters waiting in the queue. Must be ESC key. */
/* No more characters waiting in the queue. Must be ESC key. */
return '\x1b';
}
@ -1409,10 +1413,10 @@ static int tcurses_vt100_getkeycode(FAR struct termcurses_s *dev,
return keycode;
}
/************************************************************************************
/****************************************************************************
* Check if a key is cached for processing.
*
************************************************************************************/
****************************************************************************/
static bool tcurses_vt100_checkkey(FAR struct termcurses_s *dev)
{
@ -1451,18 +1455,19 @@ static bool tcurses_vt100_checkkey(FAR struct termcurses_s *dev)
return false;
}
/************************************************************************************
/****************************************************************************
* Public Functions
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Name: tcurses_vt100_initialize
*
* Description:
* Initialize a specific instance of the VT100 TermCurses handler and bind it to
* a specific file descriptor pair (input/output ... typically stdin / stdout).
* Initialize a specific instance of the VT100 TermCurses handler and
* bind it to a specific file descriptor pair
* (input/output ... typically stdin / stdout).
*
************************************************************************************/
****************************************************************************/
FAR struct termcurses_s *tcurses_vt100_initialize(int in_fd, int out_fd)
{
@ -1471,7 +1476,8 @@ FAR struct termcurses_s *tcurses_vt100_initialize(int in_fd, int out_fd)
/* Allocate a new device structure */
priv = (FAR struct tcurses_vt100_s *)zalloc(sizeof(struct tcurses_vt100_s));
priv =
(FAR struct tcurses_vt100_s *)zalloc(sizeof(struct tcurses_vt100_s));
if (priv == NULL)
{
return NULL;
@ -1515,13 +1521,13 @@ FAR struct termcurses_s *tcurses_vt100_initialize(int in_fd, int out_fd)
return (FAR struct termcurses_s *)priv;
}
/************************************************************************************
/****************************************************************************
* Name: tcurses_vt100_terminate
*
* Description:
* Terminates a specific instance of the VT100 TermCurses handler.
*
************************************************************************************/
****************************************************************************/
static int tcurses_vt100_terminate(FAR struct termcurses_s *dev)
{