missed commit
[AROS.git] / compiler / include / resources / card.h
blobf68b45883c81def57f1095ed9a5fb3b73a53d5f3
1 /*
2 Copyright © 2010, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #ifndef RESOURCES_CARD_H
7 #define RESOURCES_CARD_H
9 #include <exec/nodes.h>
10 #include <exec/interrupts.h>
12 #define CARDRESNAME "card.resource"
14 struct CardHandle
16 struct Node cah_CardNode;
17 struct Interrupt *cah_CardRemoved;
18 struct Interrupt *cah_CardInserted;
19 struct Interrupt *cah_CardStatus;
20 UBYTE cah_CardFlags;
23 struct DeviceTData
25 ULONG dtd_DTsize;
26 ULONG dtd_DTspeed;
27 UBYTE dtd_DTtype;
28 UBYTE dtd_DTflags;
31 struct CardMemoryMap
33 UBYTE *cmm_CommonMemory;
34 UBYTE *cmm_AttributeMemory;
35 UBYTE *cmm_IOMemory;
37 /*** V39 ***/
38 ULONG cmm_CommonMemSize;
39 ULONG cmm_AttributeMemSize;
40 ULONG cmm_IOMemSize;
43 /* OwnCard() CardHandle.cah_CardFlags flags */
45 #define CARDB_RESETREMOVE 0
46 #define CARDF_RESETREMOVE (1<<CARDB_RESETREMOVE)
48 #define CARDB_IFAVAILABLE 1
49 #define CARDF_IFAVAILABLE (1<<CARDB_IFAVAILABLE)
51 #define CARDB_DELAYOWNERSHIP 2
52 #define CARDF_DELAYOWNERSHIP (1<<CARDB_DELAYOWNERSHIP)
54 #define CARDB_POSTSTATUS 3
55 #define CARDF_POSTSTATUS (1<<CARDB_POSTSTATUS)
57 /* ReleaseCreditCard() flags */
59 #define CARDB_REMOVEHANDLE 0
60 #define CARDF_REMOVEHANDLE (1<<CARDB_REMOVEHANDLE)
62 /* ReadStatus() return flags */
64 #define CARD_STATUSB_CCDET 6
65 #define CARD_STATUSF_CCDET (1<<CARD_STATUSB_CCDET)
67 #define CARD_STATUSB_BVD1 5
68 #define CARD_STATUSF_BVD1 (1<<CARD_STATUSB_BVD1)
70 #define CARD_STATUSB_SC 5
71 #define CARD_STATUSF_SC (1<<CARD_STATUSB_SC)
73 #define CARD_STATUSB_BVD2 4
74 #define CARD_STATUSF_BVD2 (1<<CARD_STATUSB_BVD2)
76 #define CARD_STATUSB_DA 4
77 #define CARD_STATUSF_DA (1<<CARD_STATUSB_DA)
79 #define CARD_STATUSB_WR 3
80 #define CARD_STATUSF_WR (1<<CARD_STATUSB_WR)
82 #define CARD_STATUSB_BSY 2
83 #define CARD_STATUSF_BSY (1<<CARD_STATUSB_BSY)
85 #define CARD_STATUSB_IRQ 2
86 #define CARD_STATUSF_IRQ (1<<CARD_STATUSB_IRQ)
89 /* CardProgramVoltage() defines */
91 #define CARD_VOLTAGE_0V 0
92 #define CARD_VOLTAGE_5V 1
93 #define CARD_VOLTAGE_12V 2
95 /* CardMiscControl() defines */
97 #define CARD_ENABLEB_DIGAUDIO 1
98 #define CARD_ENABLEF_DIGAUDIO (1<<CARD_ENABLEB_DIGAUDIO)
100 #define CARD_DISABLEB_WP 3
101 #define CARD_DISABLEF_WP (1<<CARD_DISABLEB_WP)
104 /* New CardMiscControl() bits for V39 card.resource */
106 #define CARD_INTB_SETCLR 7
107 #define CARD_INTF_SETCLR (1<<CARD_INTB_SETCLR)
109 #define CARD_INTB_BVD1 5
110 #define CARD_INTF_BVD1 (1<<CARD_INTB_BVD1)
112 #define CARD_INTB_SC 5
113 #define CARD_INTF_SC (1<<CARD_INTB_SC)
115 #define CARD_INTB_BVD2 4
116 #define CARD_INTF_BVD2 (1<<CARD_INTB_BVD2)
118 #define CARD_INTB_DA 4
119 #define CARD_INTF_DA (1<<CARD_INTB_DA)
121 #define CARD_INTB_BSY 2
122 #define CARD_INTF_BSY (1<<CARD_INTB_BSY)
124 #define CARD_INTB_IRQ 2
125 #define CARD_INTF_IRQ (1<<CARD_INTB_IRQ)
128 /* CardInterface() defines */
130 #define CARD_INTERFACE_AMIGA_0 0
133 #define CISTPL_AMIGAXIP 0x91
135 struct TP_AmigaXIP
137 UBYTE TPL_CODE;
138 UBYTE TPL_LINK;
139 UBYTE TP_XIPLOC[4];
140 UBYTE TP_XIPFLAGS;
141 UBYTE TP_XIPRESRV;
144 #define XIPFLAGSB_AUTORUN 0
145 #define XIPFLAGSF_AUTORUN (1<<XIPFLAGSB_AUTORUN)
147 #ifdef __AROS__
148 /* AROS helper macros.
149 * These are used to abstract away architectural
150 * differences between AROS ports.
152 #include <aros/asmcall.h>
154 /* Define a function prototype and call methods
155 * for cah_CardRemoved, cah_CardInserted and
156 * cah_CardStatus's is_Code fields.
158 * The prototype matches:
160 * mask = func(APTR is_Data, ULONG mask, VOID_FUNC is_Code) (A1, D0, A5)
162 * Note that while 'mask' is only valid for cah_CardStatus,
163 * it should be returned (unchanged) from all routines.
165 * Also note that A6 is considered scratch, and is *not* guaranteed
166 * to have any specific value upon entry on m68k architectures.
168 #define AROS_CARDP(func) \
169 AROS_UFP3(ULONG, func, \
170 AROS_UFPA(APTR, _card_Data, A1), \
171 AROS_UFPA(ULONG, _card_Mask, D0), \
172 AROS_UFPA(VOID_FUNC, _card_Code, A5))
174 #define AROS_CARDC(func, data, mask) \
175 AROS_UFC3(ULONG, func, \
176 AROS_UFCA(APTR, data, A1), \
177 AROS_UFCA(ULONG, mask, D0), \
178 AROS_UFCA(VOID_FUNC, func, A5))
180 #define AROS_CARDH(func, type, data, mask) \
181 AROS_UFH3(ULONG, func, \
182 AROS_UFHA(APTR, _card_Data, A1), \
183 AROS_UFHA(ULONG, mask, D0), \
184 AROS_UFHA(VOID_FUNC, _card_Code, A5)) \
185 { AROS_USERFUNC_INIT \
186 type __unused data = _card_Data;
188 #define AROS_CARDFUNC_INIT
189 #define AROS_CARDFUNC_EXIT AROS_USERFUNC_EXIT }
190 #endif /* __AROS__ */
192 #endif