OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [asm-m68k/] [serial.h] - Diff between revs 1633 and 1765

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 1633 Rev 1765
/*
/*
 * include/linux/serial.h
 * include/linux/serial.h
 *
 *
 * Copyright (C) 1992 by Theodore Ts'o.
 * Copyright (C) 1992 by Theodore Ts'o.
 *
 *
 * Redistribution of this file is permitted under the terms of the GNU
 * Redistribution of this file is permitted under the terms of the GNU
 * Public License (GPL)
 * Public License (GPL)
 */
 */
 
 
#ifndef _M68K_SERIAL_H
#ifndef _M68K_SERIAL_H
#define _M68K_SERIAL_H
#define _M68K_SERIAL_H
 
 
 
 
/* m68k serial port types are numbered from 100 to avoid interference
/* m68k serial port types are numbered from 100 to avoid interference
 * with the PC types (1..4)
 * with the PC types (1..4)
 */
 */
#define PORT_UNKNOWN    0
#define PORT_UNKNOWN    0
#define PORT_8250       1
#define PORT_8250       1
#define PORT_16450      2
#define PORT_16450      2
#define PORT_16550      3
#define PORT_16550      3
#define PORT_16550A     4
#define PORT_16550A     4
#define PORT_CIRRUS     5
#define PORT_CIRRUS     5
#define SER_SCC_NORM    100     /* standard SCC channel */
#define SER_SCC_NORM    100     /* standard SCC channel */
#define SER_SCC_DMA     101     /* SCC channel with DMA support */
#define SER_SCC_DMA     101     /* SCC channel with DMA support */
#define SER_MFP_CTRL    102     /* standard MFP port with modem control signals */
#define SER_MFP_CTRL    102     /* standard MFP port with modem control signals */
#define SER_MFP_BARE    103     /* MFP port without modem controls */
#define SER_MFP_BARE    103     /* MFP port without modem controls */
#define SER_MIDI        104     /* Atari MIDI */
#define SER_MIDI        104     /* Atari MIDI */
#define SER_AMIGA       105     /* Amiga built-in serial port */
#define SER_AMIGA       105     /* Amiga built-in serial port */
#define SER_IOEXT       106     /* Amiga GVP IO-Extender (16c552) */
#define SER_IOEXT       106     /* Amiga GVP IO-Extender (16c552) */
#define SER_MFC_III     107     /* Amiga BSC Multiface Card III (MC68681) */
#define SER_MFC_III     107     /* Amiga BSC Multiface Card III (MC68681) */
 
 
 
 
struct serial_struct {
struct serial_struct {
        int     type;
        int     type;
        int     line;
        int     line;
        int     port;
        int     port;
        int     irq;
        int     irq;
        int     flags;
        int     flags;
        int     xmit_fifo_size;
        int     xmit_fifo_size;
        int     custom_divisor;
        int     custom_divisor;
        int     baud_base;
        int     baud_base;
        unsigned short  close_delay;
        unsigned short  close_delay;
        char    reserved_char[2];
        char    reserved_char[2];
        int     hub6;
        int     hub6;
        unsigned short  closing_wait; /* time to wait before closing */
        unsigned short  closing_wait; /* time to wait before closing */
        unsigned short  closing_wait2; /* no longer used... */
        unsigned short  closing_wait2; /* no longer used... */
        int     reserved[4];
        int     reserved[4];
};
};
 
 
/*
/*
 * For the close wait times, 0 means wait forever for serial port to
 * For the close wait times, 0 means wait forever for serial port to
 * flush its output.  65535 means don't wait at all.
 * flush its output.  65535 means don't wait at all.
 */
 */
