~vcs-imports/qemu/git

« back to all changes in this revision

Viewing changes to hw/usb.c

  • Committer: pbrook
  • Date: 2006-10-22 00:18:54 UTC
  • Revision ID: git-v1:e6e5906b6e0a81718066ca43aef57515026c6624
ColdFire target.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2196 c046a42c-6fe2-441c-8c8c-71466251a162

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * QEMU USB emulation
3
3
 *
4
4
 * Copyright (c) 2005 Fabrice Bellard
5
 
 *
 
5
 * 
6
6
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
 * of this software and associated documentation files (the "Software"), to deal
8
8
 * in the Software without restriction, including without limitation the rights
21
21
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
22
 * THE SOFTWARE.
23
23
 */
24
 
#include "qemu-common.h"
25
 
#include "usb.h"
 
24
#include "vl.h"
26
25
 
27
26
void usb_attach(USBPort *port, USBDevice *dev)
28
27
{
32
31
/**********************/
33
32
/* generic USB device helpers (you are not forced to use them when
34
33
   writing your USB device driver, but they help handling the
35
 
   protocol)
 
34
   protocol) 
36
35
*/
37
36
 
38
37
#define SETUP_STATE_IDLE 0
67
66
        s->setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
68
67
        s->setup_index = 0;
69
68
        if (s->setup_buf[0] & USB_DIR_IN) {
70
 
            ret = s->handle_control(s,
 
69
            ret = s->handle_control(s, 
71
70
                                    (s->setup_buf[0] << 8) | s->setup_buf[1],
72
71
                                    (s->setup_buf[3] << 8) | s->setup_buf[2],
73
72
                                    (s->setup_buf[5] << 8) | s->setup_buf[4],
94
93
            case SETUP_STATE_ACK:
95
94
                if (!(s->setup_buf[0] & USB_DIR_IN)) {
96
95
                    s->setup_state = SETUP_STATE_IDLE;
97
 
                    ret = s->handle_control(s,
 
96
                    ret = s->handle_control(s, 
98
97
                                      (s->setup_buf[0] << 8) | s->setup_buf[1],
99
98
                                      (s->setup_buf[3] << 8) | s->setup_buf[2],
100
99
                                      (s->setup_buf[5] << 8) | s->setup_buf[4],
141
140
                    s->setup_state = SETUP_STATE_IDLE;
142
141
                    /* transfer OK */
143
142
                } else {
144
 
                    /* ignore additional output */
 
143
                    /* ignore additionnal output */
145
144
                }
146
145
                break;
147
146
            case SETUP_STATE_DATA: