Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / char / ip2 / i2os.h
blobeff9b542d699d33b92d0774f5208bdff2d8546e7
1 /*******************************************************************************
3 * (c) 1999 by Computone Corporation
5 ********************************************************************************
8 * PACKAGE: Linux tty Device Driver for IntelliPort II family of multiport
9 * serial I/O controllers.
11 * DESCRIPTION: Defines, definitions and includes which are heavily dependent
12 * on O/S, host, compiler, etc. This file is tailored for:
13 * Linux v2.0.0 and later
14 * Gnu gcc c2.7.2
15 * 80x86 architecture
17 *******************************************************************************/
19 #ifndef I2OS_H /* To prevent multiple includes */
20 #define I2OS_H 1
22 //-------------------------------------------------
23 // Required Includes
24 //-------------------------------------------------
26 #include "ip2types.h"
27 #include <asm/io.h> /* For inb, etc */
29 //------------------------------------
30 // Defines for I/O instructions:
31 //------------------------------------
33 #define INB(port) inb(port)
34 #define OUTB(port,value) outb((value),(port))
35 #define INW(port) inw(port)
36 #define OUTW(port,value) outw((value),(port))
37 #define OUTSW(port,addr,count) outsw((port),(addr),(((count)+1)/2))
38 #define OUTSB(port,addr,count) outsb((port),(addr),(((count)+1))&-2)
39 #define INSW(port,addr,count) insw((port),(addr),(((count)+1)/2))
40 #define INSB(port,addr,count) insb((port),(addr),(((count)+1))&-2)
42 //--------------------------------------------
43 // Interrupt control
44 //--------------------------------------------
46 #define LOCK_INIT(a) rwlock_init(a)
48 #define SAVE_AND_DISABLE_INTS(a,b) { \
49 /* printk("get_lock: 0x%x,%4d,%s\n",(int)a,__LINE__,__FILE__);*/ \
50 spin_lock_irqsave(a,b); \
53 #define RESTORE_INTS(a,b) { \
54 /* printk("rel_lock: 0x%x,%4d,%s\n",(int)a,__LINE__,__FILE__);*/ \
55 spin_unlock_irqrestore(a,b); \
58 #define READ_LOCK_IRQSAVE(a,b) { \
59 /* printk("get_read_lock: 0x%x,%4d,%s\n",(int)a,__LINE__,__FILE__);*/ \
60 read_lock_irqsave(a,b); \
63 #define READ_UNLOCK_IRQRESTORE(a,b) { \
64 /* printk("rel_read_lock: 0x%x,%4d,%s\n",(int)a,__LINE__,__FILE__);*/ \
65 read_unlock_irqrestore(a,b); \
68 #define WRITE_LOCK_IRQSAVE(a,b) { \
69 /* printk("get_write_lock: 0x%x,%4d,%s\n",(int)a,__LINE__,__FILE__);*/ \
70 write_lock_irqsave(a,b); \
73 #define WRITE_UNLOCK_IRQRESTORE(a,b) { \
74 /* printk("rel_write_lock: 0x%x,%4d,%s\n",(int)a,__LINE__,__FILE__);*/ \
75 write_unlock_irqrestore(a,b); \
79 //------------------------------------------------------------------------------
80 // Hardware-delay loop
82 // Probably used in only one place (see i2ellis.c) but this helps keep things
83 // together. Note we have unwound the IN instructions. On machines with a
84 // reasonable cache, the eight instructions (1 byte each) should fit in cache
85 // nicely, and on un-cached machines, the code-fetch would tend not to dominate.
86 // Note that cx is shifted so that "count" still reflects the total number of
87 // iterations assuming no unwinding.
88 //------------------------------------------------------------------------------
90 //#define DELAY1MS(port,count,label)
92 //------------------------------------------------------------------------------
93 // Macros to switch to a new stack, saving stack pointers, and to restore the
94 // old stack (Used, for example, in i2lib.c) "heap" is the address of some
95 // buffer which will become the new stack (working down from highest address).
96 // The two words at the two lowest addresses in this stack are for storing the
97 // SS and SP.
98 //------------------------------------------------------------------------------
100 //#define TO_NEW_STACK(heap,size)
101 //#define TO_OLD_STACK(heap)
103 //------------------------------------------------------------------------------
104 // Macros to save the original IRQ vectors and masks, and to patch in new ones.
105 //------------------------------------------------------------------------------
107 //#define SAVE_IRQ_MASKS(dest)
108 //#define WRITE_IRQ_MASKS(src)
109 //#define SAVE_IRQ_VECTOR(value,dest)
110 //#define WRITE_IRQ_VECTOR(value,src)
112 //------------------------------------------------------------------------------
113 // Macro to copy data from one far pointer to another.
114 //------------------------------------------------------------------------------
116 #define I2_MOVE_DATA(fpSource,fpDest,count) memmove(fpDest,fpSource,count);
118 //------------------------------------------------------------------------------
119 // Macros to issue eoi's to host interrupt control (IBM AT 8259-style).
120 //------------------------------------------------------------------------------
122 //#define MASTER_EOI
123 //#define SLAVE_EOI
125 #endif /* I2OS_H */