Changeset 48a31be in mainline


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

usbhub: Remove unused code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhub/port_status.h

    rd6e2938 r48a31be  
    5656#define USB_HUB_PORT_STATUS_POWER (1 << (USB_HUB_FEATURE_PORT_POWER))
    5757#define USB_HUB_PORT_STATUS_LOW_SPEED (1 << (USB_HUB_FEATURE_PORT_LOW_SPEED))
     58#define USB_HUB_PORT_STATUS_HIGH_SPEED (1 << 10)
    5859
    5960#define USB_HUB_PORT_C_STATUS_CONNECTION \
     
    122123
    123124/**
    124  * set the device request to be a port enable request
    125  * @param request
    126  * @param port
    127  */
    128 static inline void usb_hub_set_enable_port_request(
    129     usb_device_request_setup_packet_t *request, uint16_t port
    130     ) {
    131         request->index = port;
    132         request->request_type = USB_HUB_REQ_TYPE_SET_PORT_FEATURE;
    133         request->request = USB_HUB_REQUEST_SET_FEATURE;
    134         request->value = USB_HUB_FEATURE_C_PORT_ENABLE;
    135         request->length = 0;
    136 }
    137 
    138 /**
    139  * enable specified port
    140  * @param port
    141  * @return
    142  */
    143 static inline usb_device_request_setup_packet_t *
    144 usb_hub_create_enable_port_request(uint16_t port) {
    145         usb_device_request_setup_packet_t *result =
    146             malloc(sizeof (usb_device_request_setup_packet_t));
    147         usb_hub_set_enable_port_request(result, port);
    148         return result;
    149 }
    150 
    151 /**
    152  * set the device request to be a port disable request
    153  * @param request
    154  * @param port
    155  */
    156 static inline void usb_hub_set_disable_port_request(
    157     usb_device_request_setup_packet_t *request, uint16_t port
    158     ) {
    159         request->index = port;
    160         request->request_type = USB_HUB_REQ_TYPE_SET_PORT_FEATURE;
    161         request->request = USB_HUB_REQUEST_SET_FEATURE;
    162         request->value = USB_HUB_FEATURE_C_PORT_SUSPEND;
    163         request->length = 0;
    164 }
    165 
    166 /**
    167  * disable specified port
    168  * @param port
    169  * @return
    170  */
    171 static inline usb_device_request_setup_packet_t *
    172 usb_hub_create_disable_port_request(uint16_t port) {
    173         usb_device_request_setup_packet_t *result =
    174             malloc(sizeof (usb_device_request_setup_packet_t));
    175         usb_hub_set_disable_port_request(result, port);
    176         return result;
    177 }
    178 
    179 /**
    180125 * set the device request to be a port disable request
    181126 * @param request
     
    193138
    194139/**
    195  * disable specified port
    196  * @param port
    197  * @return
    198  */
    199 static inline usb_device_request_setup_packet_t *
    200 usb_hub_create_reset_port_request(uint16_t port) {
    201         usb_device_request_setup_packet_t *result =
    202             malloc(sizeof (usb_device_request_setup_packet_t));
    203         usb_hub_set_reset_port_request(result, port);
    204         return result;
    205 }
    206 
    207 /**
    208  * set the device request to be a port disable request
    209  * @param request
    210  * @param port
    211  */
    212 static inline void usb_hub_set_power_port_request(
    213     usb_device_request_setup_packet_t *request, uint16_t port
    214     ) {
    215         request->index = port;
    216         request->request_type = USB_HUB_REQ_TYPE_SET_PORT_FEATURE;
    217         request->request = USB_HUB_REQUEST_SET_FEATURE;
    218         request->value = USB_HUB_FEATURE_PORT_POWER;
    219         request->length = 0;
    220 }
    221 
    222 /**
    223  * set the device request to be a port disable request
    224  * @param request
    225  * @param port
    226  */
    227 static inline void usb_hub_unset_power_port_request(
    228     usb_device_request_setup_packet_t *request, uint16_t port
    229     ) {
    230         request->index = port;
    231         request->request_type = USB_HUB_REQ_TYPE_SET_PORT_FEATURE;
    232         request->request = USB_HUB_REQUEST_CLEAR_FEATURE;
    233         request->value = USB_HUB_FEATURE_PORT_POWER;
    234         request->length = 0;
    235 }
    236 
    237 /**
    238140 * get i`th bit of port status
    239141 *
     
    247149
    248150/**
    249  * set i`th bit of port status
    250  *
    251  * @param status
    252  * @param idx
    253  * @param value
    254  */
    255 static inline void usb_port_status_set_bit(
    256     usb_port_status_t * status, int idx, bool value) {
    257         (*status) = value ?
    258             ((*status) | (1 << (idx))) :
    259             ((*status)&(~(1 << (idx))));
    260 }
    261 
    262 /**
    263  * get i`th bit of hub status
    264  *
    265  * @param status
    266  * @param idx
    267  * @return
    268  */
    269 static inline bool usb_hub_is_status(usb_hub_status_t status, int idx) {
    270         return (status & (1 << idx)) != 0;
    271 }
    272 
    273 /**
    274  * set i`th bit of hub status
    275  *
    276  * @param status
    277  * @param idx
    278  * @param value
    279  */
    280 static inline void usb_hub_status_set_bit(
    281     usb_hub_status_t *status, int idx, bool value) {
    282         (*status) = value ?
    283             ((*status) | (1 << (idx))) :
    284             ((*status)&(~(1 << (idx))));
    285 }
    286 
    287 /**
    288  * low speed device on the port indicator
    289  *
    290  * @param status
    291  * @return true if low speed device is attached
    292  */
    293 static inline bool usb_port_low_speed(usb_port_status_t status) {
    294         return usb_port_is_status(status, 9);
    295 }
    296 
    297 /**
    298  * set low speed device connected bit in port status
    299  *
    300  * @param status
    301  * @param low_speed value of the bit
    302  */
    303 static inline void usb_port_set_low_speed(usb_port_status_t *status, bool low_speed) {
    304         usb_port_status_set_bit(status, 9, low_speed);
    305 }
    306 
    307 //high speed device attached
    308 
    309 /**
    310  * high speed device on the port indicator
    311  *
    312  * @param status
    313  * @return true if high speed device is on port
    314  */
    315 static inline bool usb_port_high_speed(usb_port_status_t status) {
    316         return usb_port_is_status(status, 10);
    317 }
    318 
    319 /**
    320  * set high speed device bit in port status
    321  *
    322  * @param status
    323  * @param high_speed value of the bit
    324  */
    325 static inline void usb_port_set_high_speed(usb_port_status_t *status, bool high_speed) {
    326         usb_port_status_set_bit(status, 10, high_speed);
    327 }
    328 
    329 /**
    330151 * speed getter for port status
    331152 *
     
    334155 */
    335156static inline usb_speed_t usb_port_speed(usb_port_status_t status) {
    336         if (usb_port_low_speed(status))
     157        if ((status & USB_HUB_PORT_STATUS_LOW_SPEED) != 0)
    337158                return USB_SPEED_LOW;
    338         if (usb_port_high_speed(status))
     159        if ((status & USB_HUB_PORT_STATUS_HIGH_SPEED) != 0)
    339160                return USB_SPEED_HIGH;
    340161        return USB_SPEED_FULL;
Note: See TracChangeset for help on using the changeset viewer.