Changeset 6c5abf9 in mainline


Ignore:
Timestamp:
2011-09-23T13:09:47Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a590a23
Parents:
aff1880
Message:

usbhub: Further unused code removal.

Location:
uspace/drv/bus/usb/usbhub
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhub/usbhub.c

    raff1880 r6c5abf9  
    4141
    4242#include <usb/usb.h>
     43#include <usb/debug.h>
    4344#include <usb/dev/pipes.h>
    4445#include <usb/classes/classes.h>
  • uspace/drv/bus/usb/usbhub/utils.c

    raff1880 r6c5abf9  
    3434 */
    3535#include <ddf/driver.h>
    36 #include <bool.h>
    3736#include <errno.h>
    3837
     
    4039#include <usb/descriptor.h>
    4140#include <usb/classes/hub.h>
     41#include <usb/debug.h>
     42
    4243
    4344#include "usbhub.h"
     
    4546
    4647
    47 size_t USB_HUB_MAX_DESCRIPTOR_SIZE = 71;
    48 
    49 //*********************************************
    50 //
    51 //  various utils
    52 //
    53 //*********************************************
    54 
    55 //hub descriptor utils
    56 
    57 /**
    58  * create uint8_t array with serialized descriptor
    59  *
    60  * @param descriptor
    61  * @return newly created serializd descriptor pointer
    62  */
    63 void * usb_create_serialized_hub_descriptor(usb_hub_descriptor_t *descriptor) {
    64         //base size
    65         size_t size = 7;
    66         //variable size according to port count
    67         size_t var_size = (descriptor->ports_count + 7) / 8;
    68         size += 2 * var_size;
    69         uint8_t *result = malloc(size);
    70         //size
    71         if (result)
    72                 usb_serialize_hub_descriptor(descriptor, result);
    73         return result;
    74 }
    75 
    76 /**
    77  * serialize descriptor into given buffer
    78  *
    79  * The buffer size is not checked.
    80  * @param descriptor
    81  * @param serialized_descriptor
    82  */
    83 void usb_serialize_hub_descriptor(usb_hub_descriptor_t *descriptor,
    84     void *serialized_descriptor)
    85 {
    86         //base size
    87         uint8_t *sdescriptor = serialized_descriptor;
    88         size_t size = 7;
    89         //variable size according to port count
    90         size_t var_size = (descriptor->ports_count + 7) / 8;
    91         size += 2 * var_size;
    92         //size
    93         sdescriptor[0] = size;
    94         //descriptor type
    95         sdescriptor[1] = USB_DESCTYPE_HUB;
    96         sdescriptor[2] = descriptor->ports_count;
    97         /// @fixme handling of endianness??
    98         sdescriptor[3] = descriptor->hub_characteristics / 256;
    99         sdescriptor[4] = descriptor->hub_characteristics % 256;
    100         sdescriptor[5] = descriptor->pwr_on_2_good_time;
    101         sdescriptor[6] = descriptor->current_requirement;
    102 
    103         size_t i;
    104         for (i = 0; i < var_size; ++i) {
    105                 sdescriptor[7 + i] = descriptor->devices_removable[i];
    106         }
    107         for (i = 0; i < var_size; ++i) {
    108                 sdescriptor[7 + var_size + i] = 255;
    109         }
    110 }
    111 /*----------------------------------------------------------------------------*/
    11248/**
    11349 * Deserialize descriptor into given pointer
  • uspace/drv/bus/usb/usbhub/utils.h

    raff1880 r6c5abf9  
    3838#define USBHUB_UTILS_H
    3939
    40 #include <adt/list.h>
    41 #include <bool.h>
    42 #include <ddf/driver.h>
    43 #include <fibril_synch.h>
     40#include <usb/usb.h>
    4441
    45 #include <usb/classes/hub.h>
    46 #include <usb/usb.h>
    47 #include <usb/debug.h>
    48 #include <usb/dev/request.h>
    49 
    50 #include "usbhub.h"
    51 
    52 
    53 void * usb_create_serialized_hub_descriptor(usb_hub_descriptor_t *descriptor);
    54 
    55 void usb_serialize_hub_descriptor(usb_hub_descriptor_t *descriptor,
    56     void *serialized_descriptor);
     42#define USB_HUB_MAX_DESCRIPTOR_SIZE 71
    5743
    5844int usb_deserialize_hub_desriptor(
Note: See TracChangeset for help on using the changeset viewer.