#define ASYNC_CLOSING_WAIT_INF  0
#define ASYNC_CLOSING_WAIT_INF  0
#define ASYNC_CLOSING_WAIT_NONE 65535
#define ASYNC_CLOSING_WAIT_NONE 65535
 
 
/* This function tables does the abstraction from the underlying
/* This function tables does the abstraction from the underlying
 * hardware:
 * hardware:
 *
 *
 *   init(): Initialize the port as necessary, set RTS and DTR and
 *   init(): Initialize the port as necessary, set RTS and DTR and
 *      enable interrupts. It does not need to set the speed and other
 *      enable interrupts. It does not need to set the speed and other
 *      parameters, because change_speed() is called, too.
 *      parameters, because change_speed() is called, too.
 *   deinit(): Stop and shutdown the port (e.g. disable interrupts, ...)
 *   deinit(): Stop and shutdown the port (e.g. disable interrupts, ...)
 *   enab_tx_int(): Enable or disable the Tx Buffer Empty interrupt
 *   enab_tx_int(): Enable or disable the Tx Buffer Empty interrupt
 *      independently from other interrupt sources. If the int is
 *      independently from other interrupt sources. If the int is
 *      enabled, the transmitter should also be restarted, i.e. if there
 *      enabled, the transmitter should also be restarted, i.e. if there
 *      are any chars to be sent, they should be put into the Tx
 *      are any chars to be sent, they should be put into the Tx
 *      register. The real en/disabling of the interrupt may be a no-op
 *      register. The real en/disabling of the interrupt may be a no-op
 *      if there is no way to do this or it is too complex. This Tx ints
 *      if there is no way to do this or it is too complex. This Tx ints
 *      are just disabled to save some interrupts if the transmitter is
 *      are just disabled to save some interrupts if the transmitter is
 *      stopped anyway. But the restarting must be implemented!
 *      stopped anyway. But the restarting must be implemented!
 *   check_custom_divisor(): Check the given custom divisor for legality
 *   check_custom_divisor(): Check the given custom divisor for legality
 *      and return 0 if OK, non-zero otherwise.
 *      and return 0 if OK, non-zero otherwise.
 *   change_speed(): Set port speed, character size, number of stop
 *   change_speed(): Set port speed, character size, number of stop
 *      bits and parity from the termios structure. If the user wants
 *      bits and parity from the termios structure. If the user wants
 *      to set the speed with a custom divisor, he is required to
 *      to set the speed with a custom divisor, he is required to
 *      check the baud_base first!
 *      check the baud_base first!
 *   throttle(): Set or clear the RTS line according to 'status'.
 *   throttle(): Set or clear the RTS line according to 'status'.
 *   set_break(): Set or clear the 'Send a Break' flag.
 *   set_break(): Set or clear the 'Send a Break' flag.
 *   get_serial_info(): Fill in the baud_base and custom_divisor
 *   get_serial_info(): Fill in the baud_base and custom_divisor
 *      fields of a serial_struct. It may also modify other fields, if
 *      fields of a serial_struct. It may also modify other fields, if
 *      needed.
 *      needed.
 *   get_modem_info(): Return the status of RTS, DTR, DCD, RI, DSR and CTS.
 *   get_modem_info(): Return the status of RTS, DTR, DCD, RI, DSR and CTS.
 *   set_modem_info(): Set the status of RTS and DTR according to
 *   set_modem_info(): Set the status of RTS and DTR according to
 *      'new_dtr' and 'new_rts', resp. 0 = clear, 1 = set, -1 = don't change
 *      'new_dtr' and 'new_rts', resp. 0 = clear, 1 = set, -1 = don't change
 *   ioctl(): Process any port-specific ioctl's. This pointer may be
 *   ioctl(): Process any port-specific ioctl's. This pointer may be
 *      NULL, if the port has no own ioctl's.
 *      NULL, if the port has no own ioctl's.
 *   stop_receive(): Turn off the Rx part of the port, so no more characters
 *   stop_receive(): Turn off the Rx part of the port, so no more characters
 *      will be received. This is called before shutting the port down.
 *      will be received. This is called before shutting the port down.
 *   trans_empty(): Return !=0 if there are no more characters still to be
 *   trans_empty(): Return !=0 if there are no more characters still to be
 *      sent out (Tx buffer register and FIFOs empty)
 *      sent out (Tx buffer register and FIFOs empty)
 *   check_open(): Is called before the port is opened. The driver can check
 *   check_open(): Is called before the port is opened. The driver can check
 *      if that's ok and return an error code, or keep track of the opening
 *      if that's ok and return an error code, or keep track of the opening
 *      even before init() is called. Use deinit() for matching closing of the
 *      even before init() is called. Use deinit() for matching closing of the
 *      port.
 *      port.
 *
 *
 */
 */
 
 
