summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-01-28 22:03:49 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-01-28 22:03:49 +0000
commita7fffa54ed01e92f3797af5707add81d8c9358cf (patch)
tree18e317106c391d9dd874559d38993d17d100f401
parent6db7527fa05112bad73b91e57d647d52caf3809a (diff)
downloadpx4-nuttx-a7fffa54ed01e92f3797af5707add81d8c9358cf.tar.gz
px4-nuttx-a7fffa54ed01e92f3797af5707add81d8c9358cf.tar.bz2
px4-nuttx-a7fffa54ed01e92f3797af5707add81d8c9358cf.zip
Basic Z16F serial driver functionality
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@577 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/arch/arm/src/c5471/c5471_serial.c2
-rw-r--r--nuttx/arch/arm/src/dm320/dm320_serial.c2
-rw-r--r--nuttx/arch/c5471/src/up_serial.c2
-rw-r--r--nuttx/arch/dm320/src/up_serial.c2
-rw-r--r--nuttx/arch/z16/src/z16f/chip.h12
-rwxr-xr-xnuttx/arch/z16/src/z16f/z16f_head.S7
-rw-r--r--nuttx/arch/z16/src/z16f/z16f_serial.c2
-rw-r--r--nuttx/drivers/serial.c2
-rw-r--r--nuttx/include/nuttx/fs.h36
-rw-r--r--nuttx/include/nuttx/serial.h6
10 files changed, 38 insertions, 35 deletions
diff --git a/nuttx/arch/arm/src/c5471/c5471_serial.c b/nuttx/arch/arm/src/c5471/c5471_serial.c
index 22ce3c063..9ff5b5be9 100644
--- a/nuttx/arch/arm/src/c5471/c5471_serial.c
+++ b/nuttx/arch/arm/src/c5471/c5471_serial.c
@@ -355,7 +355,7 @@ static inline void up_setrate(struct up_dev_s *priv, unsigned int rate)
static int up_setup(struct uart_dev_s *dev)
{
-#ifdef CONFIG_SUPPRESS_UART_CONFIG
+#ifndef CONFIG_SUPPRESS_UART_CONFIG
struct up_dev_s *priv = dev->priv;
unsigned int cval;
diff --git a/nuttx/arch/arm/src/dm320/dm320_serial.c b/nuttx/arch/arm/src/dm320/dm320_serial.c
index 2eea71dd0..4f90fd5d3 100644
--- a/nuttx/arch/arm/src/dm320/dm320_serial.c
+++ b/nuttx/arch/arm/src/dm320/dm320_serial.c
@@ -286,7 +286,7 @@ static inline void up_enablebreaks(struct up_dev_s *priv, boolean enable)
static int up_setup(struct uart_dev_s *dev)
{
-#ifdef CONFIG_SUPPRESS_UART_CONFIG
+#ifndef CONFIG_SUPPRESS_UART_CONFIG
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
uint16 brsr;
diff --git a/nuttx/arch/c5471/src/up_serial.c b/nuttx/arch/c5471/src/up_serial.c
index 6a069164d..3cba4a2d8 100644
--- a/nuttx/arch/c5471/src/up_serial.c
+++ b/nuttx/arch/c5471/src/up_serial.c
@@ -352,7 +352,7 @@ static inline void up_setrate(struct up_dev_s *priv, unsigned int rate)
static int up_setup(struct uart_dev_s *dev)
{
-#ifdef CONFIG_SUPPRESS_UART_CONFIG
+#ifndef CONFIG_SUPPRESS_UART_CONFIG
struct up_dev_s *priv = dev->priv;
unsigned int cval;
diff --git a/nuttx/arch/dm320/src/up_serial.c b/nuttx/arch/dm320/src/up_serial.c
index c952c159f..3d7c09837 100644
--- a/nuttx/arch/dm320/src/up_serial.c
+++ b/nuttx/arch/dm320/src/up_serial.c
@@ -281,7 +281,7 @@ static inline void up_enablebreaks(struct up_dev_s *priv, boolean enable)
static int up_setup(struct uart_dev_s *dev)
{
-#ifdef CONFIG_SUPPRESS_UART_CONFIG
+#ifndef CONFIG_SUPPRESS_UART_CONFIG
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
uint16 brsr;
diff --git a/nuttx/arch/z16/src/z16f/chip.h b/nuttx/arch/z16/src/z16f/chip.h
index bcfff9279..f43a65392 100644
--- a/nuttx/arch/z16/src/z16f/chip.h
+++ b/nuttx/arch/z16/src/z16f/chip.h
@@ -517,12 +517,12 @@
/* Register access macros ***********************************************************/
#ifndef __ASSEMBLY__
-# define getreg8(a) (*(ubyte volatile _Near*)((a) & 0xffff))
-# define putreg8(v,a) (*(ubyte volatile _Near*)((a) & 0xffff) = (v))
-# define getreg16(a) (*(uint16 volatile _Near*)((a) & 0xffff))
-# define putreg16(v,a) (*(uint16 volatile _Near*)((a) & 0xffff) = (v))
-# define getreg32(a) (*(uint32 volatile _Near*)((a) & 0xffff))
-# define putreg32(v,a) (*(uint32 volatile _Near*)((a) & 0xffff) = (v))
+# define getreg8(a) (*(ubyte volatile _Near*)(a))
+# define putreg8(v,a) (*(ubyte volatile _Near*)(a) = (v))
+# define getreg16(a) (*(uint16 volatile _Near*)(a))
+# define putreg16(v,a) (*(uint16 volatile _Near*)(a) = (v))
+# define getreg32(a) (*(uint32 volatile _Near*)(a))
+# define putreg32(v,a) (*(uint32 volatile _Near*)(a) = (v))
#endif /* __ASSEMBLY__ */
/************************************************************************************
diff --git a/nuttx/arch/z16/src/z16f/z16f_head.S b/nuttx/arch/z16/src/z16f/z16f_head.S
index 7e0682e76..f6108c250 100755
--- a/nuttx/arch/z16/src/z16f/z16f_head.S
+++ b/nuttx/arch/z16/src/z16f/z16f_head.S
@@ -50,14 +50,11 @@
#ifdef CONFIG_ARCH_LEDS
xref _up_ledinit:EROM
#endif
-#if defined(CONFIG_DEV_CONSOLE) && CONFIG_NFILE_DESCRIPTORS > 0
- xref _up_earlyserialinit:EROM
-#endif
-#if defined(CONFIG_ARCH_LOWPUTC) || defined(CONFIG_ARCH_LOWGETC)
+#if defined(CONFIG_ARCH_LOWPUTC) || defined(CONFIG_ARCH_LOWGETC) || CONFIG_NFILE_DESCRIPTORS == 0
xref _z16f_lowuartinit:EROM
#endif
#if defined(CONFIG_DEV_CONSOLE) && CONFIG_NFILE_DESCRIPTORS > 0
- xref up_earlyserialinit:EROM
+ xref _up_earlyserialinit:EROM
#endif
xref _os_start:EROM
xref _up_doirq:EROM
diff --git a/nuttx/arch/z16/src/z16f/z16f_serial.c b/nuttx/arch/z16/src/z16f/z16f_serial.c
index fb92919b1..63f40f62a 100644
--- a/nuttx/arch/z16/src/z16f/z16f_serial.c
+++ b/nuttx/arch/z16/src/z16f/z16f_serial.c
@@ -298,7 +298,7 @@ static void z16f_waittx(struct uart_dev_s *dev, boolean (*status)(struct uart_de
static int z16f_setup(struct uart_dev_s *dev)
{
-#ifdef CONFIG_SUPPRESS_UART_CONFIG
+#ifndef CONFIG_SUPPRESS_UART_CONFIG
struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv;
uint32 brg;
ubyte ctl0;
diff --git a/nuttx/drivers/serial.c b/nuttx/drivers/serial.c
index 3d805e7a2..153ee431d 100644
--- a/nuttx/drivers/serial.c
+++ b/nuttx/drivers/serial.c
@@ -379,7 +379,7 @@ static int uart_close(struct file *filep)
static int uart_open(struct file *filep)
{
struct inode *inode = filep->f_inode;
- uart_dev_t *dev = inode->i_private;
+ uart_dev_t *dev = inode->i_private;
int ret = OK;
/* If the port is the middle of closing, wait until the close is finished */
diff --git a/nuttx/include/nuttx/fs.h b/nuttx/include/nuttx/fs.h
index 73c509629..111f47218 100644
--- a/nuttx/include/nuttx/fs.h
+++ b/nuttx/include/nuttx/fs.h
@@ -177,27 +177,33 @@ struct mountpt_operations
};
#endif /* CONFIG_DISABLE_MOUNTPOUNT */
-/* This structure represents one inode in the Nuttx psuedo-file system */
+/* These are the various kinds of operations that can be associated with
+ * an inode.
+ */
-struct inode
+union inode_ops_u
{
- FAR struct inode *i_peer; /* Pointer to same level inode */
- FAR struct inode *i_child; /* Pointer to lower level inode */
- sint16 i_crefs; /* References to inode */
- uint16 i_flags; /* flags for inode */
- union
- {
- const struct file_operations *i_ops; /* Driver operations for inode */
+ FAR const struct file_operations *i_ops; /* Driver operations for inode */
#ifndef CONFIG_DISABLE_MOUNTPOUNT
- const struct block_operations *i_bops; /* Block driver operations */
- const struct mountpt_operations *i_mops; /* Operations on a mountpoint */
+ FAR const struct block_operations *i_bops; /* Block driver operations */
+ FAR const struct mountpt_operations *i_mops; /* Operations on a mountpoint */
#endif
- } u;
+};
+
+/* This structure represents one inode in the Nuttx psuedo-file system */
+
+struct inode
+{
+ FAR struct inode *i_peer; /* Pointer to same level inode */
+ FAR struct inode *i_child; /* Pointer to lower level inode */
+ sint16 i_crefs; /* References to inode */
+ uint16 i_flags; /* Flags for inode */
+ union inode_ops_u u; /* Inode operations */
#ifdef CONFIG_FILE_MODE
- mode_t i_mode; /* Access mode flags */
+ mode_t i_mode; /* Access mode flags */
#endif
- FAR void *i_private; /* Per inode driver private data */
- char i_name[1]; /* Name of inode (variable) */
+ FAR void *i_private; /* Per inode driver private data */
+ char i_name[1]; /* Name of inode (variable) */
};
#define FSNODE_SIZE(n) (sizeof(struct inode) + (n))
diff --git a/nuttx/include/nuttx/serial.h b/nuttx/include/nuttx/serial.h
index 46da7800c..7741b9983 100644
--- a/nuttx/include/nuttx/serial.h
+++ b/nuttx/include/nuttx/serial.h
@@ -180,7 +180,7 @@ struct uart_ops_s
struct uart_dev_s
{
int open_count; /* The number of times
- * the device has been opened */
+ * the device has been opened */
boolean xmitwaiting; /* TRUE: User is waiting
* for space in xmit.buffer */
boolean recvwaiting; /* TRUE: User is waiting
@@ -194,8 +194,8 @@ struct uart_dev_s
* for sapce in recv.buffer */
struct uart_buffer_s xmit; /* Describes transmit buffer */
struct uart_buffer_s recv; /* Describes receive buffer */
- const struct uart_ops_s *ops; /* Arch-specifics operations */
- void *priv; /* Used by the arch-specific logic */
+ FAR const struct uart_ops_s *ops; /* Arch-specific operations */
+ FAR void *priv; /* Used by the arch-specific logic */
};
typedef struct uart_dev_s uart_dev_t;