Changeset b9e3aa3 in mainline for uspace/drv/usbhub/utils.c


Ignore:
Timestamp:
2011-05-30T14:13:53Z (14 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f3f9733
Parents:
2002595 (diff), 8357fc9 (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:

Development changes (a lot of stuff)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbhub/utils.c

    r2002595 rb9e3aa3  
    6262 * @return newly created serializd descriptor pointer
    6363 */
    64 void * usb_create_serialized_hub_descriptor(usb_hub_descriptor_t * descriptor) {
     64void * usb_create_serialized_hub_descriptor(usb_hub_descriptor_t *descriptor) {
    6565        //base size
    6666        size_t size = 7;
    6767        //variable size according to port count
    68         size_t var_size = (descriptor->ports_count+7)/8;
     68        size_t var_size = (descriptor->ports_count + 7) / 8;
    6969        size += 2 * var_size;
    7070        uint8_t * result = malloc(size);
    7171        //size
    72         if(result)
    73                 usb_serialize_hub_descriptor(descriptor,result);
     72        if (result)
     73                usb_serialize_hub_descriptor(descriptor, result);
    7474        return result;
    7575}
     
    8282 * @param serialized_descriptor
    8383 */
    84 void usb_serialize_hub_descriptor(usb_hub_descriptor_t * descriptor,
     84void usb_serialize_hub_descriptor(usb_hub_descriptor_t *descriptor,
    8585    void * serialized_descriptor) {
    8686        //base size
     
    8888        size_t size = 7;
    8989        //variable size according to port count
    90         size_t var_size = (descriptor->ports_count+7)/8;
     90        size_t var_size = (descriptor->ports_count + 7) / 8;
    9191        size += 2 * var_size;
    9292        //size
     
    110110}
    111111
    112 
    113112/**
    114113 * create deserialized desriptor structure out of serialized descriptor
     
    121120 */
    122121usb_hub_descriptor_t * usb_create_deserialized_hub_desriptor(
    123 void * serialized_descriptor) {
     122    void *serialized_descriptor) {
    124123        uint8_t * sdescriptor = serialized_descriptor;
    125124
     
    130129        }
    131130
    132         usb_hub_descriptor_t * result = malloc(sizeof(usb_hub_descriptor_t));
    133         if(result)
    134                 usb_deserialize_hub_desriptor(serialized_descriptor,result);
     131        usb_hub_descriptor_t * result = malloc(sizeof (usb_hub_descriptor_t));
     132        if (result)
     133                usb_deserialize_hub_desriptor(serialized_descriptor, result);
    135134        return result;
    136135}
     
    144143 */
    145144void usb_deserialize_hub_desriptor(
    146 void * serialized_descriptor, usb_hub_descriptor_t * descriptor) {
     145    void * serialized_descriptor, usb_hub_descriptor_t *descriptor) {
    147146        uint8_t * sdescriptor = serialized_descriptor;
    148147        descriptor->ports_count = sdescriptor[2];
     
    151150        descriptor->pwr_on_2_good_time = sdescriptor[5];
    152151        descriptor->current_requirement = sdescriptor[6];
    153         size_t var_size = (descriptor->ports_count+7) / 8;
     152        size_t var_size = (descriptor->ports_count + 7) / 8;
    154153        //descriptor->devices_removable = (uint8_t*) malloc(var_size);
    155154
Note: See TracChangeset for help on using the changeset viewer.