struct async_struct;
struct async_struct;
 
 
typedef struct {
typedef struct {
        void (*init)( struct async_struct *info );
        void (*init)( struct async_struct *info );
        void (*deinit)( struct async_struct *info, int leave_dtr );
        void (*deinit)( struct async_struct *info, int leave_dtr );
        void (*enab_tx_int)( struct async_struct *info, int enab_flag );
        void (*enab_tx_int)( struct async_struct *info, int enab_flag );
        int  (*check_custom_divisor)( struct async_struct *info, int baud_base,
        int  (*check_custom_divisor)( struct async_struct *info, int baud_base,
                                     int divisor );
                                     int divisor );
        void (*change_speed)( struct async_struct *info );
        void (*change_speed)( struct async_struct *info );
        void (*throttle)( struct async_struct *info, int status );
        void (*throttle)( struct async_struct *info, int status );
        void (*set_break)( struct async_struct *info, int break_flag );
        void (*set_break)( struct async_struct *info, int break_flag );
        void (*get_serial_info)( struct async_struct *info,
        void (*get_serial_info)( struct async_struct *info,
                                struct serial_struct *retinfo );
                                struct serial_struct *retinfo );
        unsigned int (*get_modem_info)( struct async_struct *info );
        unsigned int (*get_modem_info)( struct async_struct *info );
        int  (*set_modem_info)( struct async_struct *info, int new_dtr,
        int  (*set_modem_info)( struct async_struct *info, int new_dtr,
                               int new_rts );
                               int new_rts );
        int  (*ioctl)( struct tty_struct *tty, struct file *file,
        int  (*ioctl)( struct tty_struct *tty, struct file *file,
                      struct async_struct *info, unsigned int cmd,
                      struct async_struct *info, unsigned int cmd,
                      unsigned long arg );
                      unsigned long arg );
        void (*stop_receive)( struct async_struct *info );
        void (*stop_receive)( struct async_struct *info );
        int  (*trans_empty)( struct async_struct *info );
        int  (*trans_empty)( struct async_struct *info );
        int  (*check_open)( struct async_struct *info, struct tty_struct *tty,
        int  (*check_open)( struct async_struct *info, struct tty_struct *tty,
                           struct file *file );
                           struct file *file );
} SERIALSWITCH;
} SERIALSWITCH;
 
 
/*
/*
 * Definitions for async_struct (and serial_struct) flags field
 * Definitions for async_struct (and serial_struct) flags field
 */
 */
#define ASYNC_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes 
#define ASYNC_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes 
                                   on the callout port */
                                   on the callout port */
#define ASYNC_FOURPORT  0x0002  /* Set OU1, OUT2 per AST Fourport settings */
#define ASYNC_FOURPORT  0x0002  /* Set OU1, OUT2 per AST Fourport settings */
#define ASYNC_SAK       0x0004  /* Secure Attention Key (Orange book) */
#define ASYNC_SAK       0x0004  /* Secure Attention Key (Orange book) */
#define ASYNC_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */
#define ASYNC_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */
 
 
#define ASYNC_SPD_MASK  0x0030
#define ASYNC_SPD_MASK  0x0030
#define ASYNC_SPD_HI    0x0010  /* Use 56000 instead of 38400 bps */
#define ASYNC_SPD_HI    0x0010  /* Use 56000 instead of 38400 bps */
 
 
#define ASYNC_SPD_VHI   0x0020  /* Use 115200 instead of 38400 bps */
#define ASYNC_SPD_VHI   0x0020  /* Use 115200 instead of 38400 bps */
#define ASYNC_SPD_CUST  0x0030  /* Use user-specified divisor */
#define ASYNC_SPD_CUST  0x0030  /* Use user-specified divisor */
 
 
#define ASYNC_SKIP_TEST 0x0040 /* Skip UART test during autoconfiguration */
#define ASYNC_SKIP_TEST 0x0040 /* Skip UART test during autoconfiguration */
#define ASYNC_AUTO_IRQ  0x0080 /* Do automatic IRQ during autoconfiguration */
#define ASYNC_AUTO_IRQ  0x0080 /* Do automatic IRQ during autoconfiguration */
#define ASYNC_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */
#define ASYNC_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */
#define ASYNC_PGRP_LOCKOUT    0x0200 /* Lock out cua opens based on pgrp */
#define ASYNC_PGRP_LOCKOUT    0x0200 /* Lock out cua opens based on pgrp */
#define ASYNC_CALLOUT_NOHUP   0x0400 /* Don't do hangups for cua device */
#define ASYNC_CALLOUT_NOHUP   0x0400 /* Don't do hangups for cua device */
 
 
#define ASYNC_FLAGS     0x0FFF  /* Possible legal async flags */
#define ASYNC_FLAGS     0x0FFF  /* Possible legal async flags */
#define ASYNC_USR_MASK 0x0430   /* Legal flags that non-privileged
#define ASYNC_USR_MASK 0x0430   /* Legal flags that non-privileged
                                 * users can set or reset */
                                 * users can set or reset */
 
 
