Project

General

Profile

Statistics
| Revision:

root / lab4 / .minix-src / include / minix / devman.h @ 13

History | View | Annotate | Download (1.77 KB)

1
#ifndef MINIX_LIBDEVMAN_H
2
#define MINIX_LIBDEVMAN_H
3
#include <minix/com.h>
4
#include <minix/ipc.h>
5
#include <minix/usb_ch9.h>
6

    
7
/* used for serializing */
8
struct devman_device_info {
9
        int count;
10
        int parent_dev_id;
11
        unsigned name_offset;
12
        unsigned subsystem_offset;
13
};
14

    
15
struct devman_device_info_entry {
16
        unsigned type;
17
        unsigned name_offset;
18
        unsigned data_offset;
19
        unsigned req_nr;
20
};
21

    
22
#ifndef DEVMAN_SERVER
23
struct devman_usb_bind_cb_data {
24
        int dev_id;
25
        int interface;
26
};
27

    
28
struct devman_usb_interface {
29
        struct devman_dev *dev;
30
        struct devman_usb_dev *usb_dev;
31
        usb_interface_descriptor_t *desc;
32
        /* used by the lib */
33
        struct devman_usb_bind_cb_data cb_data;
34
};
35

    
36
struct devman_usb_dev {
37
        struct devman_dev *dev;
38
        int    dev_id;            /* The ID identifying the device 
39
                                                                         on server side */
40
        usb_device_descriptor_t *desc;
41

    
42
        int    configuration;        /* the configuration used for this
43
                                        device */
44
        
45
        char   *manufacturer;
46
        char   *product;
47
        char   *serial;
48

    
49
        int    intf_count;          /* the number of interfaces in the current
50
                                       configuration */
51

    
52
        struct devman_usb_interface interfaces[32];
53
        /* used by the lib */
54
        struct devman_usb_bind_cb_data cb_data;
55
};
56

    
57
typedef int (*devman_usb_bind_cb_t)(struct devman_usb_bind_cb_data *data, endpoint_t ep);
58

    
59
int devman_add_device(struct devman_dev *dev);
60
int devman_del_device(struct devman_dev *dev);
61
int devman_init(void);
62
struct devman_usb_dev* devman_usb_device_new(int dev_id);
63
int devman_usb_device_add(struct devman_usb_dev *dev);
64
int devman_usb_device_remove(struct devman_usb_dev *dev);
65
void devman_usb_device_delete(struct devman_usb_dev *udev);
66
int devman_handle_msg(message *m);
67
void devman_usb_init(devman_usb_bind_cb_t bind_cb, devman_usb_bind_cb_t
68
        unbind_cb);
69

    
70
#endif
71

    
72
#endif