Changeset 096a1ff in mainline


Ignore:
Timestamp:
2011-01-28T23:54:15Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5935fe4c
Parents:
f0e25e8
Message:

Shorter debug messages

Location:
uspace/drv/uhci
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci/debug.h

    rf0e25e8 r096a1ff  
    6060        usb_dprintf( NAME, DEBUG_LEVEL_VERBOSE, fmt, ##args )
    6161
     62#define UHCI_GET_STR_FLAG(reg, flag, msg_set, msg_unset) \
     63        ((((reg) & (flag)) > 0) ? (msg_set) : (msg_unset))
     64
     65
    6266#endif
    6367/**
  • uspace/drv/uhci/root_hub/port.c

    rf0e25e8 r096a1ff  
    11
    22#include <errno.h>
     3#include <str_error.h>
    34//#include <usb/devreq.h> /* for usb_device_request_setup_packet_t */
    45#include <usb/usb.h>
     
    2223
    2324        while (1) {
    24                 uhci_print_info("Port(%d) status address %p:\n",
    25                   port_instance->number, port_instance->address);
    26 
    27                 /* read register value */
     25                /* Read port status. */
    2826                port_status_t port_status =
    2927                        port_status_read(port_instance->address);
    3028
    31                 /* debug print */
    32                 uhci_print_info("Port(%d) status %#.4x:\n",
    33                   port_instance->number, port_status);
    34                 print_port_status(port_status);
     29                uhci_print_info("Port %d: %04X (@ 0x%x) = " \
     30                    "%s,%s,%s,%s,[%s,%s],%s,%s,%s,%s\n",
     31                    port_instance->number, port_status, port_instance->address,
     32                    UHCI_GET_STR_FLAG(port_status, STATUS_SUSPEND, "suspend", "up"),
     33                    UHCI_GET_STR_FLAG(port_status, STATUS_IN_RESET, "in reset", "-"),
     34                    UHCI_GET_STR_FLAG(port_status, STATUS_LOW_SPEED, "lowsp", "fullsp"),
     35                    UHCI_GET_STR_FLAG(port_status, STATUS_RESUME, "resume", "k-state"),
     36                    UHCI_GET_STR_FLAG(port_status, STATUS_LINE_D_MINUS, "D- on", "D- off"),
     37                    UHCI_GET_STR_FLAG(port_status, STATUS_LINE_D_PLUS, "D+ on", "D+ off"),
     38                    UHCI_GET_STR_FLAG(port_status, STATUS_ENABLED_CHANGED, "enblchg", "-"),
     39                    UHCI_GET_STR_FLAG(port_status, STATUS_ENABLED, "enabled", "disabled"),
     40                    UHCI_GET_STR_FLAG(port_status, STATUS_CONNECTED_CHANGED, "connchg", "-"),
     41                    UHCI_GET_STR_FLAG(port_status, STATUS_CONNECTED, "hasdev", "nodev"));
    3542
    3643                if (port_status & STATUS_CONNECTED_CHANGED) {
     
    8188
    8289        if (ret != EOK) { /* address assigning went wrong */
    83                 uhci_print_error("Failed(%d) to assign address to the device.\n", ret);
     90                uhci_print_error("Failed to assign address (port %d): %s.\n",
     91                    port->number, str_error(ret));
    8492                uhci_port_set_enabled(port, false);
    8593                usb_address_keeping_release_default(&uhci_instance->address_manager);
  • uspace/drv/uhci/uhci.c

    rf0e25e8 r096a1ff  
    218218        return EOK;
    219219}
     220
    220221/*---------------------------------------------------------------------------*/
    221222int uhci_debug_checker(void *arg)
     
    227228                reg = pio_read_16(&instance->registers->usbcmd);
    228229                uhci_print_verbose("Command register: %X\n", reg);
     230
    229231                reg = pio_read_16(&instance->registers->usbsts);
    230                 uhci_print_verbose("Status register: %X\n", reg);
     232                uhci_print_verbose("Status register: %X (%s,%s,%s,%s,%s,%s)\n",
     233                    reg,
     234                    UHCI_GET_STR_FLAG(reg, UHCI_STATUS_HALTED, "halted", "-"),
     235                    UHCI_GET_STR_FLAG(reg, UHCI_STATUS_PROCESS_ERROR, "prerr", "-"),
     236                    UHCI_GET_STR_FLAG(reg, UHCI_STATUS_SYSTEM_ERROR, "syserr", "-"),
     237                    UHCI_GET_STR_FLAG(reg, UHCI_STATUS_RESUME, "res", "-"),
     238                    UHCI_GET_STR_FLAG(reg, UHCI_STATUS_ERROR_INTERRUPT, "errintr", "-"),
     239                    UHCI_GET_STR_FLAG(reg, UHCI_STATUS_INTERRUPT, "intr", "-"));
    231240/*
    232241                uintptr_t frame_list = pio_read_32(&instance->registers->flbaseadd);
  • uspace/drv/uhci/uhci.h

    rf0e25e8 r096a1ff  
    5656
    5757        uint16_t usbsts;
     58#define UHCI_STATUS_HALTED (1 << 5)
     59#define UHCI_STATUS_PROCESS_ERROR (1 << 4)
     60#define UHCI_STATUS_SYSTEM_ERROR (1 << 3)
     61#define UHCI_STATUS_RESUME (1 << 2)
     62#define UHCI_STATUS_ERROR_INTERRUPT (1 << 1)
     63#define UHCI_STATUS_INTERRUPT (1 << 0)
     64
    5865        uint16_t usbintr;
    5966        uint16_t frnum;
Note: See TracChangeset for help on using the changeset viewer.