/* Internal flags used only by drivers/char/m68kserial.c */
/* Internal flags used only by drivers/char/m68kserial.c */
#define ASYNC_INITIALIZED       0x80000000 /* Serial port was initialized */
#define ASYNC_INITIALIZED       0x80000000 /* Serial port was initialized */
#define ASYNC_CALLOUT_ACTIVE    0x40000000 /* Call out device is active */
#define ASYNC_CALLOUT_ACTIVE    0x40000000 /* Call out device is active */
#define ASYNC_NORMAL_ACTIVE     0x20000000 /* Normal device is active */
#define ASYNC_NORMAL_ACTIVE     0x20000000 /* Normal device is active */
#define ASYNC_BOOT_AUTOCONF     0x10000000 /* Autoconfigure port on bootup */
#define ASYNC_BOOT_AUTOCONF     0x10000000 /* Autoconfigure port on bootup */
#define ASYNC_CLOSING           0x08000000 /* Serial port is closing */
#define ASYNC_CLOSING           0x08000000 /* Serial port is closing */
#define ASYNC_CTS_FLOW          0x04000000 /* Do CTS flow control */
#define ASYNC_CTS_FLOW          0x04000000 /* Do CTS flow control */
#define ASYNC_CHECK_CD          0x02000000 /* i.e., CLOCAL */
#define ASYNC_CHECK_CD          0x02000000 /* i.e., CLOCAL */
 
 
/*
/*
 * Serial input interrupt line counters -- external structure
 * Serial input interrupt line counters -- external structure
 * Four lines can interrupt: CTS, DSR, RI, DCD
 * Four lines can interrupt: CTS, DSR, RI, DCD
 */
 */
struct serial_icounter_struct {
struct serial_icounter_struct {
        int cts, dsr, rng, dcd;
        int cts, dsr, rng, dcd;
        int reserved[16];
        int reserved[16];
};
};
 
 
 
 
#ifdef __KERNEL__
#ifdef __KERNEL__
/*
/*
 * This is our internal structure for each serial port's state.
 * This is our internal structure for each serial port's state.
 *
 *
 * Many fields are paralleled by the structure used by the serial_struct
 * Many fields are paralleled by the structure used by the serial_struct
 * structure.
 * structure.
 *
 *
 * For definitions of the flags field, see tty.h
 * For definitions of the flags field, see tty.h
 */
 */
 
 
#include <linux/termios.h>
#include <linux/termios.h>
#include <linux/tqueue.h>
#include <linux/tqueue.h>
 
 
/*
/*
 * Counters of the input lines (CTS, DSR, RI, CD) interrupts
 * Counters of the input lines (CTS, DSR, RI, CD) interrupts
 */
 */
