gcc-4.6.2: Update with patch for gengtype.c
[AROS.git] / rom / isapnp / controller.c
blobe5fa4f1b88ad3264549bfb574ff3fb1a37f071d6
1 /* $Id$ */
3 /*
4 ISA-PnP -- A Plug And Play ISA software layer for AmigaOS.
5 Copyright (C) 2001 Martin Blom <martin@blom.org>
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public
18 License along with this library; if not, write to the
19 Free Software Foundation, Inc., 59 Temple Place - Suite 330, Cambridge,
20 MA 02139, USA.
23 #include <asm/io.h>
24 #include <libraries/configvars.h>
25 #include <libraries/expansion.h>
27 #include <proto/expansion.h>
29 #include "controller.h"
30 #include "isapnp_private.h"
32 /******************************************************************************
33 *** Controller functions ******************************************************
34 ******************************************************************************/
36 void ASMCALL
37 ISAC_SetMasterInt( REG( d0, BOOL on ),
38 REG( a6, struct ISAPNPBase* res ) )
40 /* On a PC we have no interrupt mapping so we don't have a 'master interrupt' */
44 BOOL ASMCALL
45 ISAC_GetMasterInt( REG( a6, struct ISAPNPBase* res ) )
47 return TRUE;
51 void ASMCALL
52 ISAC_SetWaitState( REG( d0, BOOL on ),
53 REG( a6, struct ISAPNPBase* res ) )
55 /* On a PC we can't control it */
59 BOOL ASMCALL
60 ISAC_GetWaitState( REG( a6, struct ISAPNPBase* res ) )
62 return TRUE;
66 BOOL ASMCALL
67 ISAC_GetInterruptStatus( REG( d0, UBYTE interrupt ),
68 REG( a6, struct ISAPNPBase* res ) )
70 bug("[ISAPNP] ISAC_GetInterruptStatus() is not implemented\n");
71 /*UWORD* reg1 = (UWORD*)( res->m_Base + 0x18000 );
73 switch( interrupt )
75 case 3:
76 return ( ReadWord( reg1 ) & 4 ) != 0;
78 case 4:
79 return ( ReadWord( reg1 ) & 8 ) != 0;
81 case 5:
82 return ( ReadWord( reg1 ) & 16 ) != 0;
84 case 6:
85 return ( ReadWord( reg1 ) & 32 ) != 0;
87 case 7:
88 return ( ReadWord( reg1 ) & 64 ) != 0;
90 case 9:
91 return ( ReadWord( reg1 ) & 128 ) != 0;
93 case 10:
94 return ( ReadWord( reg1 ) & 256 ) != 0;
96 case 11:
97 return ( ReadWord( reg1 ) & 512 ) != 0;
99 case 12:
100 return ( ReadWord( reg1 ) & 1024 ) != 0;
102 case 14:
103 return ( ReadWord( reg1 ) & 2048 ) != 0;
105 case 15:
106 return ( ReadWord( reg1 ) & 4096 ) != 0;
109 return FALSE;
113 UBYTE ASMCALL
114 ISAC_GetRegByte( REG( d0, UWORD reg ),
115 REG( a6, struct ISAPNPBase* res ) )
117 return inb(reg);
121 void ASMCALL
122 ISAC_SetRegByte( REG( d0, UWORD reg ),
123 REG( d1, UBYTE value ),
124 REG( a6, struct ISAPNPBase* res ) )
126 outb(value, reg);
130 UWORD ASMCALL
131 ISAC_GetRegWord( REG( d0, UWORD reg ),
132 REG( a6, struct ISAPNPBase* res ) )
134 return inw(reg);
138 void ASMCALL
139 ISAC_SetRegWord( REG( d0, UWORD reg ),
140 REG( d1, UWORD value ),
141 REG( a6, struct ISAPNPBase* res ) )
143 outw(value, reg);
147 ULONG ASMCALL
148 ISAC_GetRegLong( REG( d0, UWORD reg ),
149 REG( a6, struct ISAPNPBase* res ) )
151 return inl(reg);
155 void ASMCALL
156 ISAC_SetRegLong( REG( d0, UWORD reg ),
157 REG( d1, ULONG value ),
158 REG( a6, struct ISAPNPBase* res ) )
160 outl(value, reg);
164 UBYTE ASMCALL
165 ISAC_ReadByte( REG( d0, ULONG address ),
166 REG( a6, struct ISAPNPBase* res ) )
168 return *(UBYTE *)address;
172 void ASMCALL
173 ISAC_WriteByte( REG( d0, ULONG address ),
174 REG( d1, UBYTE value ),
175 REG( a6, struct ISAPNPBase* res ) )
177 *(UBYTE *)address = value;
181 UWORD ASMCALL
182 ISAC_ReadWord( REG( d0, ULONG address ),
183 REG( a6, struct ISAPNPBase* res ) )
185 return *(UWORD *)address;
189 void ASMCALL
190 ISAC_WriteWord( REG( d0, ULONG address ),
191 REG( d1, UWORD value ),
192 REG( a6, struct ISAPNPBase* res ) )
194 *(UWORD *)address = value;
198 ULONG ASMCALL
199 ISAC_ReadLong( REG( d0, ULONG address ),
200 REG( a6, struct ISAPNPBase* res ) )
202 return *(ULONG *)address;
206 void ASMCALL
207 ISAC_WriteLong( REG( d0, ULONG address ),
208 REG( d1, ULONG value ),
209 REG( a6, struct ISAPNPBase* res ) )
211 *(ULONG *)address = value;