_screen is only valid between show/hide.
[AROS.git] / rom / isapnp / controller.c
blob80b88899e6a31d474a1b7d6677785f29ecda0769
1 /* $Id$ */
3 /*
4 ISA-PnP -- A Plug And Play ISA software layer for AmigaOS.
5 Copyright (C) 2001 Martin Blom <martin@blom.org>
6 Copyright (C) 2009-2013 The AROS Development Team
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version.
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
18 You should have received a copy of the GNU Library General Public
19 License along with this library; if not, write to the
20 Free Software Foundation, Inc., 59 Temple Place - Suite 330, Cambridge,
21 MA 02139, USA.
24 #include <asm/io.h>
25 #include <libraries/configvars.h>
26 #include <libraries/expansion.h>
28 #include <proto/expansion.h>
30 #include "controller.h"
31 #include "isapnp_private.h"
33 /******************************************************************************
34 *** Controller functions ******************************************************
35 ******************************************************************************/
37 AROS_LH1(void, ISAC_SetMasterInt,
38 AROS_LHA(BOOL, on, D0),
39 struct ISAPNPBase *, res, 1, ISAPNP)
41 AROS_LIBFUNC_INIT
43 /* On a PC we have no interrupt mapping so we don't have a 'master interrupt' */
45 AROS_LIBFUNC_EXIT
49 AROS_LH0(BOOL, ISAC_GetMasterInt,
50 struct ISAPNPBase *, res, 2, ISAPNP)
52 AROS_LIBFUNC_INIT
54 return TRUE;
56 AROS_LIBFUNC_EXIT
60 AROS_LH1(void, ISAC_SetWaitState,
61 AROS_LHA(BOOL, on, D0),
62 struct ISAPNPBase *, res, 3, ISAPNP)
64 AROS_LIBFUNC_INIT
66 /* On a PC we can't control it */
68 AROS_LIBFUNC_EXIT
72 AROS_LH0(BOOL, ISAC_GetWaitState,
73 struct ISAPNPBase *, res, 4, ISAPNP)
75 AROS_LIBFUNC_INIT
77 return TRUE;
79 AROS_LIBFUNC_EXIT
83 AROS_LH1(BOOL, ISAC_GetInterruptStatus,
84 AROS_LHA(UBYTE, interrupt, D0),
85 struct ISAPNPBase *, res, 5, ISAPNP)
87 AROS_LIBFUNC_INIT
89 bug("[ISAPNP] ISAC_GetInterruptStatus() is not implemented\n");
90 /*UWORD* reg1 = (UWORD*)( res->m_Base + 0x18000 );
92 switch( interrupt )
94 case 3:
95 return ( ReadWord( reg1 ) & 4 ) != 0;
97 case 4:
98 return ( ReadWord( reg1 ) & 8 ) != 0;
100 case 5:
101 return ( ReadWord( reg1 ) & 16 ) != 0;
103 case 6:
104 return ( ReadWord( reg1 ) & 32 ) != 0;
106 case 7:
107 return ( ReadWord( reg1 ) & 64 ) != 0;
109 case 9:
110 return ( ReadWord( reg1 ) & 128 ) != 0;
112 case 10:
113 return ( ReadWord( reg1 ) & 256 ) != 0;
115 case 11:
116 return ( ReadWord( reg1 ) & 512 ) != 0;
118 case 12:
119 return ( ReadWord( reg1 ) & 1024 ) != 0;
121 case 14:
122 return ( ReadWord( reg1 ) & 2048 ) != 0;
124 case 15:
125 return ( ReadWord( reg1 ) & 4096 ) != 0;
128 return FALSE;
130 AROS_LIBFUNC_EXIT
134 AROS_LH1(UBYTE, ISAC_GetRegByte,
135 AROS_LHA(UWORD, reg, D0),
136 struct ISAPNPBase *, res, 6, ISAPNP)
138 AROS_LIBFUNC_INIT
140 return inb(reg);
142 AROS_LIBFUNC_EXIT
146 AROS_LH2(void, ISAC_SetRegByte,
147 AROS_LHA(UWORD, reg, D0),
148 AROS_LHA(UBYTE, value, D1),
149 struct ISAPNPBase *, res, 7, ISAPNP)
151 AROS_LIBFUNC_INIT
153 outb(value, reg);
155 AROS_LIBFUNC_EXIT
159 AROS_LH1(UWORD, ISAC_GetRegWord,
160 AROS_LHA(UWORD, reg, D0),
161 struct ISAPNPBase *, res, 8, ISAPNP)
163 AROS_LIBFUNC_INIT
165 return inw(reg);
167 AROS_LIBFUNC_EXIT
171 AROS_LH2(void, ISAC_SetRegWord,
172 AROS_LHA(UWORD, reg, D0),
173 AROS_LHA(UWORD, value, D1),
174 struct ISAPNPBase *, res, 9, ISAPNP)
176 AROS_LIBFUNC_INIT
178 outw(value, reg);
180 AROS_LIBFUNC_EXIT
184 AROS_LH1(ULONG, ISAC_GetRegLong,
185 AROS_LHA(UWORD, reg, D0),
186 struct ISAPNPBase *, res, 10, ISAPNP)
188 AROS_LIBFUNC_INIT
190 return inl(reg);
192 AROS_LIBFUNC_EXIT
196 AROS_LH2(void, ISAC_SetRegLong,
197 AROS_LHA(UWORD, reg, D0),
198 AROS_LHA(ULONG, value, D1),
199 struct ISAPNPBase *, res, 11, ISAPNP)
201 AROS_LIBFUNC_INIT
203 outl(value, reg);
205 AROS_LIBFUNC_EXIT
209 AROS_LH1(UBYTE, ISAC_ReadByte,
210 AROS_LHA(ULONG, address, D0),
211 struct ISAPNPBase *, res, 12, ISAPNP)
213 AROS_LIBFUNC_INIT
215 return *(UBYTE *)address;
217 AROS_LIBFUNC_EXIT
221 AROS_LH2(void, ISAC_WriteByte,
222 AROS_LHA(ULONG, address, D0),
223 AROS_LHA(UBYTE, value, D1 ),
224 struct ISAPNPBase *, res, 13, ISAPNP)
226 AROS_LIBFUNC_INIT
228 *(UBYTE *)address = value;
230 AROS_LIBFUNC_EXIT
234 AROS_LH1(UWORD, ISAC_ReadWord,
235 AROS_LHA(ULONG, address, D0),
236 struct ISAPNPBase *, res, 14, ISAPNP)
238 AROS_LIBFUNC_INIT
240 return *(UWORD *)address;
242 AROS_LIBFUNC_EXIT
246 AROS_LH2(void, ISAC_WriteWord,
247 AROS_LHA(ULONG, address, D0),
248 AROS_LHA(UWORD, value, D1),
249 struct ISAPNPBase *, res, 15, ISAPNP)
251 AROS_LIBFUNC_INIT
253 *(UWORD *)address = value;
255 AROS_LIBFUNC_EXIT
259 AROS_LH1(UWORD, ISAC_ReadLong,
260 AROS_LHA(ULONG, address, D0),
261 struct ISAPNPBase *, res, 16, ISAPNP)
263 AROS_LIBFUNC_INIT
265 return *(ULONG *)address;
267 AROS_LIBFUNC_EXIT
271 AROS_LH2(void, ISAC_WriteLong,
272 AROS_LHA(ULONG, address, D0),
273 AROS_LHA(ULONG, value, D1 ),
274 struct ISAPNPBase *, res, 17, ISAPNP)
276 AROS_LIBFUNC_INIT
278 *(ULONG *)address = value;
280 AROS_LIBFUNC_EXIT