struct async_icount {
struct async_icount {
        __u32   cts, dsr, rng, dcd;
        __u32   cts, dsr, rng, dcd;
};
};
 
 
struct async_struct {
struct async_struct {
        int                     magic;
        int                     magic;
        int                     baud_base;
        int                     baud_base;
        int                     port;
        int                     port;
        int                     irq;
        int                     irq;
        int                     flags;          /* defined in tty.h */
        int                     flags;          /* defined in tty.h */
        int                     hub6;           /* HUB6 plus one */
        int                     hub6;           /* HUB6 plus one */
        int                     type;
        int                     type;
        struct tty_struct       *tty;
        struct tty_struct       *tty;
        int                     read_status_mask;
        int                     read_status_mask;
        int                     ignore_status_mask;
        int                     ignore_status_mask;
        int                     timeout;
        int                     timeout;
        int                     xmit_fifo_size;
        int                     xmit_fifo_size;
        int                     custom_divisor;
        int                     custom_divisor;
        int                     x_char; /* xon/xoff character */
        int                     x_char; /* xon/xoff character */
        int                     close_delay;
        int                     close_delay;
        unsigned short          closing_wait;
        unsigned short          closing_wait;
        unsigned short          closing_wait2;
        unsigned short          closing_wait2;
        int                     IER;    /* Interrupt Enable Register */
        int                     IER;    /* Interrupt Enable Register */
        int                     MCR;    /* Modem control register */
        int                     MCR;    /* Modem control register */
        int                     MCR_noint; /* MCR with interrupts off */
        int                     MCR_noint; /* MCR with interrupts off */
        unsigned long           event;
        unsigned long           event;
        unsigned long           last_active;
        unsigned long           last_active;
        int                     line;
        int                     line;
        int                     count;      /* # of fd on device */
        int                     count;      /* # of fd on device */
        int                     blocked_open; /* # of blocked opens */
        int                     blocked_open; /* # of blocked opens */
        long                    session; /* Session of opening process */
        long                    session; /* Session of opening process */
        long                    pgrp; /* pgrp of opening process */
        long                    pgrp; /* pgrp of opening process */
        unsigned char           *xmit_buf;
        unsigned char           *xmit_buf;
        int                     xmit_head;
        int                     xmit_head;
        int                     xmit_tail;
        int                     xmit_tail;
        int                     xmit_cnt;
        int                     xmit_cnt;
        struct tq_struct        tqueue;
        struct tq_struct        tqueue;
        struct tq_struct        tqueue_hangup;
        struct tq_struct        tqueue_hangup;
        struct termios          normal_termios;
        struct termios          normal_termios;
        struct termios          callout_termios;
        struct termios          callout_termios;
        struct wait_queue       *open_wait;
        struct wait_queue       *open_wait;
        struct wait_queue       *close_wait;
        struct wait_queue       *close_wait;
        struct wait_queue       *delta_msr_wait;
        struct wait_queue       *delta_msr_wait;
        struct async_icount     icount; /* kernel counters for the 4 input interrupts */
        struct async_icount     icount; /* kernel counters for the 4 input interrupts */
        struct async_struct     *next_port; /* For the linked list */
        struct async_struct     *next_port; /* For the linked list */
        struct async_struct     *prev_port;
        struct async_struct     *prev_port;
        void                    *board_base; /* board-base address for use with
        void                    *board_base; /* board-base address for use with
                                                boards carrying several UART's,
                                                boards carrying several UART's,
                                                like some Amiga boards. */
                                                like some Amiga boards. */
        unsigned short          nr_uarts;    /* UART-counter, that indicates
        unsigned short          nr_uarts;    /* UART-counter, that indicates
                                                how many UART's there are on
                                                how many UART's there are on
                                                the board.  If the board has a
                                                the board.  If the board has a
                                                IRQ-register, this can be used
                                                IRQ-register, this can be used
                                                to check if any of the uarts,
                                                to check if any of the uarts,
                                                on the board has requested an
                                                on the board has requested an
                                                interrupt, instead of checking
                                                interrupt, instead of checking
                                                IRQ-registers on all UART's */
                                                IRQ-registers on all UART's */
        SERIALSWITCH            *sw;            /* functions to manage this port */
        SERIALSWITCH            *sw;            /* functions to manage this port */
};
};
 
 
#define SERIAL_MAGIC 0x5301
#define SERIAL_MAGIC 0x5301
 
 
/*
/*
 * The size of the serial xmit buffer is 1 page, or 4096 bytes
 * The size of the serial xmit buffer is 1 page, or 4096 bytes
 */
 */
