Changeset e50cd7f in mainline for uspace/drv/usbhub/usbhub_private.h


Ignore:
Timestamp:
2011-04-17T19:17:55Z (14 years ago)
Author:
Matej Klonfar <maklf@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
63517c2, cfbbe1d3
Parents:
ef354b6 (diff), 8595577b (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:

new report structure fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbhub/usbhub_private.h

    ref354b6 re50cd7f  
    5454//
    5555//************
    56 #define usb_new(type) (type*)malloc(sizeof(type))
    5756
    5857
    59 /**
    60  * Create hub structure instance
    61  *
    62  * Set the address and port count information most importantly.
    63  *
    64  * @param device
    65  * @param hc host controller phone
    66  * @return
    67  */
    6858usb_hub_info_t * usb_create_hub_info(ddf_dev_t * device);
    6959
     
    110100
    111101/**
    112  * create uint8_t array with serialized descriptor
     102 * Clear feature on hub port.
    113103 *
    114  * @param descriptor
    115  * @return newly created serializd descriptor pointer
     104 * @param hc Host controller telephone
     105 * @param address Hub address
     106 * @param port_index Port
     107 * @param feature Feature selector
     108 * @return Operation result
    116109 */
    117 void * usb_serialize_hub_descriptor(usb_hub_descriptor_t * descriptor);
     110static inline int usb_hub_set_port_feature(usb_pipe_t *pipe,
     111    int port_index,
     112    usb_hub_class_feature_t feature) {
     113
     114        usb_device_request_setup_packet_t clear_request = {
     115                .request_type = USB_HUB_REQ_TYPE_SET_PORT_FEATURE,
     116                .request = USB_DEVREQ_SET_FEATURE,
     117                .length = 0,
     118                .index = port_index
     119        };
     120        clear_request.value = feature;
     121        return usb_pipe_control_write(pipe, &clear_request,
     122            sizeof(clear_request), NULL, 0);
     123}
     124
    118125
    119126/**
    120  * create deserialized desriptor structure out of serialized descriptor
     127 * Clear feature on hub port.
    121128 *
    122  * The serialized descriptor must be proper usb hub descriptor,
    123  * otherwise an eerror might occur.
     129 * @param pipe pipe to hub control endpoint
     130 * @param feature Feature selector
     131 * @return Operation result
     132 */
     133static inline int usb_hub_clear_feature(usb_pipe_t *pipe,
     134    usb_hub_class_feature_t feature) {
     135
     136        usb_device_request_setup_packet_t clear_request = {
     137                .request_type = USB_HUB_REQ_TYPE_CLEAR_HUB_FEATURE,
     138                .request = USB_DEVREQ_CLEAR_FEATURE,
     139                .length = 0,
     140                .index = 0
     141        };
     142        clear_request.value = feature;
     143        return usb_pipe_control_write(pipe, &clear_request,
     144            sizeof(clear_request), NULL, 0);
     145}
     146
     147/**
     148 * Clear feature on hub port.
    124149 *
    125  * @param sdescriptor serialized descriptor
    126  * @return newly created deserialized descriptor pointer
     150 * @param pipe pipe to hub control endpoint
     151 * @param feature Feature selector
     152 * @return Operation result
    127153 */
    128 usb_hub_descriptor_t * usb_deserialize_hub_desriptor(void * sdescriptor);
     154static inline int usb_hub_set_feature(usb_pipe_t *pipe,
     155    usb_hub_class_feature_t feature) {
     156
     157        usb_device_request_setup_packet_t clear_request = {
     158                .request_type = USB_HUB_REQ_TYPE_CLEAR_HUB_FEATURE,
     159                .request = USB_DEVREQ_SET_FEATURE,
     160                .length = 0,
     161                .index = 0
     162        };
     163        clear_request.value = feature;
     164        return usb_pipe_control_write(pipe, &clear_request,
     165            sizeof(clear_request), NULL, 0);
     166}
     167
     168
     169void * usb_create_serialized_hub_descriptor(usb_hub_descriptor_t * descriptor);
     170
     171void usb_serialize_hub_descriptor(usb_hub_descriptor_t * descriptor,
     172    void * serialized_descriptor);
     173
     174usb_hub_descriptor_t * usb_create_deserialized_hub_desriptor(
     175    void * serialized_descriptor);
     176
     177void usb_deserialize_hub_desriptor(void * serialized_descriptor,
     178    usb_hub_descriptor_t * descriptor);
    129179
    130180
Note: See TracChangeset for help on using the changeset viewer.