Changeset 4d37c42 in mainline


Ignore:
Timestamp:
2011-02-25T17:17:58Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
013e4ca4
Parents:
f20f9e2
Message:

protect debug output with mutex, minor status output changes

Location:
uspace/drv/uhci-rhd
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-rhd/port.c

    rf20f9e2 r4d37c42  
    3434#include <errno.h>
    3535#include <str_error.h>
     36#include <fibril_synch.h>
    3637
    3738#include <usb/usb.h>    /* usb_address_t */
     
    100101
    101102                /* debug print */
     103                static fibril_mutex_t dbg_mtx = FIBRIL_MUTEX_INITIALIZER(dbg_mtx);
     104                fibril_mutex_lock(&dbg_mtx);
    102105                usb_log_debug("Port %d status at %p: 0x%04x.\n",
    103106                  port_instance->number, port_instance->address, port_status);
    104107                print_port_status(port_status);
     108                fibril_mutex_unlock(&dbg_mtx);
    105109
    106110                if (port_status & STATUS_CONNECTED_CHANGED) {
     
    120124                                /* new device */
    121125                                uhci_port_new_device(port_instance);
     126                        } else {
     127                                port_status_write(port_instance->address, STATUS_CONNECTED_CHANGED);
    122128                        }
    123129
  • uspace/drv/uhci-rhd/port_status.c

    rf20f9e2 r4d37c42  
    4141struct flag_name
    4242{
    43         unsigned flag;
     43        uint16_t flag;
    4444        const char *name;
    4545};
     
    6565        for (;i < sizeof(flags)/sizeof(struct flag_name); ++i) {
    6666                usb_log_debug2("\t%s status: %s.\n", flags[i].name,
    67                   value & flags[i].flag ? "YES" : "NO");
     67                  ((value & flags[i].flag) != 0) ? "YES" : "NO");
    6868        }
    6969}
  • uspace/drv/uhci-rhd/port_status.h

    rf20f9e2 r4d37c42  
    4141typedef uint16_t port_status_t;
    4242
    43 enum {
    44         STATUS_CONNECTED         = 1 << 0,
    45         STATUS_CONNECTED_CHANGED = 1 << 1,
    46         STATUS_ENABLED           = 1 << 2,
    47         STATUS_ENABLED_CHANGED   = 1 << 3,
    48         STATUS_LINE_D_PLUS       = 1 << 4,
    49         STATUS_LINE_D_MINUS      = 1 << 5,
    50         STATUS_RESUME            = 1 << 6,
    51         STATUS_ALWAYS_ONE        = 1 << 7,
     43#define STATUS_CONNECTED         (1 << 0)
     44#define STATUS_CONNECTED_CHANGED (1 << 1)
     45#define STATUS_ENABLED           (1 << 2)
     46#define STATUS_ENABLED_CHANGED   (1 << 3)
     47#define STATUS_LINE_D_PLUS       (1 << 4)
     48#define STATUS_LINE_D_MINUS      (1 << 5)
     49#define STATUS_RESUME            (1 << 6)
     50#define STATUS_ALWAYS_ONE        (1 << 7)
    5251
    53         STATUS_LOW_SPEED = 1 <<  8,
    54         STATUS_IN_RESET  = 1 <<  9,
    55         STATUS_SUSPEND   = 1 << 12,
    56 };
     52#define STATUS_LOW_SPEED (1 <<  8)
     53#define STATUS_IN_RESET  (1 <<  9)
     54#define STATUS_SUSPEND   (1 << 12)
    5755
    5856static inline port_status_t port_status_read(port_status_t * address)
Note: See TracChangeset for help on using the changeset viewer.