mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-05 22:24:47 +08:00
drivers/, drivers/pipes, and drivers/serial file clean-up
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4944 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
@@ -2995,3 +2995,4 @@
|
|||||||
and do not follow current NuttX coding standards in detail.
|
and do not follow current NuttX coding standards in detail.
|
||||||
* fs/: More stylistic file clean-up.
|
* fs/: More stylistic file clean-up.
|
||||||
* mm/: More stylistic file clean-up.
|
* mm/: More stylistic file clean-up.
|
||||||
|
* drivers/ and drivers/serial/: More stylistic file clean-up.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* drivers/dev_null.c
|
* drivers/dev_null.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* drivers/dev_null.c
|
* drivers/dev_null.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* drivers/loop.c
|
* drivers/loop.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -166,6 +166,7 @@ static int loop_open(FAR struct inode *inode)
|
|||||||
|
|
||||||
dev->opencnt++;
|
dev->opencnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
loop_semgive(dev);
|
loop_semgive(dev);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -198,6 +199,7 @@ static int loop_close(FAR struct inode *inode)
|
|||||||
|
|
||||||
dev->opencnt--;
|
dev->opencnt--;
|
||||||
}
|
}
|
||||||
|
|
||||||
loop_semgive(dev);
|
loop_semgive(dev);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -327,6 +329,7 @@ static int loop_geometry(FAR struct inode *inode, struct geometry *geometry)
|
|||||||
geometry->geo_sectorsize = dev->sectsize;
|
geometry->geo_sectorsize = dev->sectsize;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# drivers/pipes/Make.defs
|
# drivers/pipes/Make.defs
|
||||||
#
|
#
|
||||||
# Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
|
# Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
# modification, are permitted provided that the following conditions
|
# modification, are permitted provided that the following conditions
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* drivers/pipes/fifo.c
|
* drivers/pipes/fifo.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -113,6 +113,7 @@ static const struct file_operations fifo_fops =
|
|||||||
* appropriately.
|
* appropriately.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int mkfifo(FAR const char *pathname, mode_t mode)
|
int mkfifo(FAR const char *pathname, mode_t mode)
|
||||||
{
|
{
|
||||||
struct pipe_dev_s *dev;
|
struct pipe_dev_s *dev;
|
||||||
@@ -131,6 +132,8 @@ int mkfifo(FAR const char *pathname, mode_t mode)
|
|||||||
{
|
{
|
||||||
pipecommon_freedev(dev);
|
pipecommon_freedev(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_DEV_PIPE_SIZE > 0 */
|
#endif /* CONFIG_DEV_PIPE_SIZE > 0 */
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* drivers/pipes/pipe.c
|
* drivers/pipes/pipe.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -114,6 +114,7 @@ static inline int pipe_allocate(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,7 +146,7 @@ static int pipe_close(FAR struct file *filep)
|
|||||||
#if CONFIG_DEBUG
|
#if CONFIG_DEBUG
|
||||||
if (!dev)
|
if (!dev)
|
||||||
{
|
{
|
||||||
return -EBADF;
|
return -EBADF;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -158,6 +159,7 @@ static int pipe_close(FAR struct file *filep)
|
|||||||
|
|
||||||
pipe_free(dev->d_pipeno);
|
pipe_free(dev->d_pipeno);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,6 +230,7 @@ int pipe(int filedes[2])
|
|||||||
err = ENOMEM;
|
err = ENOMEM;
|
||||||
goto errout_with_pipe;
|
goto errout_with_pipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev->d_pipeno = pipeno;
|
dev->d_pipeno = pipeno;
|
||||||
|
|
||||||
/* Register the pipe device */
|
/* Register the pipe device */
|
||||||
@@ -244,6 +247,7 @@ int pipe(int filedes[2])
|
|||||||
|
|
||||||
g_pipecreated |= (1 << pipeno);
|
g_pipecreated |= (1 << pipeno);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)sem_post(&g_pipesem);
|
(void)sem_post(&g_pipesem);
|
||||||
|
|
||||||
/* Get a write file descriptor */
|
/* Get a write file descriptor */
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* drivers/pipes/pipe_common.c
|
* drivers/pipes/pipe_common.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -161,6 +161,7 @@ FAR struct pipe_dev_s *pipecommon_allocdev(void)
|
|||||||
sem_init(&dev->d_rdsem, 0, 0);
|
sem_init(&dev->d_rdsem, 0, 0);
|
||||||
sem_init(&dev->d_wrsem, 0, 0);
|
sem_init(&dev->d_wrsem, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,6 +195,7 @@ int pipecommon_open(FAR struct file *filep)
|
|||||||
return -EBADF;
|
return -EBADF;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Make sure that we have exclusive access to the device structure. The
|
/* Make sure that we have exclusive access to the device structure. The
|
||||||
* sem_wait() call should fail only if we are awakened by a signal.
|
* sem_wait() call should fail only if we are awakened by a signal.
|
||||||
*/
|
*/
|
||||||
@@ -306,9 +308,9 @@ int pipecommon_close(FAR struct file *filep)
|
|||||||
|
|
||||||
if (dev->d_refs > 1)
|
if (dev->d_refs > 1)
|
||||||
{
|
{
|
||||||
/* No.. then just decrement the reference count */
|
/* No.. then just decrement the reference count */
|
||||||
|
|
||||||
dev->d_refs--;
|
dev->d_refs--;
|
||||||
|
|
||||||
/* If opened for writing, decrement the count of writers on on the pipe instance */
|
/* If opened for writing, decrement the count of writers on on the pipe instance */
|
||||||
|
|
||||||
@@ -459,6 +461,7 @@ ssize_t pipecommon_write(FAR struct file *filep, FAR const char *buffer, size_t
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pipe_dumpbuffer("To PIPE:", (uint8_t*)buffer, len);
|
pipe_dumpbuffer("To PIPE:", (uint8_t*)buffer, len);
|
||||||
|
|
||||||
/* At present, this method cannot be called from interrupt handlers. That is
|
/* At present, this method cannot be called from interrupt handlers. That is
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* drivers/pipe/pipe_common.h
|
* drivers/pipe/pipe_common.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -33,8 +33,8 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef __DRIVERS_PIPE_COMMON_H
|
#ifndef __DRIVERS_PIPES_PIPE_COMMON_H
|
||||||
#define __DRIVERS_PIPE_COMMON_H
|
#define __DRIVERS_PIPES_PIPE_COMMON_H
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
@@ -136,4 +136,4 @@ EXTERN int pipecommon_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* CONFIG_DEV_PIPE_SIZE > 0 */
|
#endif /* CONFIG_DEV_PIPE_SIZE > 0 */
|
||||||
#endif /* __DRIVERS_PIPE_COMMON_H */
|
#endif /* __DRIVERS_PIPES_PIPE_COMMON_H */
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* drivers/ramdisk.c
|
* drivers/ramdisk.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -166,6 +166,7 @@ static ssize_t rd_read(FAR struct inode *inode, unsigned char *buffer,
|
|||||||
nsectors * dev->rd_sectsize);
|
nsectors * dev->rd_sectsize);
|
||||||
return nsectors;
|
return nsectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,6 +205,7 @@ static ssize_t rd_write(FAR struct inode *inode, const unsigned char *buffer,
|
|||||||
nsectors * dev->rd_sectsize);
|
nsectors * dev->rd_sectsize);
|
||||||
return nsectors;
|
return nsectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -EFBIG;
|
return -EFBIG;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -242,6 +244,7 @@ static int rd_geometry(FAR struct inode *inode, struct geometry *geometry)
|
|||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,11 +267,11 @@ static int rd_ioctl(FAR struct inode *inode, int cmd, unsigned long arg)
|
|||||||
DEBUGASSERT(inode && inode->i_private);
|
DEBUGASSERT(inode && inode->i_private);
|
||||||
if (cmd == BIOC_XIPBASE && ppv)
|
if (cmd == BIOC_XIPBASE && ppv)
|
||||||
{
|
{
|
||||||
dev = (struct rd_struct_s *)inode->i_private;
|
dev = (struct rd_struct_s *)inode->i_private;
|
||||||
*ppv = (void*)dev->rd_buffer;
|
*ppv = (void*)dev->rd_buffer;
|
||||||
|
|
||||||
fvdbg("ppv: %p\n", *ppv);
|
fvdbg("ppv: %p\n", *ppv);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -ENOTTY;
|
return -ENOTTY;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* drivers/rwbuffer.c
|
* drivers/rwbuffer.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -359,6 +359,7 @@ static int rwb_rhreload(struct rwbuffer_s *rwb, off_t startblock)
|
|||||||
{
|
{
|
||||||
endblock = rwb->nblocks;
|
endblock = rwb->nblocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
nblocks = endblock - startblock;
|
nblocks = endblock - startblock;
|
||||||
|
|
||||||
/* Now perform the read */
|
/* Now perform the read */
|
||||||
@@ -655,10 +656,12 @@ int rwb_write(FAR struct rwbuffer_s *rwb, off_t startblock,
|
|||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: rwb_mediaremoved
|
* Name: rwb_mediaremoved
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* The following function is called when media is removed
|
||||||
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* The following function is called when media is removed */
|
|
||||||
|
|
||||||
int rwb_mediaremoved(FAR struct rwbuffer_s *rwb)
|
int rwb_mediaremoved(FAR struct rwbuffer_s *rwb)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_FS_WRITEBUFFER
|
#ifdef CONFIG_FS_WRITEBUFFER
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# drivers/serial/Make.defs
|
# drivers/serial/Make.defs
|
||||||
#
|
#
|
||||||
# Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
|
# Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
# modification, are permitted provided that the following conditions
|
# modification, are permitted provided that the following conditions
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ static void uart_takesem(FAR sem_t *sem)
|
|||||||
* the wait was awakened by a signal.
|
* the wait was awakened by a signal.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ASSERT(*get_errno_ptr() == EINTR);
|
ASSERT(get_errno() == EINTR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* drivers/serial/serialirq.c
|
* drivers/serial/serialirq.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -184,4 +184,3 @@ void uart_recvchars(FAR uart_dev_t *dev)
|
|||||||
uart_datareceived(dev);
|
uart_datareceived(dev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* Serial driver for 16550 UART
|
* Serial driver for 16550 UART
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -295,24 +295,24 @@ static uart_dev_t g_uart3port =
|
|||||||
/* Which UART with be tty0/console and which tty1? tty2? tty3? */
|
/* Which UART with be tty0/console and which tty1? tty2? tty3? */
|
||||||
|
|
||||||
#if defined(CONFIG_UART0_SERIAL_CONSOLE)
|
#if defined(CONFIG_UART0_SERIAL_CONSOLE)
|
||||||
# define CONSOLE_DEV g_uart0port /* UART0=console */
|
# define CONSOLE_DEV g_uart0port /* UART0=console */
|
||||||
# define TTYS0_DEV g_uart0port /* UART0=ttyS0 */
|
# define TTYS0_DEV g_uart0port /* UART0=ttyS0 */
|
||||||
# ifdef CONFIG_16550_UART1
|
# ifdef CONFIG_16550_UART1
|
||||||
# define TTYS1_DEV g_uart1port /* UART0=ttyS0;UART1=ttyS1 */
|
# define TTYS1_DEV g_uart1port /* UART0=ttyS0;UART1=ttyS1 */
|
||||||
# ifdef CONFIG_16550_UART2
|
# ifdef CONFIG_16550_UART2
|
||||||
# define TTYS2_DEV g_uart2port /* UART0=ttyS0;UART1=ttyS1;UART2=ttyS2 */
|
# define TTYS2_DEV g_uart2port /* UART0=ttyS0;UART1=ttyS1;UART2=ttyS2 */
|
||||||
# ifdef CONFIG_16550_UART3
|
# ifdef CONFIG_16550_UART3
|
||||||
# define TTYS3_DEV g_uart3port /* UART0=ttyS0;UART1=ttyS1;UART2=ttyS2;UART3=ttyS3 */
|
# define TTYS3_DEV g_uart3port /* UART0=ttyS0;UART1=ttyS1;UART2=ttyS2;UART3=ttyS3 */
|
||||||
# else
|
# else
|
||||||
# undef TTYS3_DEV /* UART0=ttyS0;UART1=ttyS1;UART2=ttyS;No ttyS3 */
|
# undef TTYS3_DEV /* UART0=ttyS0;UART1=ttyS1;UART2=ttyS;No ttyS3 */
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
# ifdef CONFIG_16550_UART3
|
# ifdef CONFIG_16550_UART3
|
||||||
# define TTYS2_DEV g_uart3port /* UART0=ttyS0;UART1=ttyS1;UART3=ttys2;No ttyS3 */
|
# define TTYS2_DEV g_uart3port /* UART0=ttyS0;UART1=ttyS1;UART3=ttys2;No ttyS3 */
|
||||||
# else
|
# else
|
||||||
# undef TTYS2_DEV /* UART0=ttyS0;UART1=ttyS1;No ttyS2;No ttyS3 */
|
# undef TTYS2_DEV /* UART0=ttyS0;UART1=ttyS1;No ttyS2;No ttyS3 */
|
||||||
# endif
|
# endif
|
||||||
# undef TTYS3_DEV /* No ttyS3 */
|
# undef TTYS3_DEV /* No ttyS3 */
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
# ifdef CONFIG_16550_UART2
|
# ifdef CONFIG_16550_UART2
|
||||||
@@ -329,68 +329,68 @@ static uart_dev_t g_uart3port =
|
|||||||
# else
|
# else
|
||||||
# undef TTYS1_DEV /* UART0=ttyS0;No ttyS1;No ttyS2;No ttyS3 */
|
# undef TTYS1_DEV /* UART0=ttyS0;No ttyS1;No ttyS2;No ttyS3 */
|
||||||
# endif
|
# endif
|
||||||
# undef TTYS2_DEV /* No ttyS2 */
|
# undef TTYS2_DEV /* No ttyS2 */
|
||||||
# undef TTYS3_DEV /* No ttyS3 */
|
# undef TTYS3_DEV /* No ttyS3 */
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
#elif defined(CONFIG_UART1_SERIAL_CONSOLE)
|
#elif defined(CONFIG_UART1_SERIAL_CONSOLE)
|
||||||
# define CONSOLE_DEV g_uart1port /* UART1=console */
|
# define CONSOLE_DEV g_uart1port /* UART1=console */
|
||||||
# define TTYS0_DEV g_uart1port /* UART1=ttyS0 */
|
# define TTYS0_DEV g_uart1port /* UART1=ttyS0 */
|
||||||
# ifdef CONFIG_16550_UART
|
# ifdef CONFIG_16550_UART
|
||||||
# define TTYS1_DEV g_uart0port /* UART1=ttyS0;UART0=ttyS1 */
|
# define TTYS1_DEV g_uart0port /* UART1=ttyS0;UART0=ttyS1 */
|
||||||
# ifdef CONFIG_16550_UART2
|
# ifdef CONFIG_16550_UART2
|
||||||
# define TTYS2_DEV g_uart2port /* UART1=ttyS0;UART0=ttyS1;UART2=ttyS2 */
|
# define TTYS2_DEV g_uart2port /* UART1=ttyS0;UART0=ttyS1;UART2=ttyS2 */
|
||||||
# ifdef CONFIG_16550_UART3
|
# ifdef CONFIG_16550_UART3
|
||||||
# define TTYS3_DEV g_uart3port /* UART1=ttyS0;UART0=ttyS1;UART2=ttyS2;UART3=ttyS3 */
|
# define TTYS3_DEV g_uart3port /* UART1=ttyS0;UART0=ttyS1;UART2=ttyS2;UART3=ttyS3 */
|
||||||
# else
|
# else
|
||||||
# undef TTYS3_DEV /* UART1=ttyS0;UART0=ttyS1;UART2=ttyS;No ttyS3 */
|
# undef TTYS3_DEV /* UART1=ttyS0;UART0=ttyS1;UART2=ttyS;No ttyS3 */
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
# ifdef CONFIG_16550_UART3
|
# ifdef CONFIG_16550_UART3
|
||||||
# define TTYS2_DEV g_uart3port /* UART1=ttyS0;UART0=ttyS1;UART3=ttys2;No ttyS3 */
|
# define TTYS2_DEV g_uart3port /* UART1=ttyS0;UART0=ttyS1;UART3=ttys2;No ttyS3 */
|
||||||
# else
|
# else
|
||||||
# undef TTYS2_DEV /* UART1=ttyS0;UART0=ttyS1;No ttyS2;No ttyS3 */
|
# undef TTYS2_DEV /* UART1=ttyS0;UART0=ttyS1;No ttyS2;No ttyS3 */
|
||||||
# endif
|
# endif
|
||||||
# undef TTYS3_DEV /* No ttyS3 */
|
# undef TTYS3_DEV /* No ttyS3 */
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
# ifdef CONFIG_16550_UART2
|
# ifdef CONFIG_16550_UART2
|
||||||
# define TTYS1_DEV g_uart2port /* UART1=ttyS0;UART2=ttyS1 */
|
# define TTYS1_DEV g_uart2port /* UART1=ttyS0;UART2=ttyS1 */
|
||||||
# ifdef CONFIG_16550_UART3
|
# ifdef CONFIG_16550_UART3
|
||||||
# define TTYS2_DEV g_uart3port /* UART1=ttyS0;UART2=ttyS1;UART3=ttyS2;No ttyS3 */
|
# define TTYS2_DEV g_uart3port /* UART1=ttyS0;UART2=ttyS1;UART3=ttyS2;No ttyS3 */
|
||||||
# else
|
# else
|
||||||
# undef TTYS2_DEV /* UART1=ttyS0;UART2=ttyS1;No ttyS2;No ttyS3 */
|
# undef TTYS2_DEV /* UART1=ttyS0;UART2=ttyS1;No ttyS2;No ttyS3 */
|
||||||
# endif
|
# endif
|
||||||
# undef TTYS3_DEV /* No ttyS3 */
|
# undef TTYS3_DEV /* No ttyS3 */
|
||||||
# else
|
# else
|
||||||
# ifdef CONFIG_16550_UART3
|
# ifdef CONFIG_16550_UART3
|
||||||
# define TTYS1_DEV g_uart3port /* UART1=ttyS0;UART3=ttyS1;No ttyS2;No ttyS3 */
|
# define TTYS1_DEV g_uart3port /* UART1=ttyS0;UART3=ttyS1;No ttyS2;No ttyS3 */
|
||||||
# else
|
# else
|
||||||
# undef TTYS1_DEV /* UART1=ttyS0;No ttyS1;No ttyS2;No ttyS3 */
|
# undef TTYS1_DEV /* UART1=ttyS0;No ttyS1;No ttyS2;No ttyS3 */
|
||||||
# endif
|
# endif
|
||||||
# undef TTYS2_DEV /* No ttyS2 */
|
# undef TTYS2_DEV /* No ttyS2 */
|
||||||
# undef TTYS3_DEV /* No ttyS3 */
|
# undef TTYS3_DEV /* No ttyS3 */
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
#elif defined(CONFIG_UART2_SERIAL_CONSOLE)
|
#elif defined(CONFIG_UART2_SERIAL_CONSOLE)
|
||||||
# define CONSOLE_DEV g_uart2port /* UART2=console */
|
# define CONSOLE_DEV g_uart2port /* UART2=console */
|
||||||
# define TTYS0_DEV g_uart2port /* UART2=ttyS0 */
|
# define TTYS0_DEV g_uart2port /* UART2=ttyS0 */
|
||||||
# ifdef CONFIG_16550_UART
|
# ifdef CONFIG_16550_UART
|
||||||
# define TTYS1_DEV g_uart0port /* UART2=ttyS0;UART0=ttyS1 */
|
# define TTYS1_DEV g_uart0port /* UART2=ttyS0;UART0=ttyS1 */
|
||||||
# ifdef CONFIG_16550_UART1
|
# ifdef CONFIG_16550_UART1
|
||||||
# define TTYS2_DEV g_uart1port /* UART2=ttyS0;UART0=ttyS1;UART1=ttyS2 */
|
# define TTYS2_DEV g_uart1port /* UART2=ttyS0;UART0=ttyS1;UART1=ttyS2 */
|
||||||
# ifdef CONFIG_16550_UART3
|
# ifdef CONFIG_16550_UART3
|
||||||
# define TTYS3_DEV g_uart3port /* UART2=ttyS0;UART0=ttyS1;UART1=ttyS2;UART3=ttyS3 */
|
# define TTYS3_DEV g_uart3port /* UART2=ttyS0;UART0=ttyS1;UART1=ttyS2;UART3=ttyS3 */
|
||||||
# else
|
# else
|
||||||
# undef TTYS3_DEV /* UART2=ttyS0;UART0=ttyS1;UART1=ttyS;No ttyS3 */
|
# undef TTYS3_DEV /* UART2=ttyS0;UART0=ttyS1;UART1=ttyS;No ttyS3 */
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
# ifdef CONFIG_16550_UART3
|
# ifdef CONFIG_16550_UART3
|
||||||
# define TTYS2_DEV g_uart3port /* UART2=ttyS0;UART0=ttyS1;UART3=ttys2;No ttyS3 */
|
# define TTYS2_DEV g_uart3port /* UART2=ttyS0;UART0=ttyS1;UART3=ttys2;No ttyS3 */
|
||||||
# else
|
# else
|
||||||
# undef TTYS2_DEV /* UART2=ttyS0;UART0=ttyS1;No ttyS2;No ttyS3 */
|
# undef TTYS2_DEV /* UART2=ttyS0;UART0=ttyS1;No ttyS2;No ttyS3 */
|
||||||
# endif
|
# endif
|
||||||
# undef TTYS3_DEV /* No ttyS3 */
|
# undef TTYS3_DEV /* No ttyS3 */
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
# ifdef CONFIG_16550_UART1
|
# ifdef CONFIG_16550_UART1
|
||||||
@@ -682,11 +682,11 @@ static int u16550_attach(struct uart_dev_s *dev)
|
|||||||
#ifndef CONFIG_ARCH_NOINTC
|
#ifndef CONFIG_ARCH_NOINTC
|
||||||
if (ret == OK)
|
if (ret == OK)
|
||||||
{
|
{
|
||||||
/* Enable the interrupt (RX and TX interrupts are still disabled
|
/* Enable the interrupt (RX and TX interrupts are still disabled
|
||||||
* in the UART
|
* in the UART
|
||||||
*/
|
*/
|
||||||
|
|
||||||
up_enable_irq(priv->irq);
|
up_enable_irq(priv->irq);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
@@ -776,7 +776,7 @@ static int u16550_interrupt(int irq, void *context)
|
|||||||
* termination conditions
|
* termination conditions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
status = u16550_serialin(priv, UART_IIR_OFFSET);
|
status = u16550_serialin(priv, UART_IIR_OFFSET);
|
||||||
|
|
||||||
/* The UART_IIR_INTSTATUS bit should be zero if there are pending
|
/* The UART_IIR_INTSTATUS bit should be zero if there are pending
|
||||||
* interrupts
|
* interrupts
|
||||||
@@ -843,7 +843,8 @@ static int u16550_interrupt(int irq, void *context)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return OK;
|
|
||||||
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -866,18 +867,18 @@ static int u16550_ioctl(struct file *filep, int cmd, unsigned long arg)
|
|||||||
{
|
{
|
||||||
case TIOCSERGSTRUCT:
|
case TIOCSERGSTRUCT:
|
||||||
{
|
{
|
||||||
struct u16550_s *user = (struct u16550_s*)arg;
|
struct u16550_s *user = (struct u16550_s*)arg;
|
||||||
if (!user)
|
if (!user)
|
||||||
{
|
{
|
||||||
*get_errno_ptr() = EINVAL;
|
set_errno(EINVAL);
|
||||||
ret = ERROR;
|
ret = ERROR;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memcpy(user, dev, sizeof(struct u16550_s));
|
memcpy(user, dev, sizeof(struct u16550_s));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */
|
case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */
|
||||||
{
|
{
|
||||||
@@ -897,7 +898,7 @@ static int u16550_ioctl(struct file *filep, int cmd, unsigned long arg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
*get_errno_ptr() = ENOTTY;
|
set_errno(ENOTTY);
|
||||||
ret = ERROR;
|
ret = ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1008,6 +1009,7 @@ static void u16550_txint(struct uart_dev_s *dev, bool enable)
|
|||||||
priv->ier &= ~UART_IER_ETBEI;
|
priv->ier &= ~UART_IER_ETBEI;
|
||||||
u16550_serialout(priv, UART_IER_OFFSET, priv->ier);
|
u16550_serialout(priv, UART_IER_OFFSET, priv->ier);
|
||||||
}
|
}
|
||||||
|
|
||||||
irqrestore(flags);
|
irqrestore(flags);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user