define __KERNEL_STRICT_NAMES to avoid inclusion of kernel types on systems that carry...
[cake.git] / rom / isapnp / controller.c
blobb5810da9149a1240f04af9314be7e4d0d86c1d5f
1 /* $Id: controller.c,v 1.7 2001/05/29 10:53:44 lcs Exp $ */
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 bug("[ISAPNP] ISAC_SetMasterInt() is not implemented\n");
41 /*UWORD* reg2 = (UWORD*)( res->m_Base + 0x18002 );
43 if( on )
45 WriteWord( reg2, 0 );
47 else
49 ReadWord( reg2 );
50 }*/
54 BOOL ASMCALL
55 ISAC_GetMasterInt( REG( a6, struct ISAPNPBase* res ) )
57 bug("[ISAPNP] ISAC_GetMasterInt() is not implemented\n");
58 /*UWORD* reg1 = (UWORD*)( res->m_Base + 0x18000 );
60 return ( ReadWord( reg1 ) & 1 ) != 0;*/
64 void ASMCALL
65 ISAC_SetWaitState( REG( d0, BOOL on ),
66 REG( a6, struct ISAPNPBase* res ) )
68 bug("[ISAPNP] ISAC_SetWaitState() is not implemented\n");
69 #if 0
70 UBYTE* reg3 = (UBYTE*) ( isa_Base + 0x18007 );
72 if( ( on && !WaitState() ) ||
73 ( !on && WaitState() ) )
75 *reg3 = 0; // Toggle
77 #endif
81 BOOL ASMCALL
82 ISAC_GetWaitState( REG( a6, struct ISAPNPBase* res ) )
84 bug("[ISAPNP] ISAC_GetWaitState() is not implemented\n");
85 /*UWORD* reg1 = (UWORD*)( res->m_Base + 0x18000 );
87 return ( ReadWord( reg1 ) & 2 ) != 0;*/
91 BOOL ASMCALL
92 ISAC_GetInterruptStatus( REG( d0, UBYTE interrupt ),
93 REG( a6, struct ISAPNPBase* res ) )
95 bug("[ISAPNP] ISAC_GetInterruptStatus() is not implemented\n");
96 /*UWORD* reg1 = (UWORD*)( res->m_Base + 0x18000 );
98 switch( interrupt )
100 case 3:
101 return ( ReadWord( reg1 ) & 4 ) != 0;
103 case 4:
104 return ( ReadWord( reg1 ) & 8 ) != 0;
106 case 5:
107 return ( ReadWord( reg1 ) & 16 ) != 0;
109 case 6:
110 return ( ReadWord( reg1 ) & 32 ) != 0;
112 case 7:
113 return ( ReadWord( reg1 ) & 64 ) != 0;
115 case 9:
116 return ( ReadWord( reg1 ) & 128 ) != 0;
118 case 10:
119 return ( ReadWord( reg1 ) & 256 ) != 0;
121 case 11:
122 return ( ReadWord( reg1 ) & 512 ) != 0;
124 case 12:
125 return ( ReadWord( reg1 ) & 1024 ) != 0;
127 case 14:
128 return ( ReadWord( reg1 ) & 2048 ) != 0;
130 case 15:
131 return ( ReadWord( reg1 ) & 4096 ) != 0;
134 return FALSE;
138 UBYTE ASMCALL
139 ISAC_GetRegByte( REG( d0, UWORD reg ),
140 REG( a6, struct ISAPNPBase* res ) )
142 return inb(reg);
146 void ASMCALL
147 ISAC_SetRegByte( REG( d0, UWORD reg ),
148 REG( d1, UBYTE value ),
149 REG( a6, struct ISAPNPBase* res ) )
151 outb(value, reg);
155 UWORD ASMCALL
156 ISAC_GetRegWord( REG( d0, UWORD reg ),
157 REG( a6, struct ISAPNPBase* res ) )
159 return inw(reg);
163 void ASMCALL
164 ISAC_SetRegWord( REG( d0, UWORD reg ),
165 REG( d1, UWORD value ),
166 REG( a6, struct ISAPNPBase* res ) )
168 outw(value, reg);
172 ULONG ASMCALL
173 ISAC_GetRegLong( REG( d0, UWORD reg ),
174 REG( a6, struct ISAPNPBase* res ) )
176 return inl(reg);
180 void ASMCALL
181 ISAC_SetRegLong( REG( d0, UWORD reg ),
182 REG( d1, ULONG value ),
183 REG( a6, struct ISAPNPBase* res ) )
185 outl(value, reg);
189 UBYTE ASMCALL
190 ISAC_ReadByte( REG( d0, ULONG address ),
191 REG( a6, struct ISAPNPBase* res ) )
193 return *(UBYTE *)address;
197 void ASMCALL
198 ISAC_WriteByte( REG( d0, ULONG address ),
199 REG( d1, UBYTE value ),
200 REG( a6, struct ISAPNPBase* res ) )
202 *(UBYTE *)address = value;
206 UWORD ASMCALL
207 ISAC_ReadWord( REG( d0, ULONG address ),
208 REG( a6, struct ISAPNPBase* res ) )
210 return *(UWORD *)address;
214 void ASMCALL
215 ISAC_WriteWord( REG( d0, ULONG address ),
216 REG( d1, UWORD value ),
217 REG( a6, struct ISAPNPBase* res ) )
219 *(UWORD *)address = value;
223 ULONG ASMCALL
224 ISAC_ReadLong( REG( d0, ULONG address ),
225 REG( a6, struct ISAPNPBase* res ) )
227 return *(ULONG *)address;
231 void ASMCALL
232 ISAC_WriteLong( REG( d0, ULONG address ),
233 REG( d1, ULONG value ),
234 REG( a6, struct ISAPNPBase* res ) )
236 *(ULONG *)address = value;