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