#define SERIAL_XMIT_SIZE 4096
#define SERIAL_XMIT_SIZE 4096
 
 
/*
/*
 * Events are used to schedule things to happen at timer-interrupt
 * Events are used to schedule things to happen at timer-interrupt
 * time, instead of at rs interrupt time.
 * time, instead of at rs interrupt time.
 */
 */
#define RS_EVENT_WRITE_WAKEUP   0
#define RS_EVENT_WRITE_WAKEUP   0
 
 
/* number of characters left in xmit buffer before we ask for more */
/* number of characters left in xmit buffer before we ask for more */
#define WAKEUP_CHARS 256
#define WAKEUP_CHARS 256
 
 
/* Export to allow PCMCIA to use this - Dave Hinds */
/* Export to allow PCMCIA to use this - Dave Hinds */
extern int register_serial(struct serial_struct *req);
extern int register_serial(struct serial_struct *req);
extern void unregister_serial(int line);
extern void unregister_serial(int line);
extern struct async_struct rs_table[];
extern struct async_struct rs_table[];
extern task_queue tq_serial;
extern task_queue tq_serial;
 
 
 
 
/*
/*
 * This routine is used by the interrupt handler to schedule
 * This routine is used by the interrupt handler to schedule
 * processing in the software interrupt portion of the driver.
 * processing in the software interrupt portion of the driver.
 */
 */
