1 |
17 |
wfjm |
/* -*- c++ -*- */
|
2 |
|
|
/* $Id: usb_common.h 395 2011-07-17 22:02:55Z mueller $ */
|
3 |
|
|
/*-----------------------------------------------------------------------------
|
4 |
|
|
* Common USB code for FX2
|
5 |
|
|
*-----------------------------------------------------------------------------
|
6 |
|
|
* Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2,
|
7 |
|
|
* Copyright 2003 Free Software Foundation, Inc.
|
8 |
|
|
*-----------------------------------------------------------------------------
|
9 |
|
|
* This code is part of usbjtag. usbjtag is free software; you can redistribute
|
10 |
|
|
* it and/or modify it under the terms of the GNU General Public License as
|
11 |
|
|
* published by the Free Software Foundation; either version 2 of the License,
|
12 |
|
|
* or (at your option) any later version. usbjtag is distributed in the hope
|
13 |
|
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
14 |
|
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
* GNU General Public License for more details. You should have received a
|
16 |
|
|
* copy of the GNU General Public License along with this program in the file
|
17 |
|
|
* COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin
|
18 |
|
|
* St, Fifth Floor, Boston, MA 02110-1301 USA
|
19 |
|
|
*-----------------------------------------------------------------------------
|
20 |
|
|
*/
|
21 |
|
|
|
22 |
|
|
#ifndef _USB_COMMON_H_
|
23 |
|
|
#define _USB_COMMON_H_
|
24 |
|
|
|
25 |
|
|
#define bRequestType SETUPDAT[0]
|
26 |
|
|
#define bRequest SETUPDAT[1]
|
27 |
|
|
#define wValueL SETUPDAT[2]
|
28 |
|
|
#define wValueH SETUPDAT[3]
|
29 |
|
|
#define wIndexL SETUPDAT[4]
|
30 |
|
|
#define wIndexH SETUPDAT[5]
|
31 |
|
|
#define wLengthL SETUPDAT[6]
|
32 |
|
|
#define wLengthH SETUPDAT[7]
|
33 |
|
|
|
34 |
|
|
#define MSB(x) (((unsigned short) x) >> 8)
|
35 |
|
|
#define LSB(x) (((unsigned short) x) & 0xff)
|
36 |
|
|
|
37 |
|
|
extern volatile bit _usb_got_SUDAV;
|
38 |
|
|
|
39 |
|
|
// Provided by user application to report device status.
|
40 |
|
|
// returns non-zero if it handled the command.
|
41 |
|
|
unsigned char app_get_status (void);
|
42 |
|
|
// Provided by user application to handle VENDOR commands.
|
43 |
|
|
// returns non-zero if it handled the command.
|
44 |
|
|
unsigned char app_vendor_cmd (void);
|
45 |
|
|
|
46 |
|
|
void usb_install_handlers (void);
|
47 |
|
|
void usb_handle_setup_packet (void);
|
48 |
|
|
|
49 |
|
|
#define usb_setup_packet_avail() _usb_got_SUDAV
|
50 |
|
|
|
51 |
|
|
#endif /* _USB_COMMON_H_ */
|