Changeset 3005db6 in mainline


Ignore:
Timestamp:
2011-03-11T13:51:13Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ab5a43d1
Parents:
0c8562c
Message:

Root hub refactoring

Location:
uspace/drv/uhci-rhd
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-rhd/Makefile

    r0c8562c r3005db6  
    3535        main.c \
    3636        port.c \
    37         port_status.c \
    3837        root_hub.c
    3938
  • uspace/drv/uhci-rhd/port.c

    r0c8562c r3005db6  
    123123
    124124                /* read register value */
    125                 port_status_t port_status = port_status_read(instance->address);
     125                port_status_t port_status = uhci_port_read_status(instance);
    126126
    127127                /* debug print mutex */
     
    131131                usb_log_debug2("Port(%p - %d): Status: %#04x. === %u\n",
    132132                  instance->address, instance->number, port_status, count++);
    133 //              print_port_status(port_status);
     133                print_port_status("Port", port_status);
    134134                fibril_mutex_unlock(&dbg_mtx);
    135135
     
    163163                } else {
    164164                        /* Write one to WC bits, to ack changes */
    165                         port_status_write(instance->address, port_status);
     165                        uhci_port_write_status(instance, port_status);
    166166                        usb_log_debug("Port(%p - %d): Change status ACK.\n",
    167167                            instance->address, instance->number);
     
    203203                usb_log_debug("Port(%p - %d): Reset Signal start.\n",
    204204                    port->address, port->number);
    205                 port_status_t port_status =
    206                         port_status_read(port->address);
     205                port_status_t port_status = uhci_port_read_status(port);
    207206                port_status |= STATUS_IN_RESET;
    208                 port_status_write(port->address, port_status);
     207                uhci_port_write_status(port, port_status);
    209208                async_usleep(10000);
    210                 port_status = port_status_read(port->address);
     209                port_status = uhci_port_read_status(port);
    211210                port_status &= ~STATUS_IN_RESET;
    212                 port_status_write(port->address, port_status);
     211                uhci_port_write_status(port, port_status);
    213212                usb_log_debug("Port(%p - %d): Reset Signal stop.\n",
    214213                    port->address, port->number);
     
    278277
    279278        /* Read register value */
    280         port_status_t port_status = port_status_read(port->address);
     279        port_status_t port_status = uhci_port_read_status(port);
    281280
    282281        /* Set enabled bit */
     
    288287
    289288        /* Write new value. */
    290         port_status_write(port->address, port_status);
     289        uhci_port_write_status(port, port_status);
    291290
    292291        usb_log_info("Port(%p-%d): %sabled port.\n",
  • uspace/drv/uhci-rhd/port.h

    r0c8562c r3005db6  
    5858
    5959void uhci_port_fini(uhci_port_t *port);
     60
     61static inline port_status_t uhci_port_read_status(uhci_port_t *port)
     62{
     63        assert(port);
     64        return pio_read_16(port->address);
     65}
     66
     67static inline void uhci_port_write_status(
     68    uhci_port_t *port, port_status_t value)
     69{
     70        assert(port);
     71        pio_write_16(port->address, value);
     72}
    6073#endif
    6174/**
  • uspace/drv/uhci-rhd/port_status.h

    r0c8562c r3005db6  
    5454#define STATUS_SUSPEND   (1 << 12)
    5555
    56 static inline port_status_t port_status_read(port_status_t * address)
    57         { return pio_read_16(address); }
    5856
    59 static inline void port_status_write(
    60   port_status_t *address, port_status_t value)
    61         { pio_write_16(address, value); }
    62 
    63 void print_port_status(const port_status_t status);
     57static inline void print_port_status(
     58    const char* prefix, const port_status_t value)
     59{
     60        usb_log_debug2("%s Port status:%s%s%s%s%s%s%s%s.\n",
     61            prefix,
     62            (value & STATUS_SUSPEND) ? " SUSPENDED," : "",
     63            (value & STATUS_IN_RESET) ? " IN RESET," : "",
     64            (value & STATUS_LOW_SPEED) ? " LOWSPEED," : "",
     65            (value & STATUS_ENABLED_CHANGED) ? " ENABLED-CHANGE," : "",
     66            (value & STATUS_ENABLED) ? " ENABLED," : "",
     67            (value & STATUS_CONNECTED_CHANGED) ? " CONNECTED-CHANGE," : "",
     68            (value & STATUS_CONNECTED) ? " CONNECTED," : "",
     69            (value & STATUS_ALWAYS_ONE) ? " ALWAYS ONE" : " ERROR: NO ALWAYS ONE"
     70        );
     71}
    6472#endif
    6573/**
Note: See TracChangeset for help on using the changeset viewer.