store the pre-alphacomposit hook and allow it to be queried.
[AROS.git] / workbench / devs / networks / prism2 / io.h
blobe77123cb6631bcad3fd212083e2c348d36302b3c
1 /*
3 Copyright (C) 2004,2005 Neil Cafferkey
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston,
18 MA 02111-1307, USA.
22 #ifndef IO_H
23 #define IO_H
26 /* I/O tags */
28 #define IOTAG_ByteIn (TAG_USER + 0)
29 #define IOTAG_WordIn (TAG_USER + 1)
30 #define IOTAG_LongIn (TAG_USER + 2)
31 #define IOTAG_QuadIn (TAG_USER + 3)
32 #define IOTAG_ByteOut (TAG_USER + 4)
33 #define IOTAG_WordOut (TAG_USER + 5)
34 #define IOTAG_LongOut (TAG_USER + 6)
35 #define IOTAG_QuadOut (TAG_USER + 7)
36 #define IOTAG_BytesIn (TAG_USER + 8)
37 #define IOTAG_WordsIn (TAG_USER + 9)
38 #define IOTAG_LongsIn (TAG_USER + 10)
39 #define IOTAG_QuadsIn (TAG_USER + 11)
40 #define IOTAG_BytesOut (TAG_USER + 12)
41 #define IOTAG_WordsOut (TAG_USER + 13)
42 #define IOTAG_LongsOut (TAG_USER + 14)
43 #define IOTAG_QuadsOut (TAG_USER + 15)
44 #define IOTAG_BEWordIn (TAG_USER + 16)
45 #define IOTAG_BELongIn (TAG_USER + 17)
46 #define IOTAG_BEQuadIn (TAG_USER + 18)
47 #define IOTAG_BEWordOut (TAG_USER + 19)
48 #define IOTAG_BELongOut (TAG_USER + 20)
49 #define IOTAG_BEQuadOut (TAG_USER + 21)
50 #define IOTAG_BEWordsIn (TAG_USER + 22)
51 #define IOTAG_BELongsIn (TAG_USER + 23)
52 #define IOTAG_BEQuadsIn (TAG_USER + 24)
53 #define IOTAG_BEWordsOut (TAG_USER + 25)
54 #define IOTAG_BELongsOut (TAG_USER + 26)
55 #define IOTAG_BEQuadsOut (TAG_USER + 27)
56 #define IOTAG_LEWordIn (TAG_USER + 28)
57 #define IOTAG_LELongIn (TAG_USER + 29)
58 #define IOTAG_LEQuadIn (TAG_USER + 30)
59 #define IOTAG_LEWordOut (TAG_USER + 31)
60 #define IOTAG_LELongOut (TAG_USER + 32)
61 #define IOTAG_LEQuadOut (TAG_USER + 33)
62 #define IOTAG_LEWordsIn (TAG_USER + 34)
63 #define IOTAG_LELongsIn (TAG_USER + 35)
64 #define IOTAG_LEQuadsIn (TAG_USER + 36)
65 #define IOTAG_LEWordsOut (TAG_USER + 37)
66 #define IOTAG_LELongsOut (TAG_USER + 38)
67 #define IOTAG_LEQuadsOut (TAG_USER + 39)
68 #define IOTAG_AllocDMAMem (TAG_USER + 40)
69 #define IOTAG_FreeDMAMem (TAG_USER + 41)
72 /* I/O macros */
74 #ifdef __i386__
76 #define BYTEIN(address) \
77 ({ \
78 UBYTE _BYTEIN_value; \
79 __asm volatile ("inb %w1,%0":"=a" (_BYTEIN_value):"Nd" (address)); \
80 _BYTEIN_value; \
83 #define WORDIN(address) \
84 ({ \
85 UWORD _WORDIN_value; \
86 __asm volatile ("inw %w1,%0":"=a" (_WORDIN_value):"Nd" (address)); \
87 _WORDIN_value; \
90 #define LONGIN(address) \
91 ({ \
92 ULONG _LONGIN_value; \
93 __asm volatile ("inl %w1,%0":"=a" (_LONGIN_value):"Nd" (address)); \
94 _LONGIN_value; \
97 #define BYTEOUT(address, value) \
98 ({ \
99 __asm volatile ("outb %b0,%w1": :"a" (value), "Nd" (address)); \
102 #define WORDOUT(address, value) \
103 ({ \
104 __asm volatile ("outw %w0,%w1": :"a" (value), "Nd" (address)); \
107 #define LONGOUT(address, value) \
108 ({ \
109 __asm volatile ("outl %0,%w1": :"a" (value), "Nd" (address)); \
112 #else
114 #define BYTEIN(address) \
115 (*((volatile UBYTE *)(address)))
117 #define WORDIN(address) \
118 (*((volatile UWORD *)(address)))
120 #define LONGIN(address) \
121 (*((volatile ULONG *)(address)))
123 #define BYTEOUT(address, value) \
124 *((volatile UBYTE *)(address)) = (value)
126 #define WORDOUT(address, value) \
127 *((volatile UWORD *)(address)) = (value)
129 #define LONGOUT(address, value) \
130 *((volatile ULONG *)(address)) = (value)
132 #endif
134 #define WORDSIN(address, data, count) \
135 ({ \
136 ULONG _WORDSIN_i = (count); \
137 UWORD *_WORDSIN_p = (data); \
138 while(_WORDSIN_i-- != 0) \
139 *_WORDSIN_p++ = WORDIN(address); \
140 _WORDSIN_p; \
143 #define LONGSIN(address, data, count) \
144 ({ \
145 ULONG _LONGSIN_i = (count); \
146 ULONG *_LONGSIN_p = (data); \
147 while(_LONGSIN_i-- != 0) \
148 *_LONGSIN_p++ = LONGIN(address); \
149 _LONGSIN_p; \
152 #define WORDSOUT(address, data, count) \
153 do \
155 ULONG _WORDSOUT_i = (count); \
156 const UWORD *_WORDSOUT_p = (data); \
157 while(_WORDSOUT_i-- != 0) \
158 WORDOUT(address, *_WORDSOUT_p++); \
160 while(0)
162 #define LONGSOUT(address, data, count) \
163 do \
165 ULONG _LONGSOUT_i = (count); \
166 const ULONG *_LONGSOUT_p = (data); \
167 while(_LONGSOUT_i-- != 0) \
168 LONGOUT(address, *_LONGSOUT_p++); \
170 while(0)
172 #define BEWORDOUT(address, value) \
173 WORDOUT(address, MakeBEWord(value))
175 #define LEWORDIN(address) \
176 LEWord(WORDIN(address))
178 #define LEWORDOUT(address, value) \
179 WORDOUT(address, MakeLEWord(value))
181 #define LELONGIN(address) \
182 LELong(LONGIN(address))
184 #define LELONGOUT(address, value) \
185 LONGOUT(address, MakeLELong(value))
187 #define LEWORDSIN(address, data, count) \
188 ({ \
189 ULONG _LEWORDSIN_i = (count); \
190 UWORD *_LEWORDSIN_p = (data); \
191 while(_LEWORDSIN_i-- != 0) \
192 *_LEWORDSIN_p++ = LEWORDIN(address); \
193 _LEWORDSIN_p; \
197 #endif