Indentation fix, cleanup.
[AROS.git] / rom / exec / adddevice.c
blob33388a720f198a6996650c8664df57d8255417d4
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Add a device to the public list of devices.
6 Lang: english
7 */
8 #include <aros/debug.h>
9 #include <exec/execbase.h>
10 #include <exec/devices.h>
11 #include <aros/libcall.h>
12 #include <proto/exec.h>
14 /*****************************************************************************
16 NAME */
18 AROS_LH1(void, AddDevice,
20 /* SYNOPSIS */
21 AROS_LHA(struct Device *, device,A1),
23 /* LOCATION */
24 struct ExecBase *, SysBase, 72, Exec)
26 /* FUNCTION
27 Adds a given device to the system's device list after checksumming
28 the device vectors. This function is not for general use but
29 (of course) for building devices that don't use exec's MakeLibrary()
30 mechanism.
32 INPUTS
33 device - Pointer to a ready for use device structure.
35 RESULT
37 NOTES
39 EXAMPLE
41 BUGS
43 SEE ALSO
44 RemDevice(), OpenDevice(), CloseDevice()
46 INTERNALS
48 ******************************************************************************/
50 AROS_LIBFUNC_INIT
51 ASSERT_VALID_PTR(device);
53 /* Just in case the user forgot them */
54 device->dd_Library.lib_Node.ln_Type=NT_DEVICE;
55 device->dd_Library.lib_Flags|=LIBF_CHANGED;
57 /* Build checksum for device vectors */
58 SumLibrary(&device->dd_Library);
60 /* Arbitrate for the device list */
61 Forbid();
63 /* And add the device */
64 Enqueue(&SysBase->DeviceList,&device->dd_Library.lib_Node);
66 /* All done. */
67 Permit();
68 AROS_LIBFUNC_EXIT
69 } /* AddDevice */