2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: display Hidd for standalone palm AROS
9 #define __OOP_NOATTRBASES__
11 #include <exec/types.h>
12 #include <exec/lists.h>
13 #include <proto/exec.h>
14 #include <proto/oop.h>
16 #include <utility/utility.h>
19 #include "displayclass.h"
23 /* Customize libheader.c */
24 #define LC_SYSBASE_FIELD(lib) (((LIBBASETYPEPTR )(lib))->sysbase)
25 #define LC_SEGLIST_FIELD(lib) (((LIBBASETYPEPTR )(lib))->seglist)
26 #define LC_RESIDENTNAME displayHidd_resident
27 #define LC_RESIDENTFLAGS RTF_AUTOINIT|RTF_COLDSTART
28 #define LC_RESIDENTPRI 9
29 #define LC_LIBBASESIZE sizeof(LIBBASETYPE)
30 #define LC_LIBHEADERTYPEPTR LIBBASETYPEPTR
31 #define LC_LIB_FIELD(lib) (((LIBBASETYPEPTR)(lib))->library)
34 #define LC_NO_EXPUNGELIB
35 #define LC_NO_CLOSELIB
42 struct Library library
;
43 struct ExecBase
*sysbase
;
47 extern struct DisplayModeDesc DisplayDefMode
[];
49 #include <libcore/libheader.c>
54 #include <aros/debug.h>
56 #define SysBase (LC_SYSBASE_FIELD(lh))
62 #define OOPBase xsd->oopbase
64 //static OOP_AttrBase HiddPixFmtAttrBase; // = 0;
65 #define AROS_CREATE_ROM_BUG 1
67 #ifndef AROS_CREATE_ROM_BUG
68 static struct OOP_ABDescr abd
[] = {
69 { IID_Hidd_PixFmt
, &HiddPixFmtAttrBase
},
74 static VOID
freeclasses(struct display_staticdata
*xsd
);
76 static BOOL
initclasses(struct display_staticdata
*xsd
)
79 /* Get some attrbases */
80 __IHidd_PixFmt
= OOP_ObtainAttrBase(IID_Hidd_PixFmt
);
82 #ifndef AROS_CREATE_ROM_BUG
83 if (!OOP_ObtainAttrBases(abd
))
87 xsd
->displayclass
= init_displayclass(xsd
);
88 if (NULL
== xsd
->displayclass
)
91 xsd
->onbmclass
= init_onbmclass(xsd
);
92 if (NULL
== xsd
->onbmclass
)
95 xsd
->offbmclass
= init_offbmclass(xsd
);
96 if (NULL
== xsd
->offbmclass
)
108 static VOID
freeclasses(struct display_staticdata
*xsd
)
110 if (xsd
->displayclass
)
111 free_displayclass(xsd
);
114 free_offbmclass(xsd
);
119 #ifndef AROS_CREATE_ROM_BUG
120 OOP_ReleaseAttrBases(abd
);
127 ULONG SAVEDS STDARGS
LC_BUILDNAME(L_OpenLib
) (LC_LIBHEADERTYPEPTR lh
)
129 struct display_staticdata
*xsd
;
130 struct displayModeEntry
*entry
;
133 xsd
= AllocMem( sizeof (struct display_staticdata
), MEMF_CLEAR
|MEMF_PUBLIC
);
136 xsd
->sysbase
= SysBase
;
137 xsd
->displaybase
= lh
;
139 InitSemaphore(&xsd
->sema
);
140 InitSemaphore(&xsd
->HW_acc
);
141 NEWLIST(&xsd
->modelist
);
143 /* Insert default videomodes */
145 for (i
=0; i
<NUM_MODES
; i
++)
147 entry
= AllocMem(sizeof(struct DisplayModeEntry
),MEMF_CLEAR
|MEMF_PUBLIC
);
150 // entry->Desc=&(DisplayDefMode[i]);
151 ADDHEAD(&xsd
->modelist
,entry
);
152 D(bug("Added default mode: %s\n", entry
->Desc
->name
));
156 xsd
->oopbase
= OpenLibrary(AROSOOP_NAME
, 0);
160 xsd
->utilitybase
= OpenLibrary(UTILITYNAME
, 37);
161 if (xsd
->utilitybase
)
163 if (initclasses(xsd
))
165 D(bug("Everything OK\n"));
168 CloseLibrary(xsd
->utilitybase
);
170 CloseLibrary(xsd
->oopbase
);
172 if (entry
) FreeMem(entry
, sizeof(struct DisplayModeEntry
));
173 FreeMem(xsd
, sizeof (struct display_staticdata
));