Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbdev/include/usb/dev/driver.h

    r70452dd4 r7fc260ff  
    4343        usb_standard_device_descriptor_t device;
    4444        /** Full configuration descriptor of current configuration. */
    45         uint8_t *configuration;
     45        const uint8_t *configuration;
    4646        size_t configuration_size;
    4747} usb_device_descriptors_t;
     
    5353typedef struct {
    5454        /** Interface descriptor. */
    55         usb_standard_interface_descriptor_t *interface;
     55        const usb_standard_interface_descriptor_t *interface;
    5656        /** Pointer to start of descriptor tree bound with this interface. */
    57         uint8_t *nested_descriptors;
     57        const uint8_t *nested_descriptors;
    5858        /** Size of data pointed by nested_descriptors in bytes. */
    5959        size_t nested_descriptors_size;
     
    7272/** USB device structure. */
    7373typedef struct {
     74        /** Connection backing the pipes.
     75         * Typically, you will not need to use this attribute at all.
     76         */
     77        usb_device_connection_t wire;
    7478        /** The default control pipe. */
    7579        usb_pipe_t ctrl_pipe;
     
    8791        int interface_no;
    8892
    89         /** Alternative interfaces.
    90          * Set to NULL when the driver controls whole device
    91          * (i.e. more (or any) interfaces).
    92          */
    93         usb_alternate_interfaces_t *alternate_interfaces;
     93        /** Alternative interfaces. */
     94        usb_alternate_interfaces_t alternate_interfaces;
    9495
    9596        /** Some useful descriptors. */
    9697        usb_device_descriptors_t descriptors;
    9798
    98         /** Generic DDF device backing this one. */
     99        /** Generic DDF device backing this one. DO NOT TOUCH! */
    99100        ddf_dev_t *ddf_dev;
    100101        /** Custom driver data.
     
    103104         */
    104105        void *driver_data;
    105 
    106         /** Connection backing the pipes.
    107          * Typically, you will not need to use this attribute at all.
    108          */
    109         usb_device_connection_t wire;
    110106} usb_device_t;
    111107
    112108/** USB driver ops. */
    113109typedef struct {
    114         /** Callback when new device is about to be controlled by the driver. */
    115         int (*add_device)(usb_device_t *);
     110        /** Callback when a new device was added to the system. */
     111        int (*device_add)(usb_device_t *);
     112        /** Callback when a device is about to be removed from the system. */
     113        int (*device_rem)(usb_device_t *);
     114        /** Callback when a device was removed from the system. */
     115        int (*device_gone)(usb_device_t *);
    116116} usb_driver_ops_t;
    117117
     
    152152\endcode
    153153         */
    154         usb_endpoint_description_t **endpoints;
     154        const usb_endpoint_description_t **endpoints;
    155155        /** Driver ops. */
    156         usb_driver_ops_t *ops;
     156        const usb_driver_ops_t *ops;
    157157} usb_driver_t;
    158158
    159 int usb_driver_main(usb_driver_t *);
     159int usb_driver_main(const usb_driver_t *);
     160
     161int usb_device_init(usb_device_t *, ddf_dev_t *,
     162    const usb_endpoint_description_t **, const char **);
     163void usb_device_deinit(usb_device_t *);
    160164
    161165int usb_device_select_interface(usb_device_t *, uint8_t,
    162     usb_endpoint_description_t **);
     166    const usb_endpoint_description_t **);
    163167
    164168int usb_device_retrieve_descriptors(usb_pipe_t *, usb_device_descriptors_t *);
    165 int usb_device_create_pipes(ddf_dev_t *, usb_device_connection_t *,
    166     usb_endpoint_description_t **, uint8_t *, size_t, int, int,
     169void usb_device_release_descriptors(usb_device_descriptors_t *);
     170
     171int usb_device_create_pipes(const ddf_dev_t *, usb_device_connection_t *,
     172    const usb_endpoint_description_t **, const uint8_t *, size_t, int, int,
    167173    usb_endpoint_mapping_t **, size_t *);
    168 int usb_device_destroy_pipes(ddf_dev_t *, usb_endpoint_mapping_t *, size_t);
    169 int usb_device_create(ddf_dev_t *, usb_endpoint_description_t **, usb_device_t **, const char **);
    170 void usb_device_destroy(usb_device_t *);
     174int usb_device_destroy_pipes(const ddf_dev_t *, usb_endpoint_mapping_t *, size_t);
    171175
    172 size_t usb_interface_count_alternates(uint8_t *, size_t, uint8_t);
    173 int usb_alternate_interfaces_create(uint8_t *, size_t, int,
    174     usb_alternate_interfaces_t **);
     176void * usb_device_data_alloc(usb_device_t *, size_t);
    175177
     178size_t usb_interface_count_alternates(const uint8_t *, size_t, uint8_t);
     179int usb_alternate_interfaces_init(usb_alternate_interfaces_t *,
     180    const uint8_t *, size_t, int);
     181void usb_alternate_interfaces_deinit(usb_alternate_interfaces_t *);
    176182#endif
    177183/**
Note: See TracChangeset for help on using the changeset viewer.