Statistics
| Branch: | Tag: | Revision:

root / firmware / fx2 / include / usrp_commands.h @ b3a09205

History | View | Annotate | Download (3.5 kB)

1
/* 
2
 * USRP - Universal Software Radio Peripheral
3
 *
4
 * Copyright (C) 2003,2004 Free Software Foundation, Inc.
5
 *
6
 * This program is free software; you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation; either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Boston, MA  02110-1301  USA
19
 */
20

    
21
#ifndef _USRP_COMMANDS_H_
22
#define _USRP_COMMANDS_H_
23

    
24
#include <usrp_interfaces.h>
25
#include <usrp_spi_defs.h>
26

    
27
#define        MAX_EP0_PKTSIZE                       64        // max size of EP0 packet on FX2
28

    
29
// ----------------------------------------------------------------
30
//                        Vendor bmRequestType's
31
// ----------------------------------------------------------------
32

    
33
#define        VRT_VENDOR_IN                        0xC0
34
#define        VRT_VENDOR_OUT                        0x40
35

    
36
// ----------------------------------------------------------------
37
//                          USRP Vendor Requests
38
//
39
// Note that Cypress reserves [0xA0,0xAF].
40
// 0xA0 is the firmware load function.
41
// ----------------------------------------------------------------
42

    
43

    
44
// IN commands
45

    
46
#define        VRQ_GET_STATUS                        0x80
47
#define                GS_TX_UNDERRUN                        0        // wIndexL        // returns 1 byte
48
#define                GS_RX_OVERRUN                        1        // wIndexL        // returns 1 byte
49

    
50
#define        VRQ_I2C_READ                        0x81                // wValueL: i2c address; length: how much to read
51

    
52
#define        VRQ_SPI_READ                        0x82                // wValue: optional header bytes
53
                                                        // wIndexH:        enables
54
                                                        // wIndexL:        format
55
                                                        // len: how much to read
56

    
57
#define        VRQ_SPI_TRANSACT                0x83                // wValueH:  OUT byte 0
58
                                                        // wValueL:  OUT byte 1
59
                                                        // wIndexH:  OUT byte 2
60
                                                        // wIndexL:  OUT byte 3 
61
                                                        // wLengthH: enables 
62
                                                        // wLengthL: transaction length
63

    
64
// OUT commands
65

    
66
#define        VRQ_SET_LED                        0x01                // wValueL off/on {0,1}; wIndexL: which {0,1}
67

    
68
#define        VRQ_FPGA_LOAD                        0x02
69
#  define        FL_BEGIN                        0        // wIndexL: begin fpga programming cycle.  stalls if trouble.
70
#  define        FL_XFER                                1        // wIndexL: xfer up to 64 bytes of data
71
#  define        FL_END                                2        // wIndexL: end programming cycle, check for success.
72
                                                        //          stalls endpoint if trouble.
73

    
74
#define        VRQ_FPGA_WRITE_REG                0x03                // wIndexL: regno; data: 32-bit regval MSB first
75
#define        VRQ_FPGA_SET_RESET                0x04                // wValueL: {0,1}
76
#define        VRQ_FPGA_SET_TX_ENABLE                0x05                // wValueL: {0,1}
77
#define        VRQ_FPGA_SET_RX_ENABLE                0x06                // wValueL: {0,1}
78
// see below VRQ_FPGA_SET_{TX,RX}_RESET
79

    
80
#define        VRQ_SET_SLEEP_BITS                0x07                // wValueH: mask; wValueL: bits.  set bits given by mask to bits
81

    
82
#  define        SLEEP_ADC0                        0x01
83
#  define        SLEEP_ADC1                        0x02
84
#  define        SLEEP_DAC0                        0x04
85
#  define        SLEEP_DAC1                        0x08
86

    
87
#define        VRQ_I2C_WRITE                        0x08                // wValueL: i2c address; data: data
88

    
89
#define        VRQ_SPI_WRITE                        0x09                // wValue: optional header bytes
90
                                                        // wIndexH:        enables
91
                                                        // wIndexL:        format
92
                                                        // len: how much to write
93

    
94
#define        VRQ_FPGA_SET_TX_RESET                0x0a                // wValueL: {0, 1}
95
#define        VRQ_FPGA_SET_RX_RESET                0x0b                // wValueL: {0, 1}
96

    
97

    
98
// -------------------------------------------------------------------
99
// we store the hashes at fixed addresses in the FX2 internal memory
100

    
101
#define          USRP_HASH_SLOT_0_ADDR                        0xe1e0
102
#define          USRP_HASH_SLOT_1_ADDR                        0xe1f0
103

    
104

    
105

    
106
#endif /* _USRP_COMMANDS_H_ */