2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Serial hidd initialization code.
9 #include <exec/types.h>
11 #include <proto/exec.h>
13 #include "serial_intern.h"
18 /* Customize libheader.c */
19 #define LC_SYSBASE_FIELD(lib) (((LIBBASETYPEPTR)(lib))->hdg_SysBase)
20 #define LC_SEGLIST_FIELD(lib) (((LIBBASETYPEPTR)(lib))->hdg_SegList)
21 #define LC_RESIDENTNAME hiddserial_resident
22 #define LC_RESIDENTFLAGS RTF_AUTOINIT
23 #define LC_RESIDENTPRI 0
24 #define LC_LIBBASESIZE sizeof(LIBBASETYPE)
25 #define LC_LIBHEADERTYPEPTR LIBBASETYPEPTR
26 #define LC_LIB_FIELD(lib) (((LIBBASETYPEPTR)(lib))->hdg_LibNode)
29 #define LC_NO_CLOSELIB
31 /* to avoid removing the serialhiddclass from memory add #define NOEXPUNGE */
33 #include <libcore/libheader.c>
38 #include <aros/debug.h>
40 #define sysBase (LC_SYSBASE_FIELD(lh))
42 struct ExecBase
* SysBase
;
44 ULONG SAVEDS STDARGS
LC_BUILDNAME(L_InitLib
) (LC_LIBHEADERTYPEPTR lh
)
46 struct class_static_data
*csd
; /* SerialHidd static data */
49 EnterFunc(bug("SerialHIDD_Init()\n"));
52 We map the memory into the shared memory space, because it is
53 to be accessed by many processes, eg searching for a HIDD etc.
55 Well, maybe once we've got MP this might help...:-)
57 csd
= AllocVec(sizeof(struct class_static_data
), MEMF_CLEAR
|MEMF_PUBLIC
);
61 csd
->sysbase
= sysBase
;
65 csd
->oopbase
= OpenLibrary(AROSOOP_NAME
, 0);
68 D(bug(" Got OOPBase\n"));
69 csd
->utilitybase
= OpenLibrary("utility.library", 37);
72 D(bug(" Got UtilityBase\n"));
74 csd
->serialhiddclass
= init_serialhiddclass(csd
);
76 D(bug(" SerialHiddClass: %p\n", csd
->serialhiddclass
));
78 if(csd
->serialhiddclass
)
80 D(bug(" Got SerialHIDDClass\n"));
81 ReturnInt("SerialHIDD_Init", ULONG
, TRUE
);
84 CloseLibrary(csd
->utilitybase
);
86 CloseLibrary(csd
->oopbase
);
94 ReturnInt("SerialHIDD_Init", ULONG
, FALSE
);
99 void SAVEDS STDARGS
LC_BUILDNAME(L_ExpungeLib
) (LC_LIBHEADERTYPEPTR lh
)
101 EnterFunc(bug("SerialHIDD_Expunge()\n"));
105 free_serialhiddclass(lh
->hdg_csd
);
107 CloseLibrary(lh
->hdg_csd
->utilitybase
);
108 CloseLibrary(lh
->hdg_csd
->oopbase
);
110 FreeVec(lh
->hdg_csd
);
113 ReturnVoid("SerialHIDD_Expunge");