#ifndef GENERIC_SERIAL_H
#define GENERIC_SERIAL_H
+#ifdef __KERNEL__
+#include <linux/mutex.h>
+#include <linux/tty.h>
+
struct real_driver {
void (*disable_tx_interrupts) (void *);
void (*enable_tx_interrupts) (void *);
void (*disable_rx_interrupts) (void *);
void (*enable_rx_interrupts) (void *);
- int (*get_CD) (void *);
void (*shutdown_port) (void*);
int (*set_real_termios) (void*);
int (*chars_in_buffer) (void*);
struct gs_port {
int magic;
+ struct tty_port port;
unsigned char *xmit_buf;
int xmit_head;
int xmit_tail;
int xmit_cnt;
- struct semaphore port_write_sem;
- int flags;
- wait_queue_head_t open_wait;
- wait_queue_head_t close_wait;
- int count;
- int blocked_open;
- struct tty_struct *tty;
+ struct mutex port_write_mutex;
unsigned long event;
unsigned short closing_wait;
int close_delay;
spinlock_t driver_lock;
};
+#endif /* __KERNEL__ */
/* Flags */
/* Warning: serial.h defines some ASYNC_ flags, they say they are "only"
#define GS_DEBUG_FLOW 0x00000020
#define GS_DEBUG_WRITE 0x00000040
-
-void gs_put_char(struct tty_struct *tty, unsigned char ch);
+#ifdef __KERNEL__
+int gs_put_char(struct tty_struct *tty, unsigned char ch);
int gs_write(struct tty_struct *tty,
const unsigned char *buf, int count);
int gs_write_room(struct tty_struct *tty);
int gs_block_til_ready(void *port, struct file *filp);
void gs_close(struct tty_struct *tty, struct file *filp);
void gs_set_termios (struct tty_struct * tty,
- struct termios * old_termios);
+ struct ktermios * old_termios);
int gs_init_port(struct gs_port *port);
int gs_setserial(struct gs_port *port, struct serial_struct __user *sp);
int gs_getserial(struct gs_port *port, struct serial_struct __user *sp);
void gs_got_break(struct gs_port *port);
-
+#endif /* __KERNEL__ */
#endif