First try in keyboard driver
[incOS.git] / programs / include / cdi.h
blobf88aa4ce2067962b8da7adee5f09f67cdfc2f4c4
2 /*
3 * Copyright (c) 2007 Kevin Wolf
5 * This program is free software. It comes without any warranty, to
6 * the extent permitted by applicable law. You can redistribute it
7 * and/or modify it under the terms of the Do What The Fuck You Want
8 * To Public License, Version 2, as published by Sam Hocevar. See
9 * http://sam.zoy.org/projects/COPYING.WTFPL for more details.
10 */
12 #ifndef CDI_H_INCLUDED
13 #define CDI_H_INCLUDED
15 #include <cdi/lists.h>
17 #define CDI_STANDALONE
19 typedef enum
21 CDI_UNKNOWN = 0,
22 CDI_NETWORK = 1,
23 CDI_STORAGE = 2,
24 CDI_VIDEO = 3
25 } cdi_device_type_t;
27 struct cdi_driver;
28 struct cdi_device
30 cdi_device_type_t type;
31 const char *name;
32 struct cdi_driver *driver;
35 struct cdi_driver
37 cdi_device_type_t type;
38 const char *name;
39 cdi_list_t devices;
41 void (*init_device)(struct cdi_device *device);
42 void (*remove_device)(struct cdi_device *device);
44 void (*destroy)(struct cdi_driver *driver);
47 /**
48 * Has to be called before any other calls to CDI functions. Initialized the CDI
49 * framework.
51 * Subsequent calls don't have any effect on the progam.
53 void cdi_init(void);
55 /**
56 * Executes all registered drivers. This function does not necessarily return to
57 * the calling code.
59 void cdi_run_drivers(void);
61 /**
62 * Initializes the data structures for a driver.
64 void cdi_driver_init(struct cdi_driver* driver);
66 /**
67 * Destroys the data structures for a driver.
69 void cdi_driver_destroy(struct cdi_driver* driver);
71 /**
72 * Registers the driver for a new device.
74 * \param driver Driver to be registered
76 void cdi_driver_register(struct cdi_driver* driver);
78 #endif