Ignore:
File:
1 edited

Legend:

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

    rab5a43d1 r67352d2  
    3636
    3737#include <assert.h>
     38#include <stdint.h>
    3839#include <ddf/driver.h>
    39 #include <stdint.h>
     40#include <libarch/ddi.h> /* pio_read and pio_write */
    4041#include <usb/usbdevice.h>
    4142
    42 #include "port_status.h"
     43typedef uint16_t port_status_t;
     44
     45#define STATUS_CONNECTED         (1 << 0)
     46#define STATUS_CONNECTED_CHANGED (1 << 1)
     47#define STATUS_ENABLED           (1 << 2)
     48#define STATUS_ENABLED_CHANGED   (1 << 3)
     49#define STATUS_LINE_D_PLUS       (1 << 4)
     50#define STATUS_LINE_D_MINUS      (1 << 5)
     51#define STATUS_RESUME            (1 << 6)
     52#define STATUS_ALWAYS_ONE        (1 << 7)
     53
     54#define STATUS_LOW_SPEED (1 <<  8)
     55#define STATUS_IN_RESET  (1 <<  9)
     56#define STATUS_SUSPEND   (1 << 12)
    4357
    4458typedef struct uhci_port
     
    7286        pio_write_16(port->address, value);
    7387}
     88
     89static inline void uhci_port_print_status(
     90    uhci_port_t *port, const port_status_t value)
     91{
     92        assert(port);
     93        usb_log_debug2("%s Port status(%#x):%s%s%s%s%s%s%s%s%s%s%s.\n",
     94            port->id_string, value,
     95            (value & STATUS_SUSPEND) ? " SUSPENDED," : "",
     96            (value & STATUS_RESUME) ? " IN RESUME," : "",
     97            (value & STATUS_IN_RESET) ? " IN RESET," : "",
     98            (value & STATUS_LINE_D_MINUS) ? " VD-," : "",
     99            (value & STATUS_LINE_D_PLUS) ? " VD+," : "",
     100            (value & STATUS_LOW_SPEED) ? " LOWSPEED," : "",
     101            (value & STATUS_ENABLED_CHANGED) ? " ENABLED-CHANGE," : "",
     102            (value & STATUS_ENABLED) ? " ENABLED," : "",
     103            (value & STATUS_CONNECTED_CHANGED) ? " CONNECTED-CHANGE," : "",
     104            (value & STATUS_CONNECTED) ? " CONNECTED," : "",
     105            (value & STATUS_ALWAYS_ONE) ? " ALWAYS ONE" : " ERROR: NO ALWAYS ONE"
     106        );
     107}
    74108#endif
    75109/**
Note: See TracChangeset for help on using the changeset viewer.