Changeset aaff605 in mainline


Ignore:
Timestamp:
2011-03-21T15:35:29Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a90fc0c
Parents:
7102aa5
Message:

Add usb_str_speed() function

Location:
uspace/lib/usb
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/include/usb/usb.h

    r7102aa5 raaff605  
    7878        USB_SPEED_HIGH
    7979} usb_speed_t;
     80
     81const char *usb_str_speed(usb_speed_t);
     82
    8083
    8184/** USB request type target. */
  • uspace/lib/usb/src/usb.c

    r7102aa5 raaff605  
    3636#include <errno.h>
    3737
     38static const char *str_speed[] = {
     39        "low",
     40        "full",
     41        "high"
     42};
     43static size_t str_speed_size = sizeof(str_speed)/sizeof(str_speed[0]);
    3844
    3945/** String representation for USB transfer type.
     
    5864}
    5965
     66/** String representation of USB speed.
     67 *
     68 * @param s The speed.
     69 * @return USB speed as a string (in English).
     70 */
     71const char *usb_str_speed(usb_speed_t s)
     72{
     73        if (s >= str_speed_size) {
     74                return "invalid";
     75        }
     76        return str_speed[s];
     77}
     78
    6079/**
    6180 * @}
Note: See TracChangeset for help on using the changeset viewer.