Changeset 747ef72 in mainline for uspace/lib/usbdev/include


Ignore:
Timestamp:
2011-11-10T11:29:10Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
54464f6a, c2245a3, c6f189f7
Parents:
2e1b9dc (diff), 2d1ba51 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge USB changes.

Interface changes:

  • GET_ADDRESS has been renamed to GET_MY_ADDRESS and the handle parameter was dropped. Tis call no longer cascades up to the root hub, but it is answered in the first place the information is available (nearest hub)
  • Reintroduced address reservation for USB_DEFAULT_ADDRESS. The interface now enables device drivers to request specific address on initialization and either insists on that address or accept any other if the address is not available. Note that it is not possible to get the default address if the driver does not insist.
  • Any endpoint registered is removed when address is released and a warning is produced if there were any such endpoints.
  • It is no longer necessary or possible to pass device speed information when registering endpoints.

Driver fixes: memory leaks and crashes (not only) in error paths.
Fixes or removes flaky device_remove implementation in device drivers.

Location:
uspace/lib/usbdev/include/usb/dev
Files:
7 edited

Legend:

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

    r2e1b9dc r747ef72  
    5454} usb_dp_descriptor_nesting_t;
    5555
    56 extern usb_dp_descriptor_nesting_t usb_dp_standard_descriptor_nesting[];
     56extern const usb_dp_descriptor_nesting_t usb_dp_standard_descriptor_nesting[];
    5757
    5858/** Descriptor parser structure. */
  • uspace/lib/usbdev/include/usb/dev/driver.h

    r2e1b9dc r747ef72  
    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. RO: DO NOT TOUCH!*/
     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
     
    163159int usb_driver_main(const usb_driver_t *);
    164160
     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 *);
     164
    165165int usb_device_select_interface(usb_device_t *, uint8_t,
    166166    const usb_endpoint_description_t **);
    167167
    168168int usb_device_retrieve_descriptors(usb_pipe_t *, usb_device_descriptors_t *);
     169void usb_device_release_descriptors(usb_device_descriptors_t *);
     170
    169171int usb_device_create_pipes(const ddf_dev_t *, usb_device_connection_t *,
    170172    const usb_endpoint_description_t **, const uint8_t *, size_t, int, int,
    171173    usb_endpoint_mapping_t **, size_t *);
    172174int usb_device_destroy_pipes(const ddf_dev_t *, usb_endpoint_mapping_t *, size_t);
    173 int usb_device_init(usb_device_t *, ddf_dev_t *,
    174     const usb_endpoint_description_t **, const char **);
    175 void usb_device_deinit(usb_device_t *);
    176175
    177176void * usb_device_data_alloc(usb_device_t *, size_t);
    178177
    179178size_t usb_interface_count_alternates(const uint8_t *, size_t, uint8_t);
    180 int usb_alternate_interfaces_create(const uint8_t *, size_t, int,
    181     usb_alternate_interfaces_t **);
    182 void usb_alternate_interfaces_destroy(usb_alternate_interfaces_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 *);
    183182#endif
    184183/**
  • uspace/lib/usbdev/include/usb/dev/hub.h

    r2e1b9dc r747ef72  
    5959} usb_hub_attached_device_t;
    6060
    61 usb_address_t usb_hc_request_address(usb_hc_connection_t *, usb_speed_t);
     61usb_address_t usb_hc_request_address(usb_hc_connection_t *, usb_address_t,
     62    bool, usb_speed_t);
    6263int usb_hc_register_device(usb_hc_connection_t *,
    6364    const usb_hub_attached_device_t *);
  • uspace/lib/usbdev/include/usb/dev/pipes.h

    r2e1b9dc r747ef72  
    141141typedef struct {
    142142        /** Endpoint pipe. */
    143         usb_pipe_t *pipe;
     143        usb_pipe_t pipe;
    144144        /** Endpoint description. */
    145145        const usb_endpoint_description_t *description;
     
    149149        int interface_setting;
    150150        /** Found descriptor fitting the description. */
    151         usb_standard_endpoint_descriptor_t *descriptor;
     151        const usb_standard_endpoint_descriptor_t *descriptor;
    152152        /** Interface descriptor the endpoint belongs to. */
    153         usb_standard_interface_descriptor_t *interface;
     153        const usb_standard_interface_descriptor_t *interface;
    154154        /** Whether the endpoint was actually found. */
    155155        bool present;
     
    172172int usb_pipe_initialize_from_configuration(usb_endpoint_mapping_t *,
    173173    size_t, const uint8_t *, size_t, usb_device_connection_t *);
    174 int usb_pipe_register_with_speed(usb_pipe_t *, usb_speed_t,
    175     unsigned int, usb_hc_connection_t *);
    176174int usb_pipe_register(usb_pipe_t *, unsigned int, usb_hc_connection_t *);
    177175int usb_pipe_unregister(usb_pipe_t *, usb_hc_connection_t *);
  • uspace/lib/usbdev/include/usb/dev/poll.h

    r2e1b9dc r747ef72  
    8484} usb_device_auto_polling_t;
    8585
    86 int usb_device_auto_polling(usb_device_t *, size_t, usb_device_auto_polling_t *,
    87     size_t, void *);
     86int usb_device_auto_polling(usb_device_t *, size_t,
     87    const usb_device_auto_polling_t *, size_t, void *);
    8888
    8989typedef bool (*usb_polling_callback_t)(usb_device_t *,
  • uspace/lib/usbdev/include/usb/dev/recognise.h

    r2e1b9dc r747ef72  
    5050int usb_device_create_match_ids(usb_pipe_t *, match_id_list_t *);
    5151
    52 int usb_device_register_child_in_devman(usb_address_t, devman_handle_t,
     52int usb_device_register_child_in_devman(usb_pipe_t *ctrl_pipe,
    5353    ddf_dev_t *, ddf_dev_ops_t *, void *, ddf_fun_t **);
    5454
  • uspace/lib/usbdev/include/usb/dev/request.h

    r2e1b9dc r747ef72  
    115115int usb_request_set_feature(usb_pipe_t *, usb_request_type_t,
    116116    usb_request_recipient_t, uint16_t, uint16_t);
    117 int usb_request_set_address(usb_pipe_t *, usb_address_t);
    118117int usb_request_get_descriptor(usb_pipe_t *, usb_request_type_t,
    119     usb_request_recipient_t, uint8_t, uint8_t, uint16_t, void *, size_t, 
     118    usb_request_recipient_t, uint8_t, uint8_t, uint16_t, void *, size_t,
    120119    size_t *);
    121120int usb_request_get_descriptor_alloc(usb_pipe_t *, usb_request_type_t,
     
    131130int usb_request_set_descriptor(usb_pipe_t *, usb_request_type_t,
    132131    usb_request_recipient_t, uint8_t, uint8_t, uint16_t, void *, size_t);
     132
    133133int usb_request_get_configuration(usb_pipe_t *, uint8_t *);
    134134int usb_request_set_configuration(usb_pipe_t *, uint8_t);
Note: See TracChangeset for help on using the changeset viewer.