added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / arch / common / hidd.radeon / ati.h
blob163994a9e7a4bf595e8907368012da500daa345e
1 #ifndef _ATI_H
2 #define _ATI_H
4 /*
5 Copyright © 2004-2007, The AROS Development Team. All rights reserved.
6 $Id$
7 */
9 #include <exec/types.h>
10 #include <exec/libraries.h>
11 #include <exec/execbase.h>
12 #include <exec/nodes.h>
13 #include <exec/lists.h>
14 #include <exec/semaphores.h>
15 #include <exec/memory.h>
16 #include <dos/bptr.h>
18 #include <aros/libcall.h>
19 #include <aros/asmcall.h>
21 #include <hidd/graphics.h>
23 #include <oop/oop.h>
25 #include <aros/arossupportbase.h>
26 #include <exec/execbase.h>
28 #include "radeon.h"
30 #include LC_LIBDEFS_FILE
32 #define IID_Hidd_Gfx_Ati "IRadeonDriver"
33 #define IID_Hidd_ATIBitMap "IRadeonBitmap"
34 #define CLID_Hidd_Gfx_Ati "RadeonDriver"
36 extern OOP_AttrBase HiddPCIDeviceAttrBase;
37 extern OOP_AttrBase HiddBitMapAttrBase;
38 extern OOP_AttrBase HiddPixFmtAttrBase;
39 extern OOP_AttrBase HiddSyncAttrBase;
40 extern OOP_AttrBase HiddGfxAttrBase;
41 extern OOP_AttrBase HiddATIBitMapAttrBase;
42 extern OOP_AttrBase HiddI2CAttrBase;
43 extern OOP_AttrBase HiddI2CDeviceAttrBase;
44 extern OOP_AttrBase __IHidd_PlanarBM;
46 enum {
47 aoHidd_ATIBitMap_Drawable,
49 num_Hidd_ATIBitMap_Attrs
52 #define aHidd_ATIBitMap_Drawable (HiddATIBitMapAttrBase + aoHidd_ATIBitMap_Drawable)
54 #define IS_BM_ATTR(attr, idx) (((idx)=(attr)-HiddBitMapAttrBase) < num_Hidd_BitMap_Attrs)
55 #define IS_ATIBM_ATTR(attr, idx) (((idx)=(attr)-HiddATIBitMapAttrBase) < num_Hidd_ATIBitMap_Attrs)
57 typedef struct __bm {
58 struct SignalSemaphore bmLock;
60 OOP_Object *BitMap; // BitMap OOP Object
61 IPTR framebuffer; // Points to pixel data
62 ULONG width; // Bitmap width
63 ULONG height; // Bitmap height
64 ULONG pitch; // BytesPerRow aligned
65 UBYTE depth; // Bitmap depth
66 UBYTE bpp; // BytesPerPixel
67 UBYTE onbm; // is onbitmap?
68 UBYTE fbgfx; // is framebuffer in gfx memory
69 ULONG usecount; // counts BitMap accesses
71 ULONG dp_gui_master_cntl;
72 ULONG dp_gui_master_cntl_clip;
73 ULONG pitch_offset;
74 UBYTE datatype;
76 ULONG surface_format;
77 ULONG pattern_format;
78 ULONG rect_format;
79 ULONG line_format;
81 struct CardState *state;
82 } atiBitMap;
84 struct ati_staticdata {
85 struct SignalSemaphore HWLock; /* Hardware exclusive semaphore */
86 struct SignalSemaphore MultiBMLock; /* To lock more than one bitmap at a time */
88 APTR memPool;
90 struct MemHeader CardMem;
92 struct Card Card;
93 struct CardState *poweron_state;
94 IPTR scratch_buffer;
96 OOP_Object *AtiObject;
97 OOP_Object *PCIObject;
98 OOP_Object *PCIDevice;
99 OOP_Object *PCIDriver;
101 OOP_Class *AtiClass;
102 OOP_Class *AtiI2C;
103 OOP_Class *OnBMClass;
104 OOP_Class *OffBMClass;
105 OOP_Class *PlanarBMClass;
107 OOP_AttrBase pciAttrBase;
108 OOP_AttrBase atiBitMapAttrBase;
109 OOP_AttrBase bitMapAttrBase;
110 OOP_AttrBase pixFmtAttrBase;
111 OOP_AttrBase gfxAttrBase;
112 OOP_AttrBase syncAttrBase;
113 OOP_AttrBase i2cAttrBase;
114 OOP_AttrBase i2cDeviceAttrBase;
115 OOP_AttrBase planarAttrBase;
117 OOP_MethodID mid_ReadLong;
118 OOP_MethodID mid_CopyMemBox8;
119 OOP_MethodID mid_CopyMemBox16;
120 OOP_MethodID mid_CopyMemBox32;
121 OOP_MethodID mid_PutMem32Image8;
122 OOP_MethodID mid_PutMem32Image16;
123 OOP_MethodID mid_GetMem32Image8;
124 OOP_MethodID mid_GetMem32Image16;
125 OOP_MethodID mid_GetImage;
126 OOP_MethodID mid_Clear;
127 OOP_MethodID mid_PutMemTemplate8;
128 OOP_MethodID mid_PutMemTemplate16;
129 OOP_MethodID mid_PutMemTemplate32;
130 OOP_MethodID mid_PutMemPattern8;
131 OOP_MethodID mid_PutMemPattern16;
132 OOP_MethodID mid_PutMemPattern32;
133 OOP_MethodID mid_CopyLUTMemBox16;
134 OOP_MethodID mid_CopyLUTMemBox32;
136 HIDDT_DPMSLevel dpms;
139 struct atibase {
140 struct Library LibNode;
141 struct ati_staticdata sd;
144 struct planarbm_data
146 UBYTE **planes;
147 ULONG planebuf_size;
148 ULONG bytesperrow;
149 ULONG rows;
150 UBYTE depth;
151 BOOL planes_alloced;
154 #define BASE(lib) ((struct atibase*)(lib))
156 #define SD(cl) (&BASE(cl->UserData)->sd)
158 #define METHOD(base, id, name) \
159 base ## __ ## id ## __ ## name (OOP_Class *cl, OOP_Object *o, struct p ## id ## _ ## name *msg)
161 #define METHOD_NAME(base, id, name) \
162 base ## __ ## id ## __ ## name
164 #define METHOD_NAME_S(base, id, name) \
165 # base "__" # id "__" # name
168 #define LOCK_HW { ObtainSemaphore(&sd->HWLock); }
169 #define UNLOCK_HW { ReleaseSemaphore(&sd->HWLock); }
171 #define LOCK_BITMAP { ObtainSemaphore(&bm->bmLock); }
172 #define UNLOCK_BITMAP { ReleaseSemaphore(&bm->bmLock); }
174 #define LOCK_BITMAP_BM(bm) { ObtainSemaphore(&(bm)->bmLock); }
175 #define UNLOCK_BITMAP_BM(bm) { ReleaseSemaphore(&(bm)->bmLock); }
177 #define LOCK_MULTI_BITMAP { ObtainSemaphore(&sd->MultiBMLock); }
178 #define UNLOCK_MULTI_BITMAP { ReleaseSemaphore(&sd->MultiBMLock); }
180 #endif /* _ATI_H */