GNU Radio's HOWTO Package
gn3s_main.h
Go to the documentation of this file.
1 /*
2  * Code from: USRP - Universal Software Radio Peripheral (GNU Radio)
3  *
4  * Initial modifications by:
5  *
6  * Stephan Esterhuizen, Aerospace Engineering Sciences
7  * University of Colorado at Boulder
8  * Boulder CO, USA
9  *
10  * Further modifications for use with the SiGe USB module to accompany
11  * the textbook: "A Software-Defined GPS and Galileo Receiver: A
12  * Single-Frequency Approach" by Kai Borre, Dennis Akos, et.al. by:
13  *
14  * Marcus Junered, GNSS Research Group
15  * Lulea University of Technology
16  * Lulea, Sweden
17  *
18  * http://ccar.colorado.edu/gnss
19  *
20  * ---------------------------------------------------------------------
21  *
22  * GN3S - GNSS IF Streamer for Windows
23  * Copyright (C) 2006 Marcus Junered
24  *
25  * This program is free software; you can redistribute it and/or modify
26  * it under the terms of the GNU General Public License as published by
27  * the Free Software Foundation; either version 2 of the License, or
28  * (at your option) any later version.
29  *
30  * This program is distributed in the hope that it will be useful,
31  * but WITHOUT ANY WARRANTY; without even the implied warranty of
32  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33  * GNU General Public License for more details.
34  *
35  * You should have received a copy of the GNU General Public License
36  * along with this program; if not, write to the Free Software
37  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
38  */
39 
40 
41 #ifndef _GN3S_MAIN_
42 #define _GN3S_MAIN_
43 
44 #include "usrp_common.h"
45 #include "fx2regs.h"
46 #include "gn3s_regs.h"
47 #include "gpif_inline.h"
48 #include "timer.h"
49 #include "isr.h"
50 #include "usb_common.h"
51 #include "fx2utils.h"
52 #include "gn3s_se4110.h"
53 #include "eeprom.h"
54 #include <string.h>
55 
56 
57 // ----------------------------------------------------------------
58 // Vendor bmRequestType's
59 // ----------------------------------------------------------------
60 #define VRT_VENDOR_IN 0xC0
61 #define VRT_VENDOR_OUT 0x40
62 
63 // IN commands
64 #define VRQ_GET_STATUS 0x80
65 #define GS_TX_UNDERRUN 0 // wIndexL // returns 1 byte
66 #define GS_RX_OVERRUN 1 // wIndexL // returns 1 byte
67 
68 // OUT commands
69 #define VRQ_XFER 0x01
70 #define VRQ_XFER_TX 0x02
71 
72 #define bRequestType SETUPDAT[0]
73 #define bRequest SETUPDAT[1]
74 #define wValueL SETUPDAT[2]
75 #define wValueH SETUPDAT[3]
76 #define wIndexL SETUPDAT[4]
77 #define wIndexH SETUPDAT[5]
78 #define wLengthL SETUPDAT[6]
79 #define wLengthH SETUPDAT[7]
80 #define GUARD 4073
81 #undef wordwide
82 
83 // A9 specific
84 #define VRQ_EEPROM 0xa2 // loads (uploads) EEPROM
85 #define VRQ_RAM 0xa3 // loads (uploads) external ram
86 #define VRQ_DB_FX 0xa9 // Force use of double byte address EEPROM
87 #define EP0BUFF_SIZE 0x40
88 
89 
90 // Prototypes
91 static void get_ep0_data(void);
92 unsigned char app_vendor_cmd(void);
93 void guardC(void) interrupt;
94 static void main_loop(void);
95 void TD_Init();
96 
97 #endif
void guardC(void) interrupt
static void get_ep0_data(void)
unsigned char app_vendor_cmd(void)
void TD_Init()
static void main_loop(void)