summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-02-08 17:25:29 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-02-08 17:25:29 +0000
commit4d38c9e58c3e7ffc7647b5729d77c91053bc49f7 (patch)
tree576daf7298d9450ab824fdb9a7626de65cd50d63
parentebff820250129b6361ff9de635578e07d11fe16c (diff)
downloadnuttx-4d38c9e58c3e7ffc7647b5729d77c91053bc49f7.tar.gz
nuttx-4d38c9e58c3e7ffc7647b5729d77c91053bc49f7.tar.bz2
nuttx-4d38c9e58c3e7ffc7647b5729d77c91053bc49f7.zip
Fix DM320 serial configuration problem
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@661 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/ChangeLog4
-rw-r--r--nuttx/Documentation/NuttX.html1
-rw-r--r--nuttx/TODO7
-rw-r--r--nuttx/arch/arm/src/common/up_internal.h10
-rw-r--r--nuttx/arch/arm/src/dm320/dm320_serial.c2
-rw-r--r--nuttx/arch/arm/src/dm320/dm320_uart.h40
-rw-r--r--nuttx/configs/ntosd-dm320/include/board.h13
-rw-r--r--nuttx/drivers/can.c43
-rw-r--r--nuttx/drivers/serial.c119
-rw-r--r--nuttx/include/nuttx/can.h20
-rw-r--r--nuttx/include/nuttx/serial.h32
11 files changed, 168 insertions, 123 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 01606809f..eb1d149b8 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -332,6 +332,4 @@
(see bug 1887170)
* Pascal P-Code runtime now compiles with the SDCC toolchain.
* Added a generic CAN driver. This driver is untested as of this writing.
-
-
-
+ * Corrected DM320 UART configuration problem
diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html
index ef37668cc..4019ce28a 100644
--- a/nuttx/Documentation/NuttX.html
+++ b/nuttx/Documentation/NuttX.html
@@ -990,6 +990,7 @@ nuttx-0.3.8 2008-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
(see bug 1887170)
* Pascal P-Code runtime now compiles with the SDCC toolchain.
* Added a generic CAN driver. This driver is untested as of this writing.
+ * Corrected DM320 UART configuration problem
pascal-0.1.2 2008-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
diff --git a/nuttx/TODO b/nuttx/TODO
index 47b78adaf..418a3a287 100644
--- a/nuttx/TODO
+++ b/nuttx/TODO
@@ -17,7 +17,7 @@ NuttX TODO List (Last updated January 6, 2008)
(0) Applications & Tests (examples/)
(1) ARM (arch/arm/)
(1) ARM/C5471 (arch/arm/src/c5471/)
- (2) ARM/DM320 (arch/arm/src/dm320/)
+ (1) ARM/DM320 (arch/arm/src/dm320/)
(2) ARM/LPC214x (arch/arm/src/lpc214x/)
(4) pjrc-8052 / MCS51 (arch/pjrc-8051/)
(2) z80 (arch/z80/)
@@ -304,11 +304,6 @@ o ARM/DM320 (arch/arm/src/dm320/)
Status: Open
Priority: Medium
- Description: UART re-configuration is untested and conditionally compiled out.
- Status: Open
- Priority: Medium. ttyS1 is not configured, but not used; ttyS0 is configured
- by the bootloader
-
o ARM/LPC214x (arch/arm/src/lpc214x/)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/nuttx/arch/arm/src/common/up_internal.h b/nuttx/arch/arm/src/common/up_internal.h
index 4d84f2cdd..182e6058c 100644
--- a/nuttx/arch/arm/src/common/up_internal.h
+++ b/nuttx/arch/arm/src/common/up_internal.h
@@ -49,11 +49,11 @@
* board bring-up and not part of normal platform configuration.
*/
-#undef CONFIG_SUPPRESS_INTERRUPTS /* Do not enable interrupts */
-#undef CONFIG_SUPPRESS_TIMER_INTS /* No timer */
-#undef CONFIG_SUPPRESS_SERIAL_INTS /* Console will poll */
-#define CONFIG_SUPPRESS_UART_CONFIG 1 /* Do not reconfig UART */
-#undef CONFIG_DUMP_ON_EXIT /* Dump task state on exit */
+#undef CONFIG_SUPPRESS_INTERRUPTS /* DEFINED: Do not enable interrupts */
+#undef CONFIG_SUPPRESS_TIMER_INTS /* DEFINED: No timer */
+#undef CONFIG_SUPPRESS_SERIAL_INTS /* DEFINED: Console will poll */
+#undef CONFIG_SUPPRESS_UART_CONFIG /* DEFINED: Do not reconfig UART */
+#undef CONFIG_DUMP_ON_EXIT /* DEFINED: Dump task state on exit */
/****************************************************************************
* Public Types
diff --git a/nuttx/arch/arm/src/dm320/dm320_serial.c b/nuttx/arch/arm/src/dm320/dm320_serial.c
index be32d269b..7018f7b41 100644
--- a/nuttx/arch/arm/src/dm320/dm320_serial.c
+++ b/nuttx/arch/arm/src/dm320/dm320_serial.c
@@ -379,7 +379,7 @@ static int up_setup(struct uart_dev_s *dev)
/* Setup the new UART configuration */
- up_serialout(priv,UART_MSR, priv->msr);
+ up_serialout(priv, UART_MSR, priv->msr);
up_serialout(priv, UART_BRSR, brsr);
up_enablebreaks(priv, FALSE);
#endif
diff --git a/nuttx/arch/arm/src/dm320/dm320_uart.h b/nuttx/arch/arm/src/dm320/dm320_uart.h
index 8938018a7..0c5d803be 100644
--- a/nuttx/arch/arm/src/dm320/dm320_uart.h
+++ b/nuttx/arch/arm/src/dm320/dm320_uart.h
@@ -70,24 +70,28 @@
#define UART_DTRR_DTR_MASK 0x00ff /* Data transmit/receive */
/* UART BRSR register bit definitions */
-/* The UART clock is half of the ARM clock */
-
-#define UART_CLK (DM320_ARM_CLOCK / 2)
-
-/* And baud rate = UART_CLK / 16 / (VALUE+1) */
-
-#define UART_BAUD_2400 ((uint16)(((UART_CLK / 16) / 2400 ) - 1))
-#define UART_BAUD_4800 ((uint16)(((UART_CLK / 16) / 4800 ) - 1))
-#define UART_BAUD_9600 ((uint16)(((UART_CLK / 16) / 9600 ) - 1))
-#define UART_BAUD_14400 ((uint16)(((UART_CLK / 16) / 14400 ) - 1))
-#define UART_BAUD_19200 ((uint16)(((UART_CLK / 16) / 19200 ) - 1))
-#define UART_BAUD_28800 ((uint16)(((UART_CLK / 16) / 28800 ) - 1))
-#define UART_BAUD_38400 ((uint16)(((UART_CLK / 16) / 38400 ) - 1))
-#define UART_BAUD_57600 ((uint16)(((UART_CLK / 16) / 57600 ) - 1))
-#define UART_BAUD_115200 ((uint16)(((UART_CLK / 16) / 115200) - 1))
-#define UART_BAUD_230400 ((uint16)(((UART_CLK / 16) / 230400) - 1))
-#define UART_BAUD_460800 ((uint16)(((UART_CLK / 16) / 460800) - 1))
-#define UART_BAUD_921600 ((uint16)(((UART_CLK / 16) / 921600) - 1))
+/* The UART module is clocked by either the AHB clock or PLLIN / 16 */
+
+#ifdef CONFIG_DM320_UARTPPLIN
+# define UART_REFCLK (27000000 / 16)
+#else
+# define UART_REFCLK (DM320_AHB_CLOCK / 16)
+#endif
+
+/* And baud = UART_REFCLK / (brsr+1) */
+
+#define UART_BAUD_2400 ((uint16)((UART_REFCLK / 2400 ) - 1))
+#define UART_BAUD_4800 ((uint16)((UART_REFCLK / 4800 ) - 1))
+#define UART_BAUD_9600 ((uint16)((UART_REFCLK / 9600 ) - 1))
+#define UART_BAUD_14400 ((uint16)((UART_REFCLK / 14400 ) - 1))
+#define UART_BAUD_19200 ((uint16)((UART_REFCLK / 19200 ) - 1))
+#define UART_BAUD_28800 ((uint16)((UART_REFCLK / 28800 ) - 1))
+#define UART_BAUD_38400 ((uint16)((UART_REFCLK / 38400 ) - 1))
+#define UART_BAUD_57600 ((uint16)((UART_REFCLK / 57600 ) - 1))
+#define UART_BAUD_115200 ((uint16)((UART_REFCLK / 115200) - 1))
+#define UART_BAUD_230400 ((uint16)((UART_REFCLK / 230400) - 1))
+#define UART_BAUD_460800 ((uint16)((UART_REFCLK / 460800) - 1))
+#define UART_BAUD_921600 ((uint16)((UART_REFCLK / 921600) - 1))
/* UART MSR register bit definitions */
diff --git a/nuttx/configs/ntosd-dm320/include/board.h b/nuttx/configs/ntosd-dm320/include/board.h
index 646349075..e4a9befe8 100644
--- a/nuttx/configs/ntosd-dm320/include/board.h
+++ b/nuttx/configs/ntosd-dm320/include/board.h
@@ -1,7 +1,7 @@
/************************************************************************************
* arch/board/board.h
*
- * Copyright (C) 2007 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name Gregory Nutt nor the names of its contributors may be
+ * 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -56,9 +56,12 @@
#define DM320_AXL_CLOCK 175500000
#define DM320_AHB_CLOCK 87750000
-/*
- * configration for dm9000 network device
- */
+/* UART0/1 and TIMER0/1 are clocked by PLLIN=27MHz */
+
+#define CONFIG_DM320_UARTPPLIN 1
+
+/* Configration for dm9000 network device */
+
#define DM9000_BASE CONFIG_DM9000_BASE
/* GIO keyboard (GIO 1-5) */
diff --git a/nuttx/drivers/can.c b/nuttx/drivers/can.c
index 84db1eacf..e463b4e32 100644
--- a/nuttx/drivers/can.c
+++ b/nuttx/drivers/can.c
@@ -106,6 +106,7 @@ static int can_open(FAR struct file *filep)
{
FAR struct inode *inode = filep->f_inode;
FAR struct can_dev_s *dev = inode->i_private;
+ ubyte tmp;
int ret = OK;
/* If the port is the middle of closing, wait until the close is finished */
@@ -121,29 +122,43 @@ static int can_open(FAR struct file *filep)
* the device.
*/
- if (++dev->cd_ocount == 1)
+ tmp = dev->cd_ocount + 1;
+ if (tmp == 0)
{
- irqstate_t flags = irqsave();
+ /* More than 255 opens; ubyte overflows to zero */
- /* Configure hardware interrupts */
+ ret = -EMFILE;
+ }
+ else
+ {
+ /* Check if this is the first time that the driver has been opened. */
- ret = dev_setup(dev);
- if (ret == OK)
+ if (tmp == 1)
{
- /* Mark the FIFOs empty */
+ /* Yes.. perform one time hardware initialization. */
- dev->cd_xmit.cf_head = 0;
- dev->cd_xmit.cf_tail = 0;
- dev->cd_recv.cf_head = 0;
- dev->cd_recv.cf_tail = 0;
+ irqstate_t flags = irqsave();
+ ret = dev_setup(dev);
+ if (ret == OK)
+ {
+ /* Mark the FIFOs empty */
+
+ dev->cd_xmit.cf_head = 0;
+ dev->cd_xmit.cf_tail = 0;
+ dev->cd_recv.cf_head = 0;
+ dev->cd_recv.cf_tail = 0;
- /* Finally, Enable CAN interrupt */
+ /* Finally, Enable the CAN RX interrupt */
- dev_rxint(dev, TRUE);
+ dev_rxint(dev, TRUE);
+
+ /* Save the new open count on success */
+
+ dev->cd_ocount = tmp;
+ }
+ irqrestore(flags);
}
- irqrestore(flags);
}
-
sem_post(&dev->cd_closesem);
}
return ret;
diff --git a/nuttx/drivers/serial.c b/nuttx/drivers/serial.c
index bc360d74a..9f26632ee 100644
--- a/nuttx/drivers/serial.c
+++ b/nuttx/drivers/serial.c
@@ -67,11 +67,11 @@
* Private Function Prototypes
************************************************************************************/
-static int uart_open(struct file *filep);
-static int uart_close(struct file *filep);
-static ssize_t uart_read(struct file *filep, char *buffer, size_t buflen);
-static ssize_t uart_write(struct file *filep, const char *buffer, size_t buflen);
-static int uart_ioctl(struct file *filep, int cmd, unsigned long arg);
+static int uart_open(FAR struct file *filep);
+static int uart_close(FAR struct file *filep);
+static ssize_t uart_read(FAR struct file *filep, FAR char *buffer, size_t buflen);
+static ssize_t uart_write(FAR struct file *filep, FAR const char *buffer, size_t buflen);
+static int uart_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
/************************************************************************************
* Private Variables
@@ -95,7 +95,7 @@ struct file_operations g_serialops =
* Name: uart_takesem
************************************************************************************/
-static void uart_takesem(sem_t *sem)
+static void uart_takesem(FAR sem_t *sem)
{
while (sem_wait(sem) != 0)
{
@@ -111,7 +111,7 @@ static void uart_takesem(sem_t *sem)
* Name: uart_givesem
************************************************************************************/
-static inline void uart_givesem(sem_t *sem)
+static inline void uart_givesem(FAR sem_t *sem)
{
(void)sem_post(sem);
}
@@ -120,7 +120,7 @@ static inline void uart_givesem(sem_t *sem)
* Name: uart_putxmitchar
************************************************************************************/
-static void uart_putxmitchar(uart_dev_t *dev, int ch)
+static void uart_putxmitchar(FAR uart_dev_t *dev, int ch)
{
int nexthead = dev->xmit.head + 1;
if (nexthead >= dev->xmit.size)
@@ -159,7 +159,7 @@ static void uart_putxmitchar(uart_dev_t *dev, int ch)
* Name: uart_irqwrite
************************************************************************************/
-static ssize_t uart_irqwrite(uart_dev_t *dev, const char *buffer, size_t buflen)
+static ssize_t uart_irqwrite(FAR uart_dev_t *dev, FAR const char *buffer, size_t buflen)
{
ssize_t ret = buflen;
@@ -185,11 +185,11 @@ static ssize_t uart_irqwrite(uart_dev_t *dev, const char *buffer, size_t buflen)
* Name: uart_write
************************************************************************************/
-static ssize_t uart_write(struct file *filep, const char *buffer, size_t buflen)
+static ssize_t uart_write(FAR struct file *filep, FAR const char *buffer, size_t buflen)
{
- struct inode *inode = filep->f_inode;
- uart_dev_t *dev = inode->i_private;
- ssize_t ret = buflen;
+ FAR struct inode *inode = filep->f_inode;
+ FAR uart_dev_t *dev = inode->i_private;
+ ssize_t ret = buflen;
/* We may receive console writes through this path from
* interrupt handlers and from debug output in the IDLE task!
@@ -251,11 +251,11 @@ static ssize_t uart_write(struct file *filep, const char *buffer, size_t buflen)
* Name: uart_read
************************************************************************************/
-static ssize_t uart_read(struct file *filep, char *buffer, size_t buflen)
+static ssize_t uart_read(FAR struct file *filep, FAR char *buffer, size_t buflen)
{
- struct inode *inode = filep->f_inode;
- uart_dev_t *dev = inode->i_private;
- ssize_t ret = buflen;
+ FAR struct inode *inode = filep->f_inode;
+ FAR uart_dev_t *dev = inode->i_private;
+ ssize_t ret = buflen;
/* Only one user can be accessing dev->recv.tail at once */
@@ -301,10 +301,10 @@ static ssize_t uart_read(struct file *filep, char *buffer, size_t buflen)
* Name: uart_ioctl
************************************************************************************/
-static int uart_ioctl(struct file *filep, int cmd, unsigned long arg)
+static int uart_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
{
- struct inode *inode = filep->f_inode;
- uart_dev_t *dev = inode->i_private;
+ FAR struct inode *inode = filep->f_inode;
+ FAR uart_dev_t *dev = inode->i_private;
return dev->ops->ioctl(filep, cmd, arg);
}
@@ -318,11 +318,11 @@ static int uart_ioctl(struct file *filep, int cmd, unsigned long arg)
*
************************************************************************************/
-static int uart_close(struct file *filep)
+static int uart_close(FAR struct file *filep)
{
- struct inode *inode = filep->f_inode;
- uart_dev_t *dev = inode->i_private;
- irqstate_t flags;
+ FAR struct inode *inode = filep->f_inode;
+ FAR uart_dev_t *dev = inode->i_private;
+ irqstate_t flags;
uart_takesem(&dev->closesem);
if (dev->open_count > 1)
@@ -384,10 +384,11 @@ static int uart_close(struct file *filep)
*
************************************************************************************/
-static int uart_open(struct file *filep)
+static int uart_open(FAR struct file *filep)
{
struct inode *inode = filep->f_inode;
uart_dev_t *dev = inode->i_private;
+ ubyte tmp;
int ret = OK;
/* If the port is the middle of closing, wait until the close is finished */
@@ -395,39 +396,59 @@ static int uart_open(struct file *filep)
uart_takesem(&dev->closesem);
/* Start up serial port */
+ /* Increment the count of references to the device. */
- if (++dev->open_count == 1)
+ tmp = dev->open_count + 1;
+ if (tmp == 0)
{
- irqstate_t flags = irqsave();
+ /* More than 255 opens; ubyte overflows to zero */
- /* If this is the console, then the UART has already been initialized. */
+ ret = -EMFILE;
+ }
+ else
+ {
+ /* Check if this is the first time that the driver has been opened. */
- if (!dev->isconsole)
+ if (tmp == 1)
{
- uart_setup(dev);
- }
+ irqstate_t flags = irqsave();
- /* In any event, we do have to configure for interrupt driven mode of
- * operation. Attach the hardware IRQ(s)
- */
+ /* If this is the console, then the UART has already been initialized. */
- ret = uart_attach(dev);
- if (ret == OK)
- {
- /* Mark the io buffers empty */
+ if (!dev->isconsole)
+ {
+ /* Perform one time hardware initialization */
- dev->xmit.head = 0;
- dev->xmit.tail = 0;
- dev->recv.head = 0;
- dev->recv.tail = 0;
+ uart_setup(dev);
+ }
- /* Finally, enable the RX interrupt */
+ /* In any event, we do have to configure for interrupt driven mode of
+ * operation. Attach the hardware IRQ(s). Hmm.. should shutdown() the
+ * the device in the rare case that uart_attach() fails, tmp==1, and
+ * this is not the console.
+ */
- uart_enablerxint(dev);
+ ret = uart_attach(dev);
+ if (ret == OK)
+ {
+ /* Mark the io buffers empty */
+
+ dev->xmit.head = 0;
+ dev->xmit.tail = 0;
+ dev->recv.head = 0;
+ dev->recv.tail = 0;
+
+ /* Enable the RX interrupt */
+
+ uart_enablerxint(dev);
+
+ /* Save the new open count on success */
+
+ dev->open_count = tmp;
+ }
+ irqrestore(flags);
}
- irqrestore(flags);
}
-
uart_givesem(&dev->closesem);
return ret;
}
@@ -444,7 +465,7 @@ static int uart_open(struct file *filep)
*
************************************************************************************/
-int uart_register(const char *path, uart_dev_t *dev)
+int uart_register(FAR const char *path, FAR uart_dev_t *dev)
{
sem_init(&dev->xmit.sem, 0, 1);
sem_init(&dev->recv.sem, 0, 1);
@@ -467,7 +488,7 @@ int uart_register(const char *path, uart_dev_t *dev)
*
************************************************************************************/
-void uart_xmitchars(uart_dev_t *dev)
+void uart_xmitchars(FAR uart_dev_t *dev)
{
/* Send while we still have data & room in the fifo */
@@ -508,7 +529,7 @@ void uart_xmitchars(uart_dev_t *dev)
*
************************************************************************************/
-void uart_recvchars(uart_dev_t *dev)
+void uart_recvchars(FAR uart_dev_t *dev)
{
unsigned int status;
int nexthead = dev->recv.head + 1;
diff --git a/nuttx/include/nuttx/can.h b/nuttx/include/nuttx/can.h
index 14e36318e..23d251435 100644
--- a/nuttx/include/nuttx/can.h
+++ b/nuttx/include/nuttx/can.h
@@ -49,14 +49,22 @@
* Definitions
************************************************************************************/
-/* Default configuration settings that may be overridden in the board configuration file */
+/* Default configuration settings that may be overridden in the board configuration.
+ * file. The configured size is limited to 255 to fit into a ubyte.
+ */
-#ifndef CONFIG_CAN_FIFOSIZE
+#if !defined(CONFIG_CAN_FIFOSIZE)
# define CONFIG_CAN_FIFOSIZE 8
+#elif CONFIG_CAN_FIFOSIZE > 255
+# undef CONFIG_CAN_FIFOSIZE
+# define CONFIG_CAN_FIFOSIZE 255
#endif
-#ifndef CONFIG_CAN_NPENDINGRTR
+#if !defined(CONFIG_CAN_NPENDINGRTR)
# define CONFIG_CAN_NPENDINGRTR 4
+#elif CONFIG_CAN_NPENDINGRTR > 255
+# undef CONFIG_CAN_NPENDINGRTR
+# define CONFIG_CAN_NPENDINGRTR 255
#endif
/* Convenience macros */
@@ -206,8 +214,8 @@ struct can_ops_s
struct can_dev_s
{
- int cd_ocount; /* The number of times the device has been opened */
- int cd_npendrtr; /* Number of pending RTR messages */
+ ubyte cd_ocount; /* The number of times the device has been opened */
+ ubyte cd_npendrtr; /* Number of pending RTR messages */
sem_t cd_closesem; /* Locks out new opens while close is in progress */
sem_t cd_recvsem; /* Used to wakeup user waiting for space in cd_recv.buffer */
struct can_fifo_s cd_xmit; /* Describes transmit FIFO */
@@ -222,7 +230,7 @@ struct can_dev_s
struct canioctl_rtr_s
{
- uint16 ci_id; /* The ID to use in the RTR message */
+ uint16 ci_id; /* The 11-bit ID to use in the RTR message */
FAR struct can_msg_s *ci_msg; /* The location to return the RTR response */
};
diff --git a/nuttx/include/nuttx/serial.h b/nuttx/include/nuttx/serial.h
index a17713616..3d2bfb34d 100644
--- a/nuttx/include/nuttx/serial.h
+++ b/nuttx/include/nuttx/serial.h
@@ -97,14 +97,14 @@ struct uart_ops_s
* performed when the attach() method is called.
*/
- int (*setup)(struct uart_dev_s *dev);
+ CODE int (*setup)(FAR struct uart_dev_s *dev);
/* Disable the UART. This method is called when the serial port is closed.
* This method reverses the operation the setup method. NOTE that the serial
* console is never shutdown.
*/
- void (*shutdown)(struct uart_dev_s *dev);
+ CODE void (*shutdown)(FAR struct uart_dev_s *dev);
/* Configure the UART to operation in interrupt driven mode. This method is
* called when the serial port is opened. Normally, this is just after the
@@ -116,47 +116,47 @@ struct uart_ops_s
* interrupts are not enabled until the txint() and rxint() methods are called.
*/
- int (*attach)(struct uart_dev_s *dev);
+ CODE int (*attach)(FAR struct uart_dev_s *dev);
/* Detach UART interrupts. This method is called when the serial port is
* closed normally just before the shutdown method is called. The exception is
* the serial console which is never shutdown.
*/
- void (*detach)(struct uart_dev_s *dev);
+ CODE void (*detach)(FAR struct uart_dev_s *dev);
/* All ioctl calls will be routed through this method */
- int (*ioctl)(struct file *filep, int cmd, unsigned long arg);
+ CODE int (*ioctl)(FAR struct file *filep, int cmd, unsigned long arg);
/* Called (usually) from the interrupt level to receive one character from
* the UART. Error bits associated with the receipt are provided in the
* the return 'status'.
*/
- int (*receive)(struct uart_dev_s *dev, unsigned int *status);
+ CODE int (*receive)(FAR struct uart_dev_s *dev, unsigned int *status);
/* Call to enable or disable RX interrupts */
- void (*rxint)(struct uart_dev_s *dev, boolean enable);
+ CODE void (*rxint)(FAR struct uart_dev_s *dev, boolean enable);
/* Return TRUE if the receive data is available */
- boolean (*rxavailable)(struct uart_dev_s *dev);
+ CODE boolean (*rxavailable)(FAR struct uart_dev_s *dev);
/* This method will send one byte on the UART */
- void (*send)(struct uart_dev_s *dev, int ch);
+ CODE void (*send)(FAR struct uart_dev_s *dev, int ch);
/* Call to enable or disable TX interrupts */
- void (*txint)(struct uart_dev_s *dev, boolean enable);
+ CODE void (*txint)(FAR struct uart_dev_s *dev, boolean enable);
/* Return TRUE if the tranmsit hardware is ready to send another byte. This
* is used to determine if send() method can be called.
*/
- boolean (*txready)(struct uart_dev_s *dev);
+ CODE boolean (*txready)(FAR struct uart_dev_s *dev);
/* Return TRUE if all characters have been sent. If for example, the UART
* hardware implements FIFOs, then this would mean the the transmit FIFO is
@@ -164,7 +164,7 @@ struct uart_ops_s
* all characters are "drained" from the TX hardware.
*/
- boolean (*txempty)(struct uart_dev_s *dev);
+ CODE boolean (*txempty)(FAR struct uart_dev_s *dev);
};
/* This is the device structure used by the driver. The caller of
@@ -179,7 +179,7 @@ struct uart_ops_s
struct uart_dev_s
{
- int open_count; /* The number of times
+ ubyte open_count; /* The number of times
* the device has been opened */
boolean xmitwaiting; /* TRUE: User is waiting
* for space in xmit.buffer */
@@ -223,7 +223,7 @@ extern "C" {
*
************************************************************************************/
-EXTERN int uart_register(const char *path, uart_dev_t *dev);
+EXTERN int uart_register(FAR const char *path, FAR uart_dev_t *dev);
/************************************************************************************
* Name: uart_xmitchars
@@ -236,7 +236,7 @@ EXTERN int uart_register(const char *path, uart_dev_t *dev);
*
************************************************************************************/
-EXTERN void uart_xmitchars(uart_dev_t *dev);
+EXTERN void uart_xmitchars(FAR uart_dev_t *dev);
/************************************************************************************
* Name: uart_receivechars
@@ -249,7 +249,7 @@ EXTERN void uart_xmitchars(uart_dev_t *dev);
*
************************************************************************************/
-EXTERN void uart_recvchars(uart_dev_t *dev);
+EXTERN void uart_recvchars(FAR uart_dev_t *dev);
#undef EXTERN
#if defined(__cplusplus)