Fixed compatibility of output.
[AROS.git] / arch / .unmaintained / m68k-pp-native / Drivers / touchscreen.hidd / touchscreen_init.c
blob6f15548a4787865b93d6cfd2ba36d3ed3ff801c2
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Touchscreen hidd
6 Lang: english
7 */
8 #include <exec/types.h>
9 #include <exec/lists.h>
10 #include <exec/interrupts.h>
11 #include <proto/exec.h>
12 #include <proto/oop.h>
13 #include <oop/oop.h>
14 #include <utility/utility.h>
16 #include "touchscreen.h"
18 #undef SysBase
19 //#define SysBase (*(struct ExecBase **)4UL)
20 //#define SysBase (LC_SYSBASE_FIELD(lh))
22 /* Customize libheader.c */
23 #define LC_SYSBASE_FIELD(lib) (((LIBBASETYPEPTR )(lib))->sysbase)
24 #define LC_SEGLIST_FIELD(lib) (((LIBBASETYPEPTR )(lib))->seglist)
25 #define LC_RESIDENTNAME touchscreenHidd_resident
26 #define LC_RESIDENTFLAGS RTF_AUTOINIT|RTF_COLDSTART
27 #define LC_RESIDENTPRI 9
28 #define LC_LIBBASESIZE sizeof(LIBBASETYPE)
29 #define LC_LIBHEADERTYPEPTR LIBBASETYPEPTR
30 #define LC_LIB_FIELD(lib) (((LIBBASETYPEPTR)(lib))->library)
32 #define LC_NO_INITLIB
33 #define LC_NO_EXPUNGELIB
34 #define LC_NO_CLOSELIB
37 #define NOEXPUNGE
39 struct touchscreenbase
41 struct Library library;
42 struct ExecBase *sysbase;
43 BPTR seglist;
46 #include <libcore/libheader.c>
48 #undef SDEBUG
49 #undef DEBUG
50 #define DEBUG 0
51 #include <aros/debug.h>
53 #define SysBase (LC_SYSBASE_FIELD(lh))
55 ULONG SAVEDS STDARGS LC_BUILDNAME(L_OpenLib) (LC_LIBHEADERTYPEPTR lh)
57 struct mouse_staticdata *tsd;
59 D(bug("_touchscreen: Initializing\n"));
61 tsd = AllocMem( sizeof (struct mouse_staticdata), MEMF_CLEAR|MEMF_PUBLIC );
62 if (tsd) {
63 InitSemaphore(&tsd->sema);
64 tsd->sysbase = SysBase;
65 tsd->oopbase = OpenLibrary(AROSOOP_NAME, 0);
66 if (tsd->oopbase) {
67 tsd->utilitybase = OpenLibrary(UTILITYNAME, 37);
68 if (tsd->utilitybase) {
69 if (_init_mouseclass(tsd)) {
70 D(bug("----------- Successfully initialized mouseclass!\n"));
71 return TRUE;
74 CloseLibrary(tsd->oopbase);
76 FreeMem(tsd, sizeof (struct mouse_staticdata));
78 return FALSE;