static __inline__ void rs_sched_event(struct async_struct *info, int event)
static __inline__ void rs_sched_event(struct async_struct *info, int event)
{
{
        info->event |= 1 << event;
        info->event |= 1 << event;
        queue_task_irq(&info->tqueue, &tq_serial);
        queue_task_irq(&info->tqueue, &tq_serial);
        mark_bh(SERIAL_BH);
        mark_bh(SERIAL_BH);
}
}
 
 
static __inline__ void rs_receive_char( struct async_struct *info,
static __inline__ void rs_receive_char( struct async_struct *info,
                                            int ch, int err )
                                            int ch, int err )
{
{
        struct tty_struct *tty = info->tty;
        struct tty_struct *tty = info->tty;
 
 
        if (tty->flip.count >= TTY_FLIPBUF_SIZE)
        if (tty->flip.count >= TTY_FLIPBUF_SIZE)
                return;
                return;
        tty->flip.count++;
        tty->flip.count++;
        if (err == TTY_BREAK) {
        if (err == TTY_BREAK) {
                if (info->flags & ASYNC_SAK)
                if (info->flags & ASYNC_SAK)
                        do_SAK(tty);
                        do_SAK(tty);
        }
        }
        *tty->flip.flag_buf_ptr++ = err;
        *tty->flip.flag_buf_ptr++ = err;
        *tty->flip.char_buf_ptr++ = ch;
        *tty->flip.char_buf_ptr++ = ch;
        queue_task_irq(&tty->flip.tqueue, &tq_timer);
        queue_task_irq(&tty->flip.tqueue, &tq_timer);
}
}
 
 
static __inline__ int rs_get_tx_char( struct async_struct *info )
static __inline__ int rs_get_tx_char( struct async_struct *info )
{
{
        unsigned char ch;
        unsigned char ch;
 
 
        if (info->x_char) {
        if (info->x_char) {
                ch = info->x_char;
                ch = info->x_char;
                info->x_char = 0;
                info->x_char = 0;
                return( ch );
                return( ch );
        }
        }
 
 
        if (info->xmit_cnt <= 0 || info->tty->stopped || info->tty->hw_stopped)
        if (info->xmit_cnt <= 0 || info->tty->stopped || info->tty->hw_stopped)
                return( -1 );
                return( -1 );
 
 
        ch = info->xmit_buf[info->xmit_tail++];
        ch = info->xmit_buf[info->xmit_tail++];
        info->xmit_tail &= SERIAL_XMIT_SIZE - 1;
        info->xmit_tail &= SERIAL_XMIT_SIZE - 1;
        if (--info->xmit_cnt < WAKEUP_CHARS)
        if (--info->xmit_cnt < WAKEUP_CHARS)
                rs_sched_event(info, RS_EVENT_WRITE_WAKEUP);
                rs_sched_event(info, RS_EVENT_WRITE_WAKEUP);
        return( ch );
        return( ch );
}
}
 
 
static __inline__ int rs_no_more_tx( struct async_struct *info )
static __inline__ int rs_no_more_tx( struct async_struct *info )
{
{
        return( info->xmit_cnt <= 0 ||
        return( info->xmit_cnt <= 0 ||
                        info->tty->stopped ||
                        info->tty->stopped ||
                        info->tty->hw_stopped );
                        info->tty->hw_stopped );
}
}
 
 
static __inline__ void rs_dcd_changed( struct async_struct *info, int dcd )
static __inline__ void rs_dcd_changed( struct async_struct *info, int dcd )
 
 
{
{
        /* update input line counter */
        /* update input line counter */
        info->icount.dcd++;
        info->icount.dcd++;
        wake_up_interruptible(&info->delta_msr_wait);
        wake_up_interruptible(&info->delta_msr_wait);
 
 
        if (info->flags & ASYNC_CHECK_CD) {
        if (info->flags & ASYNC_CHECK_CD) {
#if (defined(SERIAL_DEBUG_OPEN) || defined(SERIAL_DEBUG_INTR))
#if (defined(SERIAL_DEBUG_OPEN) || defined(SERIAL_DEBUG_INTR))
                printk("ttyS%d CD now %s...", info->line,
                printk("ttyS%d CD now %s...", info->line,
                       dcd ? "on" : "off");
                       dcd ? "on" : "off");
#endif          
#endif          
                if (dcd) {
                if (dcd) {
                        wake_up_interruptible(&info->open_wait);
                        wake_up_interruptible(&info->open_wait);
                } else if (!((info->flags & ASYNC_CALLOUT_ACTIVE) &&
                } else if (!((info->flags & ASYNC_CALLOUT_ACTIVE) &&
                             (info->flags & ASYNC_CALLOUT_NOHUP))) {
                             (info->flags & ASYNC_CALLOUT_NOHUP))) {
#ifdef SERIAL_DEBUG_OPEN
#ifdef SERIAL_DEBUG_OPEN
                        printk("scheduling hangup...");
                        printk("scheduling hangup...");
#endif
#endif
                        queue_task_irq(&info->tqueue_hangup,
                        queue_task_irq(&info->tqueue_hangup,
                                       &tq_scheduler);
                                       &tq_scheduler);
                }
                }
        }
        }
}
}
 
 
 
 
void rs_stop( struct tty_struct *tty );
void rs_stop( struct tty_struct *tty );
void rs_start( struct tty_struct *tty );
void rs_start( struct tty_struct *tty );
 
 
static __inline__ void rs_check_cts( struct async_struct *info, int cts )
static __inline__ void rs_check_cts( struct async_struct *info, int cts )
{
{
        /* update input line counter */
        /* update input line counter */
        info->icount.cts++;
        info->icount.cts++;
        wake_up_interruptible(&info->delta_msr_wait);
        wake_up_interruptible(&info->delta_msr_wait);
 
 
        if ((info->flags & ASYNC_CTS_FLOW) && info->tty)
        if ((info->flags & ASYNC_CTS_FLOW) && info->tty)
                if (info->tty->hw_stopped) {
                if (info->tty->hw_stopped) {
                        if (cts) {
                        if (cts) {
#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW))
#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW))
                                printk("CTS tx start...");
                                printk("CTS tx start...");
#endif
#endif
                                info->tty->hw_stopped = 0;
                                info->tty->hw_stopped = 0;
                                rs_start( info->tty );
                                rs_start( info->tty );
                                rs_sched_event(info, RS_EVENT_WRITE_WAKEUP);
                                rs_sched_event(info, RS_EVENT_WRITE_WAKEUP);
                                return;
                                return;
                        }
                        }
                } else {
                } else {
                        if (!cts) {
                        if (!cts) {
                                info->tty->hw_stopped = 1;
                                info->tty->hw_stopped = 1;
                                rs_stop( info->tty );
                                rs_stop( info->tty );
                        }
                        }
                }
                }
 
 
}
}
 
 
 
 
#endif /* __KERNEL__ */
#endif /* __KERNEL__ */
 
 
#endif /* _M68K_SERIAL_H */
#endif /* _M68K_SERIAL_H */
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.