Fixed warnings in AHI code (Part 2).
[AROS.git] / workbench / devs / AHI / Drivers / Envy24 / pci_wrapper.h
blob802a89d88aa94302315c717885359c6d2fdf08bd
1 /*
2 Copyright © 2004-2016, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #ifndef PCI_WRAPPER_H
7 #define PCI_WRAPPER_H
9 #ifndef EXEC_TYPES_H
10 # include <exec/types.h>
11 #endif
13 #include "DriverData.h"
15 #undef PCI_COMMAND
16 #undef PCI_COMMAND_IO
17 #undef PCI_COMMAND_MEMORY
18 #undef PCI_COMMAND_MASTER
19 #undef PCI_BASE_ADDRESS_IO_MASK
20 #undef PCI_REVISION_ID
21 #undef PCI_SUBSYSTEM_ID
22 #undef PCI_DEVICE_ID
23 #undef PCI_SUBSYSTEM_VENDOR_ID
26 #define PCI_COMMAND 4
27 #define PCI_COMMAND_IO 1
28 #define PCI_COMMAND_MEMORY 2
29 #define PCI_COMMAND_MASTER 4
31 #define PCI_BASE_ADDRESS_0 0x10
33 #define PCI_BASE_ADDRESS_IO_MASK (~0x3UL)
35 #define PCI_REVISION_ID 8
36 #define PCI_SUBSYSTEM_ID 0x2e
37 #define PCI_DEVICE_ID 2
38 #define PCI_SUBSYSTEM_VENDOR_ID 0x2c
40 #ifdef __amigaos4__
41 #define ALLOCVEC IExec->AllocVec
42 #define FREEVEC IExec->FreeVec
43 #define DEBUGPRINTF IExec->DebugPrintF
44 #define CAUSE IExec->Cause
45 #define CALLHOOK IUtility->CallHookPkt
46 #define INITSEMAPHORE IExec->InitSemaphore
47 #define OBTAINSEMAPHORE IExec->ObtainSemaphore
48 #define RELEASESEMAPHORE IExec->ReleaseSemaphore
49 #define CREATEPORT(a, b) IExec->CreatePort(a, b)
50 #define CREATEIOREQUEST IExec->CreateIORequest
51 #define OPENDEVICE IExec->OpenDevice
52 #define DOIO IExec->DoIO
53 #define DELETEIOREQUEST IExec->DeleteIORequest
54 #define CLOSEDEVICE IExec->CloseDevice
55 #define DELETEPORT IExec->DeletePort
56 #define GETTAGDATA IUtility->GetTagData
57 #define IRQTYPE INTERRUPT_NODE_TYPE
58 #define DELAY IDOS->Delay
59 #elif __AROS__
60 #include <aros/debug.h>
61 #define ALLOCVEC AllocVec
62 #define FREEVEC FreeVec
63 #define DEBUGPRINTF kprintf
64 #define CAUSE Cause
65 #define CALLHOOK CallHookA
66 #define INITSEMAPHORE InitSemaphore
67 #define OBTAINSEMAPHORE ObtainSemaphore
68 #define RELEASESEMAPHORE ReleaseSemaphore
69 #define CREATEPORT(a, b) CreateMsgPort()
70 #define CREATEIOREQUEST CreateIORequest
71 #define OPENDEVICE OpenDevice
72 #define DOIO DoIO
73 #define DELETEIOREQUEST DeleteIORequest
74 #define CLOSEDEVICE CloseDevice
75 #define DELETEPORT DeleteMsgPort
76 #define GETTAGDATA GetTagData
77 #define IRQTYPE NT_INTERRUPT
78 #define DELAY Delay
79 #else
80 #include <clib/debug_protos.h>
81 #define ALLOCVEC AllocVec
82 #define FREEVEC FreeVec
83 #define DEBUGPRINTF kprintf
84 #define CAUSE Cause
85 #define CALLHOOK CallHookPkt
86 #define INITSEMAPHORE InitSemaphore
87 #define OBTAINSEMAPHORE ObtainSemaphore
88 #define RELEASESEMAPHORE ReleaseSemaphore
89 #define CREATEPORT(a, b) CreateMsgPort()
90 #define CREATEIOREQUEST CreateIORequest
91 #define OPENDEVICE OpenDevice
92 #define DOIO DoIO
93 #define DELETEIOREQUEST DeleteIORequest
94 #define CLOSEDEVICE CloseDevice
95 #define DELETEPORT DeleteMsgPort
96 #define GETTAGDATA GetTagData
97 #define IRQTYPE INTERRUPT_NODE_TYPE
98 #define DELAY Delay
99 #define bug kprintf
100 #endif
102 #ifndef __MORPHOS__
103 #define INBYTE(a) pci_inb((a), card)
104 #define INWORD(a) pci_inw((a), card)
105 #define INLONG(a) pci_inl((a), card)
106 #define OUTBYTE(addr, val) pci_outb((val), (addr), card)
107 #define OUTWORD(addr, val) pci_outw((val), (addr), card)
108 #define OUTLONG(addr, val) pci_outl((val), (addr), card)
109 #else
110 #define INBYTE(a) ahi_pci_inb((a), 0)
111 #define INWORD(a) ahi_pci_inw((a), 0)
112 #define INLONG(a) ahi_pci_inl((a), 0)
113 #define OUTBYTE(addr, val) ahi_pci_outb((val), (addr), 0)
114 #define OUTWORD(addr, val) ahi_pci_outw((val), (addr), 0)
115 #define OUTLONG(addr, val) ahi_pci_outl((val), (addr), 0)
116 #endif
118 #define READCONFIGBYTE(reg) inb_config((reg), dev)
119 #define READCONFIGWORD(reg) inw_config((reg), dev)
121 #define WRITECONFIGWORD(reg, val) outw_config((reg), (val), dev)
123 BOOL ahi_pci_init(struct DriverBase* AHIsubBase);
124 void ahi_pci_exit(void);
126 APTR ahi_pci_find_device(ULONG vendorid, ULONG deviceid, APTR dev);
128 #ifndef __MORPHOS__
129 ULONG pci_inl(ULONG addr, struct CardData *card);
130 UWORD pci_inw(ULONG addr, struct CardData *card);
131 UBYTE pci_inb(ULONG addr, struct CardData *card);
133 void pci_outl(ULONG value, ULONG addr, struct CardData *card);
134 void pci_outw(UWORD value, ULONG addr, struct CardData *card);
135 void pci_outb(UBYTE value, ULONG addr, struct CardData *card);
137 ULONG pci_inl_mt(ULONG addr, struct CardData *card);
138 UWORD pci_inw_mt(ULONG addr, struct CardData *card);
139 UBYTE pci_inb_mt(ULONG addr, struct CardData *card);
141 void pci_outl_mt(ULONG value, ULONG addr, struct CardData *card);
142 void pci_outw_mt(UWORD value, ULONG addr, struct CardData *card);
143 void pci_outb_mt(UBYTE value, ULONG addr, struct CardData *card);
144 #else
145 ULONG ahi_pci_inl(ULONG addr, APTR dev);
146 UWORD ahi_pci_inw(ULONG addr, APTR dev);
147 UBYTE ahi_pci_inb(ULONG addr, APTR dev);
148 void ahi_pci_outl(ULONG value, ULONG addr, APTR dev);
149 void ahi_pci_outw(UWORD value, ULONG addr, APTR dev);
150 void ahi_pci_outb(UBYTE value, ULONG addr, APTR dev);
151 #endif
153 void outb_setbits(UBYTE value, ULONG addr, struct CardData *card);
154 void outw_setbits(UWORD value, ULONG addr, struct CardData *card);
155 void outl_setbits(ULONG value, ULONG addr, struct CardData *card);
156 void outb_clearbits(UBYTE value, ULONG addr, struct CardData *card);
157 void outw_clearbits(UWORD value, ULONG addr, struct CardData *card);
158 void outl_clearbits(ULONG value, ULONG addr, struct CardData *card);
160 ULONG inl_config(UBYTE reg, APTR dev);
161 UWORD inw_config(UBYTE reg, APTR dev);
162 UBYTE inb_config(UBYTE reg, APTR dev);
164 void outl_config(UBYTE reg, ULONG val, APTR dev);
165 void outw_config(UBYTE reg, UWORD val, APTR dev);
166 void outb_config(UBYTE reg, UBYTE val, APTR dev);
168 ULONG ahi_pci_get_irq(APTR dev);
170 BOOL ahi_pci_add_intserver(struct Interrupt *i, APTR dev);
171 void ahi_pci_rem_intserver(struct Interrupt *i, APTR dev);
173 APTR ahi_pci_logic_to_physic_addr(APTR addr, APTR dev);
175 APTR ahi_pci_get_base_address(WORD which, APTR dev);
176 ULONG ahi_pci_get_base_size(WORD which, APTR dev);
177 ULONG ahi_pci_get_type(WORD which, APTR dev);
178 ULONG ahi_pci_mem_map(APTR addr, APTR dev);
180 #ifdef __AROS__
181 #include <aros/debug.h>
182 #define DebugPrintF bug
183 #define NT_EXTINTERRUPT NT_INTERRUPT
184 #endif
186 #endif