/[qemu]/qemu/hw/usb-uhci.c
ViewVC logotype

Diff of /qemu/hw/usb-uhci.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by bellard, Sat Nov 5 17:22:48 2005 UTC revision 1.3 by bellard, Sun Nov 6 16:13:29 2005 UTC
# Line 63  Line 63 
63  typedef struct UHCIPort {  typedef struct UHCIPort {
64      USBPort port;      USBPort port;
65      uint16_t ctrl;      uint16_t ctrl;
     USBDevice *dev; /* connected device */  
66  } UHCIPort;  } UHCIPort;
67    
68  typedef struct UHCIState {  typedef struct UHCIState {
# Line 128  static void uhci_reset(UHCIState *s) Line 127  static void uhci_reset(UHCIState *s)
127      for(i = 0; i < NB_PORTS; i++) {      for(i = 0; i < NB_PORTS; i++) {
128          port = &s->ports[i];          port = &s->ports[i];
129          port->ctrl = 0x0080;          port->ctrl = 0x0080;
130          if (port->dev)          if (port->port.dev)
131              uhci_attach(&port->port, port->dev);              uhci_attach(&port->port, port->port.dev);
132      }      }
133  }  }
134    
# Line 183  static void uhci_ioport_writew(void *opa Line 182  static void uhci_ioport_writew(void *opa
182              /* send reset on the USB bus */              /* send reset on the USB bus */
183              for(i = 0; i < NB_PORTS; i++) {              for(i = 0; i < NB_PORTS; i++) {
184                  port = &s->ports[i];                  port = &s->ports[i];
185                  dev = port->dev;                  dev = port->port.dev;
186                  if (dev) {                  if (dev) {
187                      dev->handle_packet(dev,                      dev->handle_packet(dev,
188                                         USB_MSG_RESET, 0, 0, NULL, 0);                                         USB_MSG_RESET, 0, 0, NULL, 0);
# Line 224  static void uhci_ioport_writew(void *opa Line 223  static void uhci_ioport_writew(void *opa
223              if (n >= NB_PORTS)              if (n >= NB_PORTS)
224                  return;                  return;
225              port = &s->ports[n];              port = &s->ports[n];
226              dev = port->dev;              dev = port->port.dev;
227              if (dev) {              if (dev) {
228                  /* port reset */                  /* port reset */
229                  if ( (val & UHCI_PORT_RESET) &&                  if ( (val & UHCI_PORT_RESET) &&
# Line 320  static void uhci_attach(USBPort *port1, Line 319  static void uhci_attach(USBPort *port1,
319      UHCIPort *port = &s->ports[port1->index];      UHCIPort *port = &s->ports[port1->index];
320    
321      if (dev) {      if (dev) {
322          if (port->dev) {          if (port->port.dev) {
323              usb_attach(port1, NULL);              usb_attach(port1, NULL);
324          }          }
325          /* set connect status */          /* set connect status */
# Line 332  static void uhci_attach(USBPort *port1, Line 331  static void uhci_attach(USBPort *port1,
331              port->ctrl |= UHCI_PORT_LSDA;              port->ctrl |= UHCI_PORT_LSDA;
332          else          else
333              port->ctrl &= ~UHCI_PORT_LSDA;              port->ctrl &= ~UHCI_PORT_LSDA;
334          port->dev = dev;          port->port.dev = dev;
335          /* send the attach message */          /* send the attach message */
336          dev->handle_packet(dev,          dev->handle_packet(dev,
337                             USB_MSG_ATTACH, 0, 0, NULL, 0);                             USB_MSG_ATTACH, 0, 0, NULL, 0);
# Line 346  static void uhci_attach(USBPort *port1, Line 345  static void uhci_attach(USBPort *port1,
345              port->ctrl &= ~UHCI_PORT_EN;              port->ctrl &= ~UHCI_PORT_EN;
346              port->ctrl |= UHCI_PORT_ENC;              port->ctrl |= UHCI_PORT_ENC;
347          }          }
348          dev = port->dev;          dev = port->port.dev;
349          if (dev) {          if (dev) {
350              /* send the detach message */              /* send the detach message */
351              dev->handle_packet(dev,              dev->handle_packet(dev,
352                                 USB_MSG_DETACH, 0, 0, NULL, 0);                                 USB_MSG_DETACH, 0, 0, NULL, 0);
353          }          }
354          port->dev = NULL;          port->port.dev = NULL;
355      }      }
356  }  }
357    
# Line 386  static int uhci_broadcast_packet(UHCISta Line 385  static int uhci_broadcast_packet(UHCISta
385  #endif  #endif
386      for(i = 0; i < NB_PORTS; i++) {      for(i = 0; i < NB_PORTS; i++) {
387          port = &s->ports[i];          port = &s->ports[i];
388          dev = port->dev;          dev = port->port.dev;
389          if (dev && (port->ctrl & UHCI_PORT_EN)) {          if (dev && (port->ctrl & UHCI_PORT_EN)) {
390              ret = dev->handle_packet(dev, pid,              ret = dev->handle_packet(dev, pid,
391                                       devaddr, devep,                                       devaddr, devep,

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26