Basic Z16F serial driver functionality

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@577 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2008-01-28 22:03:49 +00:00
parent 4b07e6ffa4
commit 16aff5292e
10 changed files with 38 additions and 35 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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__ */
/************************************************************************************

View File

@ -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

View File

@ -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;

View File

@ -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 */

View File

@ -177,27 +177,33 @@ struct mountpt_operations
};
#endif /* CONFIG_DISABLE_MOUNTPOUNT */
/* These are the various kinds of operations that can be associated with
* an inode.
*/
union inode_ops_u
{
FAR const struct file_operations *i_ops; /* Driver operations for inode */
#ifndef CONFIG_DISABLE_MOUNTPOUNT
FAR const struct block_operations *i_bops; /* Block driver operations */
FAR const struct mountpt_operations *i_mops; /* Operations on a mountpoint */
#endif
};
/* 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
{
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 */
#endif
} 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 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))

View File

@ -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;