| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  *  generic_serial.h | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *  Copyright (C) 1998 R.E.Wolff@BitWizard.nl | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *  written for the SX serial driver. | 
					
						
							|  |  |  |  *     Contains the code that should be shared over all the serial drivers. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *  Version 0.1 -- December, 1998. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef GENERIC_SERIAL_H
 | 
					
						
							|  |  |  | #define GENERIC_SERIAL_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-04-25 14:07:02 +01:00
										 |  |  | #ifdef __KERNEL__
 | 
					
						
							| 
									
										
										
										
											2006-03-23 03:00:44 -08:00
										 |  |  | #include <linux/mutex.h>
 | 
					
						
							| 
									
										
										
										
											2008-07-16 21:55:20 +01:00
										 |  |  | #include <linux/tty.h>
 | 
					
						
							| 
									
										
										
										
											2006-03-23 03:00:44 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | struct real_driver { | 
					
						
							|  |  |  |   void                    (*disable_tx_interrupts) (void *); | 
					
						
							|  |  |  |   void                    (*enable_tx_interrupts) (void *); | 
					
						
							|  |  |  |   void                    (*disable_rx_interrupts) (void *); | 
					
						
							|  |  |  |   void                    (*enable_rx_interrupts) (void *); | 
					
						
							|  |  |  |   void                    (*shutdown_port) (void*); | 
					
						
							|  |  |  |   int                     (*set_real_termios) (void*); | 
					
						
							|  |  |  |   int                     (*chars_in_buffer) (void*); | 
					
						
							|  |  |  |   void                    (*close) (void*); | 
					
						
							|  |  |  |   void                    (*hungup) (void*); | 
					
						
							|  |  |  |   void                    (*getserial) (void*, struct serial_struct *sp); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct gs_port { | 
					
						
							|  |  |  |   int                     magic; | 
					
						
							| 
									
										
										
										
											2008-07-16 21:55:20 +01:00
										 |  |  |   struct tty_port	  port; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |   unsigned char           *xmit_buf;  | 
					
						
							|  |  |  |   int                     xmit_head; | 
					
						
							|  |  |  |   int                     xmit_tail; | 
					
						
							|  |  |  |   int                     xmit_cnt; | 
					
						
							| 
									
										
										
										
											2006-03-23 03:00:44 -08:00
										 |  |  |   struct mutex            port_write_mutex; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |   unsigned long           event; | 
					
						
							|  |  |  |   unsigned short          closing_wait; | 
					
						
							|  |  |  |   int                     close_delay; | 
					
						
							|  |  |  |   struct real_driver      *rd; | 
					
						
							|  |  |  |   int                     wakeup_chars; | 
					
						
							|  |  |  |   int                     baud_base; | 
					
						
							|  |  |  |   int                     baud; | 
					
						
							|  |  |  |   int                     custom_divisor; | 
					
						
							|  |  |  |   spinlock_t              driver_lock; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-04-25 14:07:02 +01:00
										 |  |  | #endif /* __KERNEL__ */
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Flags */ | 
					
						
							|  |  |  | /* Warning: serial.h defines some ASYNC_ flags, they say they are "only"
 | 
					
						
							|  |  |  |    used in serial.c, but they are also used in all other serial drivers.  | 
					
						
							|  |  |  |    Make sure they don't clash with these here... */ | 
					
						
							|  |  |  | #define GS_TX_INTEN      0x00800000
 | 
					
						
							|  |  |  | #define GS_RX_INTEN      0x00400000
 | 
					
						
							|  |  |  | #define GS_ACTIVE        0x00200000
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define GS_TYPE_NORMAL   1
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define GS_DEBUG_FLUSH   0x00000001
 | 
					
						
							|  |  |  | #define GS_DEBUG_BTR     0x00000002
 | 
					
						
							|  |  |  | #define GS_DEBUG_TERMIOS 0x00000004
 | 
					
						
							|  |  |  | #define GS_DEBUG_STUFF   0x00000008
 | 
					
						
							|  |  |  | #define GS_DEBUG_CLOSE   0x00000010
 | 
					
						
							|  |  |  | #define GS_DEBUG_FLOW    0x00000020
 | 
					
						
							|  |  |  | #define GS_DEBUG_WRITE   0x00000040
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-04-25 14:07:02 +01:00
										 |  |  | #ifdef __KERNEL__
 | 
					
						
							| 
									
										
										
										
											2008-04-30 00:54:03 -07:00
										 |  |  | int gs_put_char(struct tty_struct *tty, unsigned char ch); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | int  gs_write(struct tty_struct *tty,  | 
					
						
							|  |  |  |              const unsigned char *buf, int count); | 
					
						
							|  |  |  | int  gs_write_room(struct tty_struct *tty); | 
					
						
							|  |  |  | int  gs_chars_in_buffer(struct tty_struct *tty); | 
					
						
							|  |  |  | void gs_flush_buffer(struct tty_struct *tty); | 
					
						
							|  |  |  | void gs_flush_chars(struct tty_struct *tty); | 
					
						
							|  |  |  | void gs_stop(struct tty_struct *tty); | 
					
						
							|  |  |  | void gs_start(struct tty_struct *tty); | 
					
						
							|  |  |  | void gs_hangup(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,  | 
					
						
							| 
									
										
										
										
											2006-12-08 02:38:45 -08:00
										 |  |  |                      struct ktermios * old_termios); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 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); | 
					
						
							| 
									
										
										
										
											2006-04-25 14:07:02 +01:00
										 |  |  | #endif /* __KERNEL__ */
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #endif
 |