Ignore:
Timestamp:
2010-10-25T07:44:02Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ca07cd3
Parents:
7a7bfeb3
Message:

Better debugging support in VHCD

Also, added some missing comments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hw/bus/usb/hcd/virtual/hub.c

    r7a7bfeb3 r355f7c2  
    4343#include "hubintern.h"
    4444
    45 hub_port_t hub_ports[HUB_PORT_COUNT];
    4645
    4746/** Standard device descriptor. */
     
    108107};
    109108
     109/** All hub configuration descriptors. */
    110110static usbvirt_device_configuration_extras_t extra_descriptors[] = {
    111111        {
     
    137137};
    138138
     139/** Hub as a virtual device. */
    139140usbvirt_device_t virthub_dev = {
    140141        .ops = &hub_ops,
    141142        .descriptors = &descriptors,
    142143};
    143  
     144
     145/** Hub device. */
    144146hub_device_t hub_dev;
    145147
     148/** Initialize virtual hub. */
    146149void hub_init(void)
    147150{
     
    156159       
    157160        usbvirt_connect_local(&virthub_dev);
    158         //virthub_dev.send_data = send_data;
    159        
    160         printf("%s: virtual hub (%d ports) created.\n", NAME, HUB_PORT_COUNT);
    161 }
    162 
     161       
     162        dprintf(1, "virtual hub (%d ports) created", HUB_PORT_COUNT);
     163}
     164
     165/** Connect device to the hub.
     166 *
     167 * @param device Device to be connected.
     168 * @return Port where the device was connected to.
     169 */
    163170size_t hub_add_device(virtdev_connection_t *device)
    164171{
     
    191198}
    192199
    193 
     200/** Disconnect device from the hub. */
    194201void hub_remove_device(virtdev_connection_t *device)
    195202{
     
    209216}
    210217
     218/** Tell whether device port is open.
     219 *
     220 * @return Whether communication to and from the device can go through the hub.
     221 */
    211222bool hub_can_device_signal(virtdev_connection_t * device)
    212223{
     
    221232}
    222233
     234/** Format hub port status.
     235 *
     236 * @param result Buffer where to store status string.
     237 * @param len Number of characters that is possible to store in @p result
     238 *      (excluding trailing zero).
     239 */
     240void hub_get_port_statuses(char *result, size_t len)
     241{
     242        if (len > HUB_PORT_COUNT) {
     243                len = HUB_PORT_COUNT;
     244        }
     245        size_t i;
     246        for (i = 0; i < len; i++) {
     247                result[i] = hub_port_state_as_char(hub_dev.ports[i].state);
     248        }
     249        result[len] = 0;
     250}
    223251
    224252/**
Note: See TracChangeset for help on using the changeset viewer.