diff --git a/Makefile b/Makefile old mode 100755 new mode 100644 index 46c815b..a164da0 --- a/Makefile +++ b/Makefile @@ -19,13 +19,14 @@ VPATH = accessories: \ usrp: LDFLAGS = -lpthread -lusrp -m32 -CFLAGS = -O2 -D_FORTIFY_SOURCE=0 -g3 $(CINCPATHFLAGS) +CFLAGS = -O2 -D_FORTIFY_SOURCE=0 -g3 -m32 $(CINCPATHFLAGS) ASMFLAGS = -masm=intel SKIP = %main.cpp %simd-test.cpp %fft-test.cpp %acq-test.cpp %sse_new.cpp %gps-usrp.cpp SRCC = $(wildcard main/*.cpp simd/*.cpp accessories/*.cpp acquisition/*.cpp objects/*.cpp usrp/*.cpp) SRC = $(filter-out $(SKIP), $(SRCC)) OBJS = $(SRC:.cpp=.o) +OBJS += usrp/gn3s_firmware.o HEADERS = $(wildcard accessories/*.h acquisition/*.h main/*.h objects/*.h simd/*.h includes/*.h) #Uncomment these to look at the disassembly @@ -60,6 +61,9 @@ simd-test: simd-test.o $(OBJS) %.o:%.s $(ASM) $(CFLAGS) -c $< -o $@ +%.o:%.ihx + ld -r -b binary $< -o $@ + gps-gse: make --directory=./gse diff --git a/accessories/misc.cpp b/accessories/misc.cpp index e1e9241..2747fe7 100644 --- a/accessories/misc.cpp +++ b/accessories/misc.cpp @@ -269,15 +269,16 @@ int32 run_agc(CPX *_buff, int32 _samps, int32 bits, int32 scale) /* Get rid of the divide, replace with a multiply to scale to 2^15, then right shift to get * back into AGC_BITS of magnitude */ - lscale = (1 << 14) / scale; - shift = 14 - bits; +// lscale = (1 << 14) / scale; +// shift = 14 - bits; max = 1 << bits; num = 0; - x86_muls((int16 *)_buff, &lscale, 2*_samps, shift); +// x86_muls((int16 *)_buff, &lscale, 2*_samps, shift); for(lcv = 0; lcv < 2*_samps; lcv++) { + p[lcv] >>= 7; if(abs(p[lcv]) > max) num++; } diff --git a/gse/gui.fbp b/gse/gui.fbp index ae303b1..777b1e5 100644 --- a/gse/gui.fbp +++ b/gse/gui.fbp @@ -1040,7 +1040,7 @@ iGUI_PVT - 1000,600 + 1600,600 wxDEFAULT_FRAME_STYLE PVT @@ -1149,7 +1149,7 @@ 5 wxEXPAND 5 - + -1,-1 bSizer18 wxVERTICAL @@ -1158,7 +1158,7 @@ 5 wxALL|wxEXPAND 0 - + wxID_ANY PVT Status @@ -1170,7 +1170,7 @@ 5 wxEXPAND 1 - + bSizer199 wxVERTICAL @@ -1237,8 +1237,8 @@ none 5 - wxALL - 0 + wxALIGN_CENTER_VERTICAL|wxALL + 1 @@ -1289,8 +1289,8 @@ 5 wxALL|wxEXPAND - 1 - + 2 + 1 @@ -1298,20 +1298,20 @@ 0 wxID_ANY - rticks + 0 rticks protected - wxALIGN_RIGHT|wxST_NO_AUTORESIZE + wxTE_RIGHT + - -1 @@ -1334,6 +1334,10 @@ + + + + @@ -1350,8 +1354,8 @@ none 5 - wxALL - 0 + wxALIGN_CENTER_VERTICAL|wxALL + 1 @@ -1402,8 +1406,8 @@ 5 wxALL|wxEXPAND - 1 - + 2 + 1 @@ -1411,20 +1415,20 @@ 0 wxID_ANY - sticks + 0 sticks protected - wxALIGN_RIGHT|wxST_NO_AUTORESIZE + wxTE_RIGHT + - -1 @@ -1447,6 +1451,10 @@ + + + + @@ -1463,8 +1471,8 @@ none 5 - wxALL - 0 + wxALIGN_CENTER_VERTICAL|wxALL + 1 @@ -1514,9 +1522,9 @@ 5 - wxALIGN_RIGHT|wxALL - 1 - + wxALL|wxEXPAND + 2 + 1 @@ -1524,20 +1532,20 @@ 0 wxID_ANY - cticks + 0 cticks protected - wxALIGN_RIGHT|wxST_NO_AUTORESIZE + wxTE_RIGHT + - -1 @@ -1560,6 +1568,10 @@ + + + + @@ -1648,8 +1660,8 @@ none 5 - wxALL - 0 + wxALIGN_CENTER_VERTICAL|wxALL + 1 @@ -1700,8 +1712,8 @@ 5 wxALL|wxEXPAND - 1 - + 2 + 1 @@ -1709,20 +1721,20 @@ 0 wxID_ANY - iter + 0 iter protected - wxALIGN_RIGHT|wxST_NO_AUTORESIZE + wxTE_RIGHT + - -1 @@ -1745,6 +1757,10 @@ + + + + @@ -1761,8 +1777,8 @@ none 5 - wxALL - 0 + wxALIGN_CENTER_VERTICAL|wxALL + 1 @@ -1771,14 +1787,14 @@ ,90,92,-1,70,0 0 wxID_ANY - Nav Satellites + Nav SV m_staticText53431 protected - + wxALIGN_RIGHT|wxST_NO_AUTORESIZE @@ -1813,8 +1829,8 @@ 5 wxALL|wxEXPAND - 1 - + 2 + 1 @@ -1822,20 +1838,20 @@ 0 wxID_ANY - nsv + 0 nsv protected - wxALIGN_RIGHT|wxST_NO_AUTORESIZE + wxTE_RIGHT + - -1 @@ -1858,6 +1874,10 @@ + + + + @@ -1950,8 +1970,8 @@ none 5 - wxALL - 0 + wxALIGN_CENTER_VERTICAL|wxALL + 1 @@ -2001,9 +2021,9 @@ 5 - wxALL|wxEXPAND - 1 - + wxALL + 3 + 1 @@ -2011,20 +2031,20 @@ 0 wxID_ANY - lat + 0 lat protected - wxALIGN_RIGHT|wxST_NO_AUTORESIZE + wxTE_RIGHT + - -1 @@ -2047,6 +2067,10 @@ + + + + @@ -2063,8 +2087,8 @@ none 5 - wxALL - 0 + wxALIGN_CENTER_VERTICAL|wxALL + 1 @@ -2114,9 +2138,9 @@ 5 - wxALIGN_RIGHT|wxALL - 1 - + wxALL + 3 + 1 @@ -2124,20 +2148,20 @@ 0 wxID_ANY - lon + 0 lon protected - wxALIGN_RIGHT|wxST_NO_AUTORESIZE + wxTE_RIGHT + - -1 @@ -2160,6 +2184,10 @@ + + + + @@ -2176,8 +2204,8 @@ none 5 - wxALL - 0 + wxALIGN_CENTER_VERTICAL|wxALL + 1 @@ -2227,9 +2255,9 @@ 5 - wxALL|wxEXPAND - 1 - + wxALL + 3 + 1 @@ -2237,20 +2265,20 @@ 0 wxID_ANY - alt + 0 alt protected - wxALIGN_RIGHT|wxST_NO_AUTORESIZE + wxTE_RIGHT + - -1 @@ -2273,6 +2301,10 @@ + + + + @@ -2289,8 +2321,8 @@ none 5 - wxALL - 0 + wxALIGN_CENTER_VERTICAL|wxALL + 1 @@ -2340,9 +2372,9 @@ 5 - wxALL|wxEXPAND - 1 - + wxALL + 3 + 1 @@ -2350,20 +2382,20 @@ 0 wxID_ANY - gdop + 0 gdop protected - wxALIGN_RIGHT|wxST_NO_AUTORESIZE + wxTE_RIGHT + - -1 @@ -2386,6 +2418,10 @@ + + + + @@ -2397,7 +2433,7 @@ 5 wxEXPAND 1 - + bSizer197 wxVERTICAL @@ -2464,8 +2500,8 @@ none 5 - wxALL - 0 + wxALIGN_CENTER_VERTICAL|wxALL + 1 @@ -2515,9 +2551,9 @@ 5 - wxALL|wxEXPAND - 1 - + wxALL + 4 + 1 @@ -2525,20 +2561,20 @@ 0 wxID_ANY - px + 0 px protected - wxALIGN_RIGHT|wxST_NO_AUTORESIZE + wxTE_RIGHT + - -1 @@ -2561,6 +2597,10 @@ + + + + @@ -2577,8 +2617,8 @@ none 5 - wxALL - 0 + wxALIGN_CENTER_VERTICAL|wxALL + 1 @@ -2628,9 +2668,9 @@ 5 - wxALL|wxEXPAND - 1 - + wxALL + 4 + 1 @@ -2638,20 +2678,20 @@ 0 wxID_ANY - py + 0 py protected - wxALIGN_RIGHT|wxST_NO_AUTORESIZE + wxTE_RIGHT + - -1 @@ -2674,6 +2714,10 @@ + + + + @@ -2690,8 +2734,8 @@ none 5 - wxALL - 0 + wxALIGN_CENTER_VERTICAL|wxALL + 1 @@ -2741,9 +2785,9 @@ 5 - wxALL|wxEXPAND - 1 - + wxALL + 4 + 1 @@ -2751,20 +2795,20 @@ 0 wxID_ANY - pz + 0 pz protected - wxALIGN_RIGHT|wxST_NO_AUTORESIZE + wxTE_RIGHT + - -1 @@ -2787,6 +2831,10 @@ + + + + @@ -2808,7 +2856,7 @@ 5 wxEXPAND 1 - + bSizer198 wxVERTICAL @@ -2875,8 +2923,8 @@ none 5 - wxALL - 0 + wxALIGN_CENTER_VERTICAL|wxALL + 1 @@ -2926,9 +2974,9 @@ 5 - wxEXPAND|wxALL - 1 - + wxALL + 4 + 1 @@ -2936,20 +2984,20 @@ 0 wxID_ANY - vx + 0 vx protected - wxALIGN_RIGHT|wxST_NO_AUTORESIZE + wxTE_RIGHT + - -1 @@ -2972,6 +3020,10 @@ + + + + @@ -2988,8 +3040,8 @@ none 5 - wxALL - 0 + wxALIGN_CENTER_VERTICAL|wxALL + 1 @@ -3039,9 +3091,9 @@ 5 - wxALL|wxEXPAND - 1 - + wxALL + 4 + 1 @@ -3049,20 +3101,20 @@ 0 wxID_ANY - vy + 0 vy protected - wxALIGN_RIGHT|wxST_NO_AUTORESIZE + wxTE_RIGHT + - wxSIMPLE_BORDER - -1 + @@ -3085,6 +3137,10 @@ + + + + @@ -3101,8 +3157,8 @@ none 5 - wxALL - 0 + wxALIGN_CENTER_VERTICAL|wxALL + 1 @@ -3152,9 +3208,9 @@ 5 - wxALL|wxEXPAND - 1 - + wxALL + 4 + 1 @@ -3162,20 +3218,20 @@ 0 wxID_ANY - vz + 0 vz protected - wxALIGN_RIGHT|wxST_NO_AUTORESIZE + wxTE_RIGHT + - -1 @@ -3198,6 +3254,10 @@ + + + + @@ -3214,8 +3274,8 @@ none 5 - wxALL - 0 + wxALIGN_CENTER_VERTICAL|wxALL + 1 @@ -3224,7 +3284,7 @@ ,90,92,-1,70,0 0 wxID_ANY - Speed + Vel m_staticText5342 @@ -3265,9 +3325,9 @@ 5 - wxALL|wxEXPAND - 1 - + wxALL + 4 + 1 @@ -3275,20 +3335,20 @@ 0 wxID_ANY - speed + 0 speed protected - wxALIGN_RIGHT|wxST_NO_AUTORESIZE + wxTE_RIGHT + - -1 @@ -3311,6 +3371,10 @@ + + + + @@ -3322,1043 +3386,1100 @@ 5 - wxALL|wxEXPAND|wxFIXED_MINSIZE - 0 - - wxID_ANY - Date/Time + wxEXPAND + 1 + - sbSizer37 - wxVERTICAL + bSizer110 + wxHORIZONTAL none - 5 - wxEXPAND - 1 - + wxALL|wxEXPAND|wxFIXED_MINSIZE + 3 + + wxID_ANY + Date/Time - bSizer9221 - wxHORIZONTAL + sbSizer37 + wxVERTICAL none + 5 - wxALL - 0 - - - - 1 - - ,90,92,-1,70,0 - 0 - wxID_ANY - UTC Time - - - m_staticText57721 - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND + wxEXPAND 1 - - - - 1 - - - 0 - wxID_ANY - utct - + - utct - protected - - - wxALIGN_RIGHT|wxST_NO_AUTORESIZE - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - - bSizer92 - wxHORIZONTAL - none - - 5 - wxALL - 0 - - - - 1 - - ,90,92,-1,70,0 - 0 - wxID_ANY - GPS Week - - - m_staticText577 - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 1 - - - - 1 - - - 0 - wxID_ANY - gpsw - - - gpsw - protected - - - wxALIGN_RIGHT|wxST_NO_AUTORESIZE - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - - bSizer922 - wxHORIZONTAL - none - - 5 - wxALL - 0 - - - - 1 - - ,90,92,-1,70,0 - 0 - wxID_ANY - GPS Second - - - m_staticText5772 - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 1 - - - - 1 - - - 0 - wxID_ANY - gpss - - - gpss - protected - - - wxALIGN_RIGHT|wxST_NO_AUTORESIZE - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - - bSizer921 - wxHORIZONTAL - none - - 5 - wxALL - 0 - - - - 1 - - ,90,92,-1,70,0 - 0 - wxID_ANY - Clock Bias - - - m_staticText5771 - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 1 - - - - 1 - - - 0 - wxID_ANY - cb - - - cb - protected - - - wxALIGN_RIGHT|wxST_NO_AUTORESIZE - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - + bSizer9221 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 1 + + + + 1 + + ,90,92,-1,70,0 + 0 + wxID_ANY + UTC Time + + + m_staticText57721 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 2 + + + + 1 + + + 0 + wxID_ANY + + 0 + + utct + protected + + + wxTE_RIGHT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - 5 - wxEXPAND - 1 - - - bSizer9211 - wxHORIZONTAL - none - - 5 - wxALL - 0 - - - - 1 - - ,90,92,-1,70,0 - 0 - wxID_ANY - Clock Rate - + + 5 + wxEXPAND + 1 + - m_staticText57711 - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - + bSizer92 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 1 + + + + 1 + + ,90,92,-1,70,0 + 0 + wxID_ANY + GPS Week + + + m_staticText577 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 2 + + + + 1 + + + 0 + wxID_ANY + + 0 + + gpsw + protected + + + wxTE_RIGHT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 - wxALL|wxEXPAND + wxEXPAND 1 - - - - 1 - - - 0 - wxID_ANY - cr - + - cr - protected - - - wxALIGN_RIGHT|wxST_NO_AUTORESIZE - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - + bSizer922 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 1 + + + + 1 + + ,90,92,-1,70,0 + 0 + wxID_ANY + GPS Second + + + m_staticText5772 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 2 + + + + 1 + + + 0 + wxID_ANY + + 0 + + gpss + protected + + + wxTE_RIGHT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - 5 - wxALL|wxEXPAND - 0 - - wxID_ANY - PPS - - sbSizer371 - wxVERTICAL - none - - - 5 - wxEXPAND - 1 - - - bSizer923 - wxHORIZONTAL - none 5 - wxALL - 0 - - - - 1 - - ,90,92,-1,70,0 - 0 - wxID_ANY - State - + wxEXPAND + 1 + - m_staticText5773 - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - + bSizer921 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 1 + + + + 1 + + ,90,92,-1,70,0 + 0 + wxID_ANY + Clock Bias + + + m_staticText5771 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 2 + + + + 1 + + + 0 + wxID_ANY + + 0 + + cb + protected + + + wxTE_RIGHT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 - wxALL|wxEXPAND + wxEXPAND 1 - - - - 1 - - - 0 - wxID_ANY - ppsstate - + - ppsstate - protected - - - wxALIGN_RIGHT|wxST_NO_AUTORESIZE - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - + bSizer9211 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 1 + + + + 1 + + ,90,92,-1,70,0 + 0 + wxID_ANY + Clock Rate + + + m_staticText57711 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 2 + + + + 1 + + + 0 + wxID_ANY + + 0 + + cr + protected + + + wxTE_RIGHT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 - wxEXPAND - 1 - + wxALL|wxEXPAND + 2 + + wxID_ANY + PPS - bSizer92211 - wxHORIZONTAL + sbSizer371 + wxVERTICAL none + 5 - wxALL - 0 - - - - 1 - - ,90,92,-1,70,0 - 0 - wxID_ANY - Feedback - + wxEXPAND + 1 + - m_staticText577211 - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - + bSizer923 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 2 + + + + 1 + + ,90,92,-1,70,0 + 0 + wxID_ANY + State + + + m_staticText5773 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 3 + + + + 1 + + + 0 + wxID_ANY + + 0 + + ppsstate + protected + + + wxTE_RIGHT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizer92211 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 2 + + + + 1 + + ,90,92,-1,70,0 + 0 + wxID_ANY + Feedback + + + m_staticText577211 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 3 + + + + 1 + + + 0 + wxID_ANY + + 0 + + ppscmd + protected + + + wxTE_RIGHT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 - wxALL|wxEXPAND + wxEXPAND 1 - - - - 1 - - - 0 - wxID_ANY - ppscmd - - - ppscmd - protected - - - wxALIGN_RIGHT|wxST_NO_AUTORESIZE - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - - bSizer9212 - wxHORIZONTAL - none - - 5 - wxALL - 0 - - - - 1 - - ,90,92,-1,70,0 - 0 - wxID_ANY - Clock Rate - + - m_staticText57712 - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - + bSizer9212 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 2 + + + + 1 + + ,90,92,-1,70,0 + 0 + wxID_ANY + Clock Rate + + + m_staticText57712 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 3 + + + + 1 + + + 0 + wxID_ANY + + 0 + + ppscr + protected + + + wxTE_RIGHT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 - wxALL|wxEXPAND + wxEXPAND 1 - - - - 1 - - - 0 - wxID_ANY - ppscr - - - ppscr - protected - - - wxALIGN_RIGHT|wxST_NO_AUTORESIZE - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - - bSizer92111 - wxHORIZONTAL - none - - 5 - wxALL - 0 - - - - 1 - - ,90,92,-1,70,0 - 0 - wxID_ANY - Filtered Error - + - m_staticText577111 - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - + bSizer92111 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 2 + + + + 1 + + ,90,92,-1,70,0 + 0 + wxID_ANY + Filtered Error + + + m_staticText577111 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 3 + + + + 1 + + + 0 + wxID_ANY + + 0 + + ppserr + protected + + + wxTE_RIGHT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 - wxALL|wxEXPAND + wxEXPAND 1 - - - - 1 - - - 0 - wxID_ANY - errflt - - - ppserr + + 0 protected - - - wxALIGN_RIGHT|wxST_NO_AUTORESIZE - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - + 0 @@ -4655,7 +4776,7 @@ protected - wxALIGN_RIGHT|wxST_NO_AUTORESIZE + wxALIGN_RIGHT @@ -5985,7 +6106,7 @@ protected - wxALIGN_RIGHT|wxST_NO_AUTORESIZE + wxALIGN_LEFT @@ -6098,7 +6219,7 @@ protected - wxALIGN_RIGHT|wxST_NO_AUTORESIZE + wxALIGN_LEFT @@ -6211,7 +6332,7 @@ protected - wxALIGN_RIGHT|wxST_NO_AUTORESIZE + wxALIGN_LEFT @@ -6396,7 +6517,7 @@ protected - wxALIGN_RIGHT|wxST_NO_AUTORESIZE + wxALIGN_LEFT @@ -6509,7 +6630,7 @@ protected - wxALIGN_RIGHT|wxST_NO_AUTORESIZE + wxALIGN_LEFT @@ -6622,7 +6743,7 @@ protected - wxALIGN_RIGHT|wxST_NO_AUTORESIZE + wxALIGN_LEFT @@ -9523,7 +9644,7 @@ 5 wxEXPAND 1 - + 5 0 @@ -13792,7 +13913,7 @@ iGUI_Log - + 600,400 wxDEFAULT_DIALOG_STYLE Logging Config @@ -13835,6 +13956,72 @@ bSizer30 wxVERTICAL none + + 5 + wxALL|wxEXPAND + 0 + + wxID_ANY + Log Path + + sbSizer27 + wxVERTICAL + none + + + 5 + wxALL|wxEXPAND + 1 + + + + 1 + + + 0 + wxID_ANY + + Select a folder + + mFile + public + + + wxDIRP_DEFAULT_STYLE|wxDIRP_DIR_MUST_EXIST|wxDIRP_USE_TEXTCTRL + + + /home/gpssim/workspace/gps-sdr/gse + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 wxALL|wxEXPAND @@ -14431,63 +14618,166 @@ + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Google Earth + + + cGearth + public + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Rinex Observation + + + cRobs + public + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Rinex Ephemeris + + + cRephem + public + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - 5 - wxALL|wxEXPAND - 0 - - - - 1 - - - 0 - wxID_ANY - - Create/Open File for Logging - - mFile - public - - 600,-1 - wxFLP_OVERWRITE_PROMPT|wxFLP_SAVE|wxFLP_USE_TEXTCTRL - - - - *.log - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 wxALIGN_RIGHT|wxALL @@ -15055,7 +15345,7 @@ - + diff --git a/gse/gui_classes.cpp b/gse/gui_classes.cpp index 8e30229..4e9f0de 100644 --- a/gse/gui_classes.cpp +++ b/gse/gui_classes.cpp @@ -176,11 +176,10 @@ iGUI_PVT::iGUI_PVT( wxWindow* parent, wxWindowID id, const wxString& title, cons m_staticText5343->Wrap( -1 ); m_staticText5343->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer633->Add( m_staticText5343, 0, wxALL, 5 ); + bSizer633->Add( m_staticText5343, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - rticks = new wxStaticText( this, wxID_ANY, wxT("rticks"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); - rticks->Wrap( -1 ); - bSizer633->Add( rticks, 1, wxALL|wxEXPAND, 5 ); + rticks = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer633->Add( rticks, 2, wxALL|wxEXPAND, 5 ); bSizer199->Add( bSizer633, 1, wxEXPAND, 5 ); @@ -191,11 +190,10 @@ iGUI_PVT::iGUI_PVT( wxWindow* parent, wxWindowID id, const wxString& title, cons m_staticText536111->Wrap( -1 ); m_staticText536111->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer65111->Add( m_staticText536111, 0, wxALL, 5 ); + bSizer65111->Add( m_staticText536111, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - sticks = new wxStaticText( this, wxID_ANY, wxT("sticks"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); - sticks->Wrap( -1 ); - bSizer65111->Add( sticks, 1, wxALL|wxEXPAND, 5 ); + sticks = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer65111->Add( sticks, 2, wxALL|wxEXPAND, 5 ); bSizer199->Add( bSizer65111, 1, wxEXPAND, 5 ); @@ -206,11 +204,10 @@ iGUI_PVT::iGUI_PVT( wxWindow* parent, wxWindowID id, const wxString& title, cons m_staticText53411->Wrap( -1 ); m_staticText53411->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer6311->Add( m_staticText53411, 0, wxALL, 5 ); + bSizer6311->Add( m_staticText53411, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - cticks = new wxStaticText( this, wxID_ANY, wxT("cticks"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); - cticks->Wrap( -1 ); - bSizer6311->Add( cticks, 1, wxALIGN_RIGHT|wxALL, 5 ); + cticks = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer6311->Add( cticks, 2, wxALL|wxEXPAND, 5 ); bSizer199->Add( bSizer6311, 1, wxEXPAND, 5 ); @@ -235,26 +232,24 @@ iGUI_PVT::iGUI_PVT( wxWindow* parent, wxWindowID id, const wxString& title, cons m_staticText53511->Wrap( -1 ); m_staticText53511->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer6411->Add( m_staticText53511, 0, wxALL, 5 ); + bSizer6411->Add( m_staticText53511, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - iter = new wxStaticText( this, wxID_ANY, wxT("iter"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); - iter->Wrap( -1 ); - bSizer6411->Add( iter, 1, wxALL|wxEXPAND, 5 ); + iter = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer6411->Add( iter, 2, wxALL|wxEXPAND, 5 ); bSizer200->Add( bSizer6411, 1, wxEXPAND, 5 ); wxBoxSizer* bSizer642; bSizer642 = new wxBoxSizer( wxHORIZONTAL ); - m_staticText53431 = new wxStaticText( this, wxID_ANY, wxT("Nav Satellites"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText53431 = new wxStaticText( this, wxID_ANY, wxT("Nav SV"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); m_staticText53431->Wrap( -1 ); m_staticText53431->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer642->Add( m_staticText53431, 0, wxALL, 5 ); + bSizer642->Add( m_staticText53431, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - nsv = new wxStaticText( this, wxID_ANY, wxT("nsv"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); - nsv->Wrap( -1 ); - bSizer642->Add( nsv, 1, wxALL|wxEXPAND, 5 ); + nsv = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer642->Add( nsv, 2, wxALL|wxEXPAND, 5 ); bSizer200->Add( bSizer642, 1, wxEXPAND, 5 ); @@ -281,11 +276,10 @@ iGUI_PVT::iGUI_PVT( wxWindow* parent, wxWindowID id, const wxString& title, cons m_staticText534->Wrap( -1 ); m_staticText534->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer63->Add( m_staticText534, 0, wxALL, 5 ); + bSizer63->Add( m_staticText534, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - lat = new wxStaticText( this, wxID_ANY, wxT("lat"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); - lat->Wrap( -1 ); - bSizer63->Add( lat, 1, wxALL|wxEXPAND, 5 ); + lat = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer63->Add( lat, 3, wxALL, 5 ); bSizer196->Add( bSizer63, 1, wxEXPAND, 5 ); @@ -296,11 +290,10 @@ iGUI_PVT::iGUI_PVT( wxWindow* parent, wxWindowID id, const wxString& title, cons m_staticText5341->Wrap( -1 ); m_staticText5341->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer631->Add( m_staticText5341, 0, wxALL, 5 ); + bSizer631->Add( m_staticText5341, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - lon = new wxStaticText( this, wxID_ANY, wxT("lon"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); - lon->Wrap( -1 ); - bSizer631->Add( lon, 1, wxALIGN_RIGHT|wxALL, 5 ); + lon = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer631->Add( lon, 3, wxALL, 5 ); bSizer196->Add( bSizer631, 1, wxEXPAND, 5 ); @@ -311,11 +304,10 @@ iGUI_PVT::iGUI_PVT( wxWindow* parent, wxWindowID id, const wxString& title, cons m_staticText53611->Wrap( -1 ); m_staticText53611->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer6511->Add( m_staticText53611, 0, wxALL, 5 ); + bSizer6511->Add( m_staticText53611, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - alt = new wxStaticText( this, wxID_ANY, wxT("alt"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); - alt->Wrap( -1 ); - bSizer6511->Add( alt, 1, wxALL|wxEXPAND, 5 ); + alt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer6511->Add( alt, 3, wxALL, 5 ); bSizer196->Add( bSizer6511, 1, wxEXPAND, 5 ); @@ -326,11 +318,10 @@ iGUI_PVT::iGUI_PVT( wxWindow* parent, wxWindowID id, const wxString& title, cons m_staticText53614->Wrap( -1 ); m_staticText53614->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer6514->Add( m_staticText53614, 0, wxALL, 5 ); + bSizer6514->Add( m_staticText53614, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - gdop = new wxStaticText( this, wxID_ANY, wxT("gdop"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); - gdop->Wrap( -1 ); - bSizer6514->Add( gdop, 1, wxALL|wxEXPAND, 5 ); + gdop = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer6514->Add( gdop, 3, wxALL, 5 ); bSizer196->Add( bSizer6514, 1, wxEXPAND, 5 ); @@ -352,11 +343,10 @@ iGUI_PVT::iGUI_PVT( wxWindow* parent, wxWindowID id, const wxString& title, cons m_staticText535->Wrap( -1 ); m_staticText535->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer64->Add( m_staticText535, 0, wxALL, 5 ); + bSizer64->Add( m_staticText535, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - px = new wxStaticText( this, wxID_ANY, wxT("px"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); - px->Wrap( -1 ); - bSizer64->Add( px, 1, wxALL|wxEXPAND, 5 ); + px = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer64->Add( px, 4, wxALL, 5 ); bSizer197->Add( bSizer64, 1, wxEXPAND, 5 ); @@ -367,11 +357,10 @@ iGUI_PVT::iGUI_PVT( wxWindow* parent, wxWindowID id, const wxString& title, cons m_staticText5351->Wrap( -1 ); m_staticText5351->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer641->Add( m_staticText5351, 0, wxALL, 5 ); + bSizer641->Add( m_staticText5351, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - py = new wxStaticText( this, wxID_ANY, wxT("py"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); - py->Wrap( -1 ); - bSizer641->Add( py, 1, wxALL|wxEXPAND, 5 ); + py = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer641->Add( py, 4, wxALL, 5 ); bSizer197->Add( bSizer641, 1, wxEXPAND, 5 ); @@ -382,11 +371,10 @@ iGUI_PVT::iGUI_PVT( wxWindow* parent, wxWindowID id, const wxString& title, cons m_staticText53612->Wrap( -1 ); m_staticText53612->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer6512->Add( m_staticText53612, 0, wxALL, 5 ); + bSizer6512->Add( m_staticText53612, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - pz = new wxStaticText( this, wxID_ANY, wxT("pz"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); - pz->Wrap( -1 ); - bSizer6512->Add( pz, 1, wxALL|wxEXPAND, 5 ); + pz = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer6512->Add( pz, 4, wxALL, 5 ); bSizer197->Add( bSizer6512, 1, wxEXPAND, 5 ); @@ -411,11 +399,10 @@ iGUI_PVT::iGUI_PVT( wxWindow* parent, wxWindowID id, const wxString& title, cons m_staticText536->Wrap( -1 ); m_staticText536->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer65->Add( m_staticText536, 0, wxALL, 5 ); + bSizer65->Add( m_staticText536, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - vx = new wxStaticText( this, wxID_ANY, wxT("vx"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); - vx->Wrap( -1 ); - bSizer65->Add( vx, 1, wxEXPAND|wxALL, 5 ); + vx = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer65->Add( vx, 4, wxALL, 5 ); bSizer198->Add( bSizer65, 1, wxEXPAND, 5 ); @@ -426,11 +413,10 @@ iGUI_PVT::iGUI_PVT( wxWindow* parent, wxWindowID id, const wxString& title, cons m_staticText5361->Wrap( -1 ); m_staticText5361->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer651->Add( m_staticText5361, 0, wxALL, 5 ); + bSizer651->Add( m_staticText5361, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - vy = new wxStaticText( this, wxID_ANY, wxT("vy"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE|wxSIMPLE_BORDER ); - vy->Wrap( -1 ); - bSizer651->Add( vy, 1, wxALL|wxEXPAND, 5 ); + vy = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer651->Add( vy, 4, wxALL, 5 ); bSizer198->Add( bSizer651, 1, wxEXPAND, 5 ); @@ -441,26 +427,24 @@ iGUI_PVT::iGUI_PVT( wxWindow* parent, wxWindowID id, const wxString& title, cons m_staticText53613->Wrap( -1 ); m_staticText53613->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer6513->Add( m_staticText53613, 0, wxALL, 5 ); + bSizer6513->Add( m_staticText53613, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - vz = new wxStaticText( this, wxID_ANY, wxT("vz"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); - vz->Wrap( -1 ); - bSizer6513->Add( vz, 1, wxALL|wxEXPAND, 5 ); + vz = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer6513->Add( vz, 4, wxALL, 5 ); bSizer198->Add( bSizer6513, 1, wxEXPAND, 5 ); wxBoxSizer* bSizer632; bSizer632 = new wxBoxSizer( wxHORIZONTAL ); - m_staticText5342 = new wxStaticText( this, wxID_ANY, wxT("Speed"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText5342 = new wxStaticText( this, wxID_ANY, wxT("Vel"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText5342->Wrap( -1 ); m_staticText5342->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer632->Add( m_staticText5342, 0, wxALL, 5 ); + bSizer632->Add( m_staticText5342, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - speed = new wxStaticText( this, wxID_ANY, wxT("speed"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); - speed->Wrap( -1 ); - bSizer632->Add( speed, 1, wxALL|wxEXPAND, 5 ); + speed = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer632->Add( speed, 4, wxALL, 5 ); bSizer198->Add( bSizer632, 1, wxEXPAND, 5 ); @@ -468,6 +452,9 @@ iGUI_PVT::iGUI_PVT( wxWindow* parent, wxWindowID id, const wxString& title, cons bSizer18->Add( sbSizer13, 0, wxALL|wxEXPAND|wxFIXED_MINSIZE, 5 ); + wxBoxSizer* bSizer110; + bSizer110 = new wxBoxSizer( wxHORIZONTAL ); + wxStaticBoxSizer* sbSizer37; sbSizer37 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Date/Time") ), wxVERTICAL ); @@ -478,11 +465,10 @@ iGUI_PVT::iGUI_PVT( wxWindow* parent, wxWindowID id, const wxString& title, cons m_staticText57721->Wrap( -1 ); m_staticText57721->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer9221->Add( m_staticText57721, 0, wxALL, 5 ); + bSizer9221->Add( m_staticText57721, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - utct = new wxStaticText( this, wxID_ANY, wxT("utct"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); - utct->Wrap( -1 ); - bSizer9221->Add( utct, 1, wxALL|wxEXPAND, 5 ); + utct = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer9221->Add( utct, 2, wxALL, 5 ); sbSizer37->Add( bSizer9221, 1, wxEXPAND, 5 ); @@ -493,11 +479,10 @@ iGUI_PVT::iGUI_PVT( wxWindow* parent, wxWindowID id, const wxString& title, cons m_staticText577->Wrap( -1 ); m_staticText577->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer92->Add( m_staticText577, 0, wxALL, 5 ); + bSizer92->Add( m_staticText577, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - gpsw = new wxStaticText( this, wxID_ANY, wxT("gpsw"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); - gpsw->Wrap( -1 ); - bSizer92->Add( gpsw, 1, wxALL|wxEXPAND, 5 ); + gpsw = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer92->Add( gpsw, 2, wxALL, 5 ); sbSizer37->Add( bSizer92, 1, wxEXPAND, 5 ); @@ -508,11 +493,10 @@ iGUI_PVT::iGUI_PVT( wxWindow* parent, wxWindowID id, const wxString& title, cons m_staticText5772->Wrap( -1 ); m_staticText5772->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer922->Add( m_staticText5772, 0, wxALL, 5 ); + bSizer922->Add( m_staticText5772, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - gpss = new wxStaticText( this, wxID_ANY, wxT("gpss"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); - gpss->Wrap( -1 ); - bSizer922->Add( gpss, 1, wxALL|wxEXPAND, 5 ); + gpss = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer922->Add( gpss, 2, wxALL, 5 ); sbSizer37->Add( bSizer922, 1, wxEXPAND, 5 ); @@ -523,11 +507,10 @@ iGUI_PVT::iGUI_PVT( wxWindow* parent, wxWindowID id, const wxString& title, cons m_staticText5771->Wrap( -1 ); m_staticText5771->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer921->Add( m_staticText5771, 0, wxALL, 5 ); + bSizer921->Add( m_staticText5771, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - cb = new wxStaticText( this, wxID_ANY, wxT("cb"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); - cb->Wrap( -1 ); - bSizer921->Add( cb, 1, wxALL|wxEXPAND, 5 ); + cb = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer921->Add( cb, 2, wxALL, 5 ); sbSizer37->Add( bSizer921, 1, wxEXPAND, 5 ); @@ -538,15 +521,14 @@ iGUI_PVT::iGUI_PVT( wxWindow* parent, wxWindowID id, const wxString& title, cons m_staticText57711->Wrap( -1 ); m_staticText57711->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer9211->Add( m_staticText57711, 0, wxALL, 5 ); + bSizer9211->Add( m_staticText57711, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - cr = new wxStaticText( this, wxID_ANY, wxT("cr"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); - cr->Wrap( -1 ); - bSizer9211->Add( cr, 1, wxALL|wxEXPAND, 5 ); + cr = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer9211->Add( cr, 2, wxALL, 5 ); sbSizer37->Add( bSizer9211, 1, wxEXPAND, 5 ); - bSizer18->Add( sbSizer37, 0, wxALL|wxEXPAND|wxFIXED_MINSIZE, 5 ); + bSizer110->Add( sbSizer37, 3, wxALL|wxEXPAND|wxFIXED_MINSIZE, 5 ); wxStaticBoxSizer* sbSizer371; sbSizer371 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("PPS ") ), wxVERTICAL ); @@ -558,11 +540,10 @@ iGUI_PVT::iGUI_PVT( wxWindow* parent, wxWindowID id, const wxString& title, cons m_staticText5773->Wrap( -1 ); m_staticText5773->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer923->Add( m_staticText5773, 0, wxALL, 5 ); + bSizer923->Add( m_staticText5773, 2, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - ppsstate = new wxStaticText( this, wxID_ANY, wxT("ppsstate"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); - ppsstate->Wrap( -1 ); - bSizer923->Add( ppsstate, 1, wxALL|wxEXPAND, 5 ); + ppsstate = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer923->Add( ppsstate, 3, wxALL, 5 ); sbSizer371->Add( bSizer923, 1, wxEXPAND, 5 ); @@ -573,11 +554,10 @@ iGUI_PVT::iGUI_PVT( wxWindow* parent, wxWindowID id, const wxString& title, cons m_staticText577211->Wrap( -1 ); m_staticText577211->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer92211->Add( m_staticText577211, 0, wxALL, 5 ); + bSizer92211->Add( m_staticText577211, 2, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - ppscmd = new wxStaticText( this, wxID_ANY, wxT("ppscmd"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); - ppscmd->Wrap( -1 ); - bSizer92211->Add( ppscmd, 1, wxALL|wxEXPAND, 5 ); + ppscmd = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer92211->Add( ppscmd, 3, wxALL, 5 ); sbSizer371->Add( bSizer92211, 1, wxEXPAND, 5 ); @@ -588,11 +568,10 @@ iGUI_PVT::iGUI_PVT( wxWindow* parent, wxWindowID id, const wxString& title, cons m_staticText57712->Wrap( -1 ); m_staticText57712->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer9212->Add( m_staticText57712, 0, wxALL, 5 ); + bSizer9212->Add( m_staticText57712, 2, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - ppscr = new wxStaticText( this, wxID_ANY, wxT("ppscr"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); - ppscr->Wrap( -1 ); - bSizer9212->Add( ppscr, 1, wxALL|wxEXPAND, 5 ); + ppscr = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer9212->Add( ppscr, 3, wxALL, 5 ); sbSizer371->Add( bSizer9212, 1, wxEXPAND, 5 ); @@ -603,15 +582,19 @@ iGUI_PVT::iGUI_PVT( wxWindow* parent, wxWindowID id, const wxString& title, cons m_staticText577111->Wrap( -1 ); m_staticText577111->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); - bSizer92111->Add( m_staticText577111, 0, wxALL, 5 ); + bSizer92111->Add( m_staticText577111, 2, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - ppserr = new wxStaticText( this, wxID_ANY, wxT("errflt"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); - ppserr->Wrap( -1 ); - bSizer92111->Add( ppserr, 1, wxALL|wxEXPAND, 5 ); + ppserr = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT ); + bSizer92111->Add( ppserr, 3, wxALL, 5 ); sbSizer371->Add( bSizer92111, 1, wxEXPAND, 5 ); - bSizer18->Add( sbSizer371, 0, wxALL|wxEXPAND, 5 ); + + sbSizer371->Add( 0, 0, 1, wxEXPAND, 5 ); + + bSizer110->Add( sbSizer371, 2, wxALL|wxEXPAND, 5 ); + + bSizer18->Add( bSizer110, 1, wxEXPAND, 5 ); bSizer9->Add( bSizer18, 5, wxEXPAND, 5 ); @@ -670,7 +653,7 @@ iGUI_EKF::iGUI_EKF( wxWindow* parent, wxWindowID id, const wxString& title, cons bSizer633->Add( m_staticText5343, 0, wxALL, 5 ); - rticks = new wxStaticText( this, wxID_ANY, wxT("rticks"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); + rticks = new wxStaticText( this, wxID_ANY, wxT("rticks"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); rticks->Wrap( -1 ); bSizer633->Add( rticks, 1, wxALL|wxEXPAND, 5 ); @@ -858,7 +841,7 @@ iGUI_EKF::iGUI_EKF( wxWindow* parent, wxWindowID id, const wxString& title, cons bSizer64->Add( m_staticText535, 0, wxALL, 5 ); - px = new wxStaticText( this, wxID_ANY, wxT("px"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); + px = new wxStaticText( this, wxID_ANY, wxT("px"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); px->Wrap( -1 ); bSizer64->Add( px, 1, wxALL|wxEXPAND, 5 ); @@ -873,7 +856,7 @@ iGUI_EKF::iGUI_EKF( wxWindow* parent, wxWindowID id, const wxString& title, cons bSizer641->Add( m_staticText5351, 0, wxALL, 5 ); - py = new wxStaticText( this, wxID_ANY, wxT("py"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); + py = new wxStaticText( this, wxID_ANY, wxT("py"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); py->Wrap( -1 ); bSizer641->Add( py, 1, wxALL|wxEXPAND, 5 ); @@ -888,7 +871,7 @@ iGUI_EKF::iGUI_EKF( wxWindow* parent, wxWindowID id, const wxString& title, cons bSizer6512->Add( m_staticText53612, 0, wxALL, 5 ); - pz = new wxStaticText( this, wxID_ANY, wxT("pz"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); + pz = new wxStaticText( this, wxID_ANY, wxT("pz"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); pz->Wrap( -1 ); bSizer6512->Add( pz, 1, wxALL|wxEXPAND, 5 ); @@ -917,7 +900,7 @@ iGUI_EKF::iGUI_EKF( wxWindow* parent, wxWindowID id, const wxString& title, cons bSizer65->Add( m_staticText536, 0, wxALL, 5 ); - vx = new wxStaticText( this, wxID_ANY, wxT("vx"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); + vx = new wxStaticText( this, wxID_ANY, wxT("vx"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); vx->Wrap( -1 ); bSizer65->Add( vx, 1, wxEXPAND|wxALL, 5 ); @@ -932,7 +915,7 @@ iGUI_EKF::iGUI_EKF( wxWindow* parent, wxWindowID id, const wxString& title, cons bSizer651->Add( m_staticText5361, 0, wxALL, 5 ); - vy = new wxStaticText( this, wxID_ANY, wxT("vy"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE|wxSIMPLE_BORDER ); + vy = new wxStaticText( this, wxID_ANY, wxT("vy"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT|wxSIMPLE_BORDER ); vy->Wrap( -1 ); bSizer651->Add( vy, 1, wxALL|wxEXPAND, 5 ); @@ -947,7 +930,7 @@ iGUI_EKF::iGUI_EKF( wxWindow* parent, wxWindowID id, const wxString& title, cons bSizer6513->Add( m_staticText53613, 0, wxALL, 5 ); - vz = new wxStaticText( this, wxID_ANY, wxT("vz"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); + vz = new wxStaticText( this, wxID_ANY, wxT("vz"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); vz->Wrap( -1 ); bSizer6513->Add( vz, 1, wxALL|wxEXPAND, 5 ); @@ -1979,6 +1962,14 @@ iGUI_Log::iGUI_Log( wxWindow* parent, wxWindowID id, const wxString& title, cons wxBoxSizer* bSizer30; bSizer30 = new wxBoxSizer( wxVERTICAL ); + wxStaticBoxSizer* sbSizer27; + sbSizer27 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Log Path") ), wxVERTICAL ); + + mFile = new wxDirPickerCtrl( this, wxID_ANY, wxT("/home/gpssim/workspace/gps-sdr/gse"), wxT("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_DEFAULT_STYLE|wxDIRP_DIR_MUST_EXIST|wxDIRP_USE_TEXTCTRL ); + sbSizer27->Add( mFile, 1, wxALL|wxEXPAND, 5 ); + + bSizer30->Add( sbSizer27, 0, wxALL|wxEXPAND, 5 ); + wxStaticBoxSizer* sbSizer14; sbSizer14 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Logged Items") ), wxVERTICAL ); @@ -2029,13 +2020,22 @@ iGUI_Log::iGUI_Log( wxWindow* parent, wxWindowID id, const wxString& title, cons gSizer3->Add( cSVPred, 0, wxALL, 5 ); + cGearth = new wxCheckBox( this, wxID_ANY, wxT("Google Earth"), wxDefaultPosition, wxDefaultSize, 0 ); + + gSizer3->Add( cGearth, 0, wxALL, 5 ); + + cRobs = new wxCheckBox( this, wxID_ANY, wxT("Rinex Observation"), wxDefaultPosition, wxDefaultSize, 0 ); + + gSizer3->Add( cRobs, 0, wxALL, 5 ); + + cRephem = new wxCheckBox( this, wxID_ANY, wxT("Rinex Ephemeris"), wxDefaultPosition, wxDefaultSize, 0 ); + + gSizer3->Add( cRephem, 0, wxALL, 5 ); + sbSizer14->Add( gSizer3, 0, wxEXPAND, 5 ); bSizer30->Add( sbSizer14, 1, wxALL|wxEXPAND, 5 ); - mFile = new wxFilePickerCtrl( this, wxID_ANY, wxEmptyString, wxT("Create/Open File for Logging"), wxT("*.log"), wxDefaultPosition, wxSize( 600,-1 ), wxFLP_OVERWRITE_PROMPT|wxFLP_SAVE|wxFLP_USE_TEXTCTRL ); - bSizer30->Add( mFile, 0, wxALL|wxEXPAND, 5 ); - wxBoxSizer* bSizer31; bSizer31 = new wxBoxSizer( wxHORIZONTAL ); @@ -2052,7 +2052,6 @@ iGUI_Log::iGUI_Log( wxWindow* parent, wxWindowID id, const wxString& title, cons this->SetSizer( bSizer30 ); this->Layout(); - bSizer30->Fit( this ); } iGUI_Log::~iGUI_Log() diff --git a/gse/gui_classes.h b/gse/gui_classes.h index 753e3fb..e4a2744 100644 --- a/gse/gui_classes.h +++ b/gse/gui_classes.h @@ -115,68 +115,69 @@ class iGUI_PVT : public wxFrame wxPanel* pCN0; wxStaticText* m_staticText5311; wxStaticText* m_staticText5343; - wxStaticText* rticks; + wxTextCtrl* rticks; wxStaticText* m_staticText536111; - wxStaticText* sticks; + wxTextCtrl* sticks; wxStaticText* m_staticText53411; - wxStaticText* cticks; + wxTextCtrl* cticks; wxStaticText* m_staticText5321; wxStaticText* m_staticText53511; - wxStaticText* iter; + wxTextCtrl* iter; wxStaticText* m_staticText53431; - wxStaticText* nsv; + wxTextCtrl* nsv; wxStaticText* m_staticText531; wxStaticText* m_staticText534; - wxStaticText* lat; + wxTextCtrl* lat; wxStaticText* m_staticText5341; - wxStaticText* lon; + wxTextCtrl* lon; wxStaticText* m_staticText53611; - wxStaticText* alt; + wxTextCtrl* alt; wxStaticText* m_staticText53614; - wxStaticText* gdop; + wxTextCtrl* gdop; wxStaticText* m_staticText532; wxStaticText* m_staticText535; - wxStaticText* px; + wxTextCtrl* px; wxStaticText* m_staticText5351; - wxStaticText* py; + wxTextCtrl* py; wxStaticText* m_staticText53612; - wxStaticText* pz; + wxTextCtrl* pz; wxStaticText* m_staticText533; wxStaticText* m_staticText536; - wxStaticText* vx; + wxTextCtrl* vx; wxStaticText* m_staticText5361; - wxStaticText* vy; + wxTextCtrl* vy; wxStaticText* m_staticText53613; - wxStaticText* vz; + wxTextCtrl* vz; wxStaticText* m_staticText5342; - wxStaticText* speed; + wxTextCtrl* speed; wxStaticText* m_staticText57721; - wxStaticText* utct; + wxTextCtrl* utct; wxStaticText* m_staticText577; - wxStaticText* gpsw; + wxTextCtrl* gpsw; wxStaticText* m_staticText5772; - wxStaticText* gpss; + wxTextCtrl* gpss; wxStaticText* m_staticText5771; - wxStaticText* cb; + wxTextCtrl* cb; wxStaticText* m_staticText57711; - wxStaticText* cr; + wxTextCtrl* cr; wxStaticText* m_staticText5773; - wxStaticText* ppsstate; + wxTextCtrl* ppsstate; wxStaticText* m_staticText577211; - wxStaticText* ppscmd; + wxTextCtrl* ppscmd; wxStaticText* m_staticText57712; - wxStaticText* ppscr; + wxTextCtrl* ppscr; wxStaticText* m_staticText577111; - wxStaticText* ppserr; + wxTextCtrl* ppserr; + // Virtual event handlers, overide them in your derived class virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } public: - iGUI_PVT( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("PVT"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 1000,600 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); + iGUI_PVT( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("PVT"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 1600,600 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); ~iGUI_PVT(); }; @@ -495,6 +496,7 @@ class iGUI_Log : public wxDialog wxButton* bOK; public: + wxDirPickerCtrl* mFile; wxCheckBox* cPVT; wxCheckBox* cClock; wxCheckBox* cPPS; @@ -506,8 +508,10 @@ class iGUI_Log : public wxDialog wxCheckBox* cTask; wxCheckBox* cBoard; wxCheckBox* cSVPred; - wxFilePickerCtrl* mFile; - iGUI_Log( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Logging Config"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + wxCheckBox* cGearth; + wxCheckBox* cRobs; + wxCheckBox* cRephem; + iGUI_Log( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Logging Config"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 600,400 ), long style = wxDEFAULT_DIALOG_STYLE ); ~iGUI_Log(); }; diff --git a/gse/include/gui_serial.h b/gse/include/gui_serial.h index 7ed9afd..c1d65de 100644 --- a/gse/include/gui_serial.h +++ b/gse/include/gui_serial.h @@ -56,7 +56,7 @@ class GUI_Serial : public Threaded_Object /* Headers for CCSDC packets */ CCSDS_Packet_Header packet_header; //!< CCSDS Packet header CCSDS_Decoded_Header decoded_packet; //!< Decoded header - int32 packet_count[LAST_M_ID+1]; //!< Count the packets + int32 packet_count[LAST_M_ID + 1]; //!< Count the packets int32 byte_count; //!< Count the bytes /* Buffer for commands */ @@ -75,9 +75,13 @@ class GUI_Serial : public Threaded_Object /* Logging variables */ int32 logging_on; //!< Control overall logging - char filename[1024]; //!< Log to this file + char filepath[1024]; //!< Log to this path + FILE *robsfile; //!< Pointer to Rinex observation file + FILE *rephemfile; //!< Pointer to Rinex ephemeris file FILE *lfile; //!< Pointer to log file - int32 log_flag[LAST_M_ID]; //!< Control messages on/off + FILE *gfile; //!< Pointer to google earth file + int32 gfile_end; //!< Pointer to end of gfile + int32 log_flag[LAST_M_ID + 20]; //!< Control messages on/off public: @@ -115,7 +119,7 @@ class GUI_Serial : public Threaded_Object void logStop(); void logClear(); void setLogFile(const char *_str); - char *getLogFile(){return(&filename[0]);}; + char *getLogFile(){return(&filepath[0]);}; void printPVT(); void printClock(); @@ -130,6 +134,14 @@ class GUI_Serial : public Threaded_Object void printSVPred(int32 _sv); void printTask(); void printBoard(); + void printGoogleEarth(); + void printGoogleEarthHeader(); + void printGoogleEarthFooter(); + void printRinexObs(); + void printRinexObsHeader(); + void printRinexEphem(); + void printRinexEphemHeader(); + void pendCommand(); //!< Wait for a free command int32 peekCommand(); //!< Poll for a command diff --git a/gse/src/gui_pvt.cpp b/gse/src/gui_pvt.cpp index 2bfc991..656ace3 100644 --- a/gse/src/gui_pvt.cpp +++ b/gse/src/gui_pvt.cpp @@ -187,58 +187,63 @@ void GUI_PVT::renderPVT() vel = sqrt(pNav->vz*pNav->vz + pNav->vy*pNav->vy + pNav->vx*pNav->vx); - str.Printf(wxT("%15d"),pNav->tic); rticks->SetLabel(str); - str.Printf(wxT("%15d"),pNav->converged_ticks); cticks->SetLabel(str); - str.Printf(wxT("%15d"),pNav->stale_ticks); sticks->SetLabel(str); - str.Printf(wxT("%15d"),nchan); nsv->SetLabel(str); - str.Printf(wxT("%15.2f m"),pNav->x); px->SetLabel(str); - str.Printf(wxT("%15.2f m"),pNav->y); py->SetLabel(str); - str.Printf(wxT("%15.2f m"),pNav->z); pz->SetLabel(str); - str.Printf(wxT("%.2f cm/s"),100.0*pNav->vx); vx->SetLabel(str); - str.Printf(wxT("%.2f cm/s"),100.0*pNav->vy); vy->SetLabel(str); - str.Printf(wxT("%.2f cm/s"),100.0*pNav->vz); vz->SetLabel(str); - str.Printf(wxT("%.2f m/s"),vel); speed->SetLabel(str); - - str.Printf(wxT("%15.9f"),pNav->latitude*RAD_2_DEG); lat->SetLabel(str); - str.Printf(wxT("%15.9f"),pNav->longitude*RAD_2_DEG); lon->SetLabel(str); - str.Printf(wxT("%15.2f"),pNav->altitude); alt->SetLabel(str); - - str.Printf(wxT("%15.9f"),pClock->bias); cb->SetLabel(str); - str.Printf(wxT("%15.6f"),pClock->rate); cr->SetLabel(str); - str.Printf(wxT("%15.6f"),pClock->time); gpss->SetLabel(str); - str.Printf(wxT("%8u"),pClock->week); gpsw->SetLabel(str); - str.Printf(wxT("%8u"),pNav->iterations); iter->SetLabel(str); - str.Printf(wxT("%15.2f"),pNav->gdop); gdop->SetLabel(str); - str.Printf(wxT("%15e"),pPPS->err_lp); ppserr->SetLabel(str); - str.Printf(wxT("%15e"),pPPS->feedback*SPEED_OF_LIGHT); ppscmd->SetLabel(str); - str.Printf(wxT("%15e"),pPPS->clock_rate*SPEED_OF_LIGHT);ppscr->SetLabel(str); + str.Printf(wxT("%15d"),pNav->tic); rticks->Clear(); rticks->WriteText(str); + str.Printf(wxT("%15d"),pNav->converged_ticks); cticks->Clear(); cticks->WriteText(str); + str.Printf(wxT("%15d"),pNav->stale_ticks); sticks->Clear(); sticks->WriteText(str); + str.Printf(wxT("%15d"),nchan); nsv->Clear(); nsv->WriteText(str); + str.Printf(wxT("%15.2f m"),pNav->x); px->Clear(); px->WriteText(str); + str.Printf(wxT("%15.2f m"),pNav->y); py->Clear(); py->WriteText(str); + str.Printf(wxT("%15.2f m"),pNav->z); pz->Clear(); pz->WriteText(str); + str.Printf(wxT("%.2f cm/s"),100.0*pNav->vx); vx->Clear(); vx->WriteText(str); + str.Printf(wxT("%.2f cm/s"),100.0*pNav->vy); vy->Clear(); vy->WriteText(str); + str.Printf(wxT("%.2f cm/s"),100.0*pNav->vz); vz->Clear(); vz->WriteText(str); + str.Printf(wxT("%.2f m/s"),vel); speed->Clear(); speed->WriteText(str); + + str.Printf(wxT("%15.9f"),pNav->latitude*RAD_2_DEG); lat->Clear(); lat->WriteText(str); + str.Printf(wxT("%15.9f"),pNav->longitude*RAD_2_DEG); lon->Clear(); lon->WriteText(str); + str.Printf(wxT("%15.2f"),pNav->altitude); alt->Clear(); alt->WriteText(str); + + str.Printf(wxT("%15.9f"),pClock->bias); cb->Clear(); cb->WriteText(str); + str.Printf(wxT("%15.6f"),pClock->rate); cr->Clear(); cr->WriteText(str); + str.Printf(wxT("%15.6f"),pClock->time); gpss->Clear(); gpss->WriteText(str); + str.Printf(wxT("%8u"),pClock->week); gpsw->Clear(); gpsw->WriteText(str); + + str.Printf(wxT("%8u"),pNav->iterations); iter->Clear(); iter->WriteText(str); + str.Printf(wxT("%15.2f"),pNav->gdop); gdop->Clear(); gdop->WriteText(str); + str.Printf(wxT("%.5e"),pPPS->err_lp); ppserr->Clear(); ppserr->WriteText(str); + str.Printf(wxT("%.5e"),pPPS->feedback*SPEED_OF_LIGHT); ppscmd->Clear(); ppscmd->WriteText(str); + str.Printf(wxT("%.5e"),pPPS->clock_rate*SPEED_OF_LIGHT);ppscr->Clear(); ppscr->WriteText(str); if(pPPS->state) - ppsstate->SetLabel(wxT("Slow Slew")); + { + ppsstate->Clear(); ppsstate->WriteText(wxT("Slow Slew")); + } else - ppsstate->SetLabel(wxT("Fast Slew")); + { + ppsstate->Clear(); ppsstate->WriteText(wxT("Fast Slew")); + } /* Get into unix time */ if(pTOT->valid) { utcsec = floor(pTOT->second); - utcsec += (pTOT->week + 1024*CURRENT_GPS_WEEK_ROLLOVER)*SECONDS_IN_WEEK; + utcsec += (pTOT->week)*SECONDS_IN_WEEK; utcsec += (pTOT->day)*SECONDS_IN_DAY; - utcsec -= 10; //Difference of TAI and UTC + utcsec -= 10; //!< Difference of TAI and UTC utcsec += 315964819; //!< 0 Unix time --> GPS time offset theTime.Set(utcsec); str = theTime.FormatISODate(); - str += wxT('\t'); + str += wxT(' '); str += theTime.FormatISOTime(); - str2.Printf(wxT("%15.6f"),fmod(pTOT->second,1.0)); - str += str2; - utct->SetLabel(str); + str2.Printf(wxT("%.6f"),fmod(pTOT->second,1.0)); + str += str2.Mid(1,wxSTRING_MAXLEN); + utct->Clear(); utct->WriteText(str); } else { utcsec = 0; - utct->SetLabel(wxT("No UTC Information\n")); + utct->Clear(); utct->WriteText(wxT("No UTC Information")); } } diff --git a/gse/src/gui_select.cpp b/gse/src/gui_select.cpp index 1b28e0c..9b81ecf 100644 --- a/gse/src/gui_select.cpp +++ b/gse/src/gui_select.cpp @@ -33,9 +33,9 @@ GUI_Select::GUI_Select():iGUI_Select(NULL, wxID_ANY, wxT("SV Select"), wxDefault int32 strwidth; wxString str; - str = wxT("Ch# Vis Elev Azim Doppler Time"); + str = wxT("Ch# Vis Elev Azim Doppler Time "); strwidth = str.Length()+3; - SetSize(tDisplay->GetCharWidth()*strwidth, tDisplay->GetCharHeight()*(MAX_SV+2) + 280); + SetSize(tDisplay->GetCharWidth()*strwidth, tDisplay->GetCharHeight()*(MAX_SV+3) + 280); } diff --git a/gse/src/gui_serial.cpp b/gse/src/gui_serial.cpp index 06f843b..7f737ed 100644 --- a/gse/src/gui_serial.cpp +++ b/gse/src/gui_serial.cpp @@ -23,7 +23,7 @@ Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1 #include "gui_serial.h" #define SWAP64(X) *((long long *)(&X)) = (((*((long long *)(&X)) & (0x00000000ffffffffLLU)) << 32) | ((*((long long *)(&X)) & (0xffffffff00000000LLU)) >> 32)) -static uint32 SIZEOF_M[LAST_M_ID+1] = +static uint32 SIZEOF_M[LAST_M_ID + 1] = { 0, 0, @@ -139,13 +139,16 @@ GUI_Serial::GUI_Serial() npipe[READ] = -1; npipe[WRITE] = -1; lfile = NULL; + gfile = NULL; + robsfile = NULL; + rephemfile = NULL; packet_count[LAST_M_ID] = 0; decoded_packet.tic = decoded_packet.id = decoded_packet.length = 0; memset(&packet_count[0], 0x0, (LAST_M_ID+1)*sizeof(int)); memset(&command_body, 0x0, sizeof(Command_Union)); memset(&command_header, 0x0, sizeof(CCSDS_Packet_Header)); memset(&decoded_command, 0x0, sizeof(CCSDS_Decoded_Header)); - memset(&filename[0], 0x0, 1024*sizeof(char)); + memset(&filepath[0], 0x0, 1024*sizeof(char)); memset(&log_flag[0], 0x0, LAST_M_ID*sizeof(char)); signal(SIGPIPE, lost_client); @@ -186,7 +189,7 @@ void GUI_Serial::openSerial() } memset(&tty, 0x0, sizeof(tty)); //!< Initialize the port settings structure to all zeros - tty.c_cflag = B115200 | CS8 | CLOCAL | CREAD | CRTSCTS; //!< 8N1 + tty.c_cflag = B57600 | CS8 | CLOCAL | CREAD | CRTSCTS; //!< 8N1 tty.c_iflag = IGNPAR; tty.c_oflag = 0; tty.c_lflag = 0; @@ -517,9 +520,11 @@ void GUI_Serial::readGPS() } break; case SPS_M_ID: + if(log_flag[LAST_M_ID + 1]) printRinexObs(); FixDoubles((void *)&src->sps, 13); memcpy(&dst->sps, &src->sps, sizeof(SPS_M)); if(log_flag[SPS_M_ID]) printPVT(); + if(log_flag[LAST_M_ID]) printGoogleEarth(); break; case CLOCK_M_ID: FixDoubles((void *)&src->clock, 6); @@ -908,9 +913,7 @@ int32 GUI_Serial::peekCommand() /*----------------------------------------------------------------------------------------------*/ void GUI_Serial::setLogFile(const char *_str) { - if(lfile) fclose(lfile); - strcpy(filename, _str); - lfile = fopen(filename, "wt"); + strcpy(filepath, _str); } /*----------------------------------------------------------------------------------------------*/ @@ -918,10 +921,40 @@ void GUI_Serial::setLogFile(const char *_str) /*----------------------------------------------------------------------------------------------*/ void GUI_Serial::logStart() { + char filename[1024]; + if(lfile) fclose(lfile); - lfile = NULL; + if(gfile) fclose(gfile); + if(robsfile) fclose(robsfile); + if(rephemfile) fclose(rephemfile); + + strcpy(filename, filepath); + strcat(filename,"/gps-sdr.log"); lfile = fopen(filename, "wt"); + if(log_flag[LAST_M_ID]) + { + strcpy(filename, filepath); + strcat(filename,"/gps-sdr.klm"); + gfile = fopen(filename, "wt"); + printGoogleEarthHeader(); + } + + if(log_flag[LAST_M_ID + 1]) + { + strcpy(filename, filepath); + strcat(filename,"/gps-sdr.rnx"); + robsfile = fopen(filename, "wt"); + printRinexObsHeader(); + } + + if(log_flag[LAST_M_ID + 2]) + { + strcpy(filename, filepath); + strcat(filename,"/gps-sdr.epm"); + rephemfile = fopen(filename, "wt"); + } + if(lfile) logging_on = true; } @@ -932,7 +965,13 @@ void GUI_Serial::logStart() void GUI_Serial::logStop() { if(lfile) fclose(lfile); + if(gfile) fclose(gfile); + if(robsfile) fclose(robsfile); + if(rephemfile) fclose(rephemfile); lfile = NULL; + gfile = NULL; + robsfile = NULL; + rephemfile = NULL; logging_on = false; } /*----------------------------------------------------------------------------------------------*/ @@ -941,11 +980,39 @@ void GUI_Serial::logStop() /*----------------------------------------------------------------------------------------------*/ void GUI_Serial::logClear() { + char filename[1024]; + if(lfile) fclose(lfile); - lfile = NULL; + if(gfile) fclose(gfile); + if(robsfile) fclose(robsfile); + if(rephemfile) fclose(rephemfile); + + strcpy(filename, filepath); + strcat(filename,"/gps-sdr.log"); lfile = fopen(filename, "wt"); - if(lfile) fclose(lfile); - lfile = NULL; + + if(log_flag[LAST_M_ID]) + { + strcpy(filename, filepath); + strcat(filename,"/gps-sdr.klm"); + gfile = fopen(filename, "wt"); + } + + if(log_flag[LAST_M_ID + 1]) + { + strcpy(filename, filepath); + strcat(filename,"/gps-sdr.rnx"); + robsfile = fopen(filename, "wt"); + } + + if(log_flag[LAST_M_ID + 2]) + { + strcpy(filename, filepath); + strcat(filename,"/gps-sdr.epm"); + rephemfile = fopen(filename, "wt"); + } + + logStop(); } /*----------------------------------------------------------------------------------------------*/ @@ -1303,3 +1370,231 @@ void GUI_Serial::printBoard() } } /*----------------------------------------------------------------------------------------------*/ + + + +/*----------------------------------------------------------------------------------------------*/ +void GUI_Serial::printGoogleEarth() +{ + + SPS_M *pNav = &messages.sps; + + if(gfile != NULL) + { + if(pNav->converged) + { + fseek(gfile, gfile_end, SEEK_SET); + fprintf(gfile,"%15.9f,%15.9f,%15.9f\n",pNav->longitude*RAD_2_DEG,pNav->latitude*RAD_2_DEG,pNav->altitude); + gfile_end = ftell(gfile); + printGoogleEarthFooter(); + } + } + +} +/*----------------------------------------------------------------------------------------------*/ + + +/*----------------------------------------------------------------------------------------------*/ +void GUI_Serial::printGoogleEarthHeader() +{ + + if(gfile != NULL) + { + fprintf(gfile,"\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"navigation.kml\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"GPS SDR\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"1\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"0\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"relativeToGround\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"0\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"0\n"); + fprintf(gfile,"0\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"absolute\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"\n"); + gfile_end = ftell(gfile); + } +} +/*----------------------------------------------------------------------------------------------*/ + + +/*----------------------------------------------------------------------------------------------*/ +void GUI_Serial::printGoogleEarthFooter() +{ + if(gfile != NULL) + { + fprintf(gfile,"\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"\n"); + fprintf(gfile,"\n"); + } +} +/*----------------------------------------------------------------------------------------------*/ + + +/*----------------------------------------------------------------------------------------------*/ +void GUI_Serial::printRinexObsHeader() +{ + + if(robsfile != NULL) + { + fprintf(robsfile," 2.10 RINEX VERSION / TYPE\n"); + fprintf(robsfile," 4 C1 D1 L1 S1 # / TYPES OF OBSERV\n"); + fprintf(robsfile," END OF HEADER\n"); + } + +} +/*----------------------------------------------------------------------------------------------*/ + + +/*----------------------------------------------------------------------------------------------*/ +void GUI_Serial::printRinexObs() +{ + + int32 lcv; + int32 nsv; + time_t utcsec; + Channel_M *pChan; + Pseudorange_M *pPseudo; + SPS_M *pNav = &messages.sps; + Clock_M *pClock = &messages.clock; + wxDateTime theTime; + + if(robsfile != NULL) + { + + /* Get the time into UTC */ + utcsec = floor(pClock->time_raw); //!< Seconds in GPS week + utcsec += (pClock->week)*SECONDS_IN_WEEK; + utcsec -= 10; //!< Difference of TAI and UTC + utcsec += 315964819; //!< 0 Unix time --> GPS time offset + theTime.Set(utcsec); + + /* Pull out the individual PRN numbers */ + nsv = 0; + for(lcv = 0; lcv < MAX_CHANNELS; lcv++) + { + if(messages.pseudoranges[lcv].sv != NON_EXISTENT_SV) + { + nsv++; + } + } + + /* Generate the date line */ + fprintf(robsfile,"%3d%3d%3d%3d%3d%12.8f 0%3d", + theTime.GetYear() % 100, + theTime.GetMonth()+1, + theTime.GetDay(), + theTime.GetHour(), + theTime.GetMinute(), + (double)theTime.GetSecond() + fmod(pClock->time_raw, 1.0), + nsv); + + /* Push the individual PRN numbers */ + for(lcv = 0; lcv < MAX_CHANNELS; lcv++) + { + pPseudo = &messages.pseudoranges[lcv]; + if(pPseudo->sv != NON_EXISTENT_SV) + { + fprintf(robsfile,"%3d",pPseudo->sv+1); + } + } + + /* Newline */ + fprintf(robsfile,"\n"); + + /* Loop over all of the channels */ + for(lcv = 0; lcv < MAX_CHANNELS; lcv++) + { + pChan = &messages.channel[lcv]; + pPseudo = &messages.pseudoranges[lcv]; + if(pPseudo->sv != NON_EXISTENT_SV) + { + fprintf(robsfile," %14.3f %14.3f %14.3f %14.3f\n", + pPseudo->uncorrected, pPseudo->meters_rate, 0.0, icn0_2_fcn0(pChan->cn0)); + } + } + } +} +/*----------------------------------------------------------------------------------------------*/ + + +/*----------------------------------------------------------------------------------------------*/ +void GUI_Serial::printRinexEphemHeader() +{ + if(rephemfile != NULL) + { + fprintf(rephemfile," 2 N RINEX VERSION / TYPE\n"); + fprintf(rephemfile,"MATLAB G HECKLER 23-APR-02 PGM / RUN BY / DATE \n"); + fprintf(rephemfile,"PSEUDO-NAVIGATION DATA GENERATED FROM ALMANAC COMMENT \n"); + fprintf(rephemfile," 0.0000D+00 0.0000D+00 -0.0000D+00 0.0000D+00 ION ALPHA \n"); + fprintf(rephemfile," -0.0000D+00 -0.0000D+00 0.0000D+00 -0.0000D+00 ION BETA \n"); + fprintf(rephemfile," 0.000000000000D+00 0.000000000000D+00 0 0 DELTA-UTC: A0,A1,T,W\n"); + fprintf(rephemfile," 12 LEAP SECONDS \n"); + fprintf(rephemfile," END OF HEADER \n"); + } +} +/*----------------------------------------------------------------------------------------------*/ + + + + +/*----------------------------------------------------------------------------------------------*/ +void GUI_Serial::printRinexEphem() +{ + if(rephemfile != NULL) + { +// /*Generate the date using the TOC week and second*/ +// utilities::timeStruct time; +// utilities::gps2utc(tocwk+1024,toc,&time); +// +// /*Write out date and time information*/ +// sprintf(output,"%2d%3d%3d%3d%3d%3d%5.1f %- 19.12E%- 19.12E%- 19.12E\n", +// PRN,time.year,time.month,time.day,time.hour,time.minute,time.second,af0,af1,af2); +// +// /*Broadcast Ephemeris Line 1*/ +// fprintf(rephemfile," %- 20.12E%- 20.12E%- 20.12E%- 20.12E\n",iode,crs,deltan,m0); +// fprintf(rephemfile," %- 20.12E%- 20.12E%- 20.12E%- 20.12E\n",cuc,ecc,cus,sqrta); +// fprintf(rephemfile," %- 20.12E%- 20.12E%- 20.12E%- 20.12E\n",toe,cic,om0,cis); +// fprintf(rephemfile," %- 20.12E%- 20.12E%- 20.12E%- 20.12E\n",in0,crc,argp,omd); +// fprintf(rephemfile," %- 20.12E%- 20.12E%- 20.12E%- 20.12E\n",idot,(double)codeOnL2,(double)toewk,(double)L2PData); +// fprintf(rephemfile," %- 20.12E%- 20.12E%- 20.12E%- 20.12E\n",zeros,(double)health,tgd,iodc); +// fprintf(rephemfile," %- 20.12E%- 20.12E%- 20.12E%- 20.12E\n",tofXmission,zeros,zeros,zeros); + } +} diff --git a/gse/src/gui_toplevel.cpp b/gse/src/gui_toplevel.cpp index 6a0e0e6..a483d78 100644 --- a/gse/src/gui_toplevel.cpp +++ b/gse/src/gui_toplevel.cpp @@ -166,6 +166,9 @@ void GUI_Toplevel::onLogConfig(wxCommandEvent& WXUNUSED(event)) log.cTask->SetValue(pSerial->getLog(TASK_HEALTH_M_ID)); log.cBoard->SetValue(pSerial->getLog(BOARD_HEALTH_M_ID)); log.cSVPred->SetValue(pSerial->getLog(SV_PREDICTION_M_ID)); + log.cGearth->SetValue(pSerial->getLog(LAST_M_ID)); + log.cRobs->SetValue(pSerial->getLog(LAST_M_ID + 1)); + log.cRephem->SetValue(pSerial->getLog(LAST_M_ID + 2)); if(log.ShowModal() == wxID_OK) { @@ -183,6 +186,9 @@ void GUI_Toplevel::onLogConfig(wxCommandEvent& WXUNUSED(event)) pSerial->logOn(TASK_HEALTH_M_ID, log.cTask->IsChecked()); pSerial->logOn(BOARD_HEALTH_M_ID, log.cBoard->IsChecked()); pSerial->logOn(SV_PREDICTION_M_ID, log.cSVPred->IsChecked()); + pSerial->logOn(LAST_M_ID, log.cGearth->IsChecked()); + pSerial->logOn(LAST_M_ID + 1, log.cRobs->IsChecked()); + pSerial->logOn(LAST_M_ID + 2, log.cRephem->IsChecked()); /* Get Filename */ log_filename = log.mFile->GetPath(); diff --git a/includes/config.h b/includes/config.h index 4a7e271..086134c 100644 --- a/includes/config.h +++ b/includes/config.h @@ -33,7 +33,7 @@ /* Software Version */ /*----------------------------------------------------------------------------------------------*/ #define SOFTWARE_VERSION_MAJOR (2) -#define SOFTWARE_VERSION_MINOR (5) +#define SOFTWARE_VERSION_MINOR (6) #define SOFTWARE_VERSION_POSTFIX (0) /*----------------------------------------------------------------------------------------------*/ @@ -42,7 +42,7 @@ #define MAX_CHANNELS (12) //!< Number of channel objects #define CPU_CORES (2) //!< 1 for a single core, 2 for a dual core system, etc #define CORR_PER_CPU (MAX_CHANNELS/CPU_CORES) //!< Distribute them up evenly (this should be an INTEGER!) -#define MAX_ANTENNAS (1) //!< The number of antennas +#define MAX_ANTENNAS (2) //!< The number of antennas #define TASK_STACK_SIZE (2048) //!< For Nucleus/Linux compatibility /*----------------------------------------------------------------------------------------------*/ @@ -57,12 +57,6 @@ /*----------------------------------------------------------------------------------------------*/ -/* Work on what kind of Data?? */ -/*----------------------------------------------------------------------------------------------*/ -#define USRP_RECORDER (1) //!< Data collected with USRP - /*----------------------------------------------------------------------------------------------*/ - - /* MISC GPS Constants */ /*----------------------------------------------------------------------------------------------*/ #define MAX_SV (32) //!< Number of PRN codes @@ -75,7 +69,6 @@ /*! Config the SV Select */ /*----------------------------------------------------------------------------------------------*/ #define MASK_ANGLE (0) //!< Add this many degrees to altitude dependant mask -#define MAX_ANTENNA (1) //!< 6 ADCs on board #define ACQ_MODULO_WEAK (8) //!< Do this many weak acqs per 32 PRN strong search #define MAX_DOPPLER_ABSOLUTE (15000) //!< Limit any and all Dopplers the be within this range #define MAX_DOPPLER_STRONG (15000) //!< Cold Doppler search space for strong signal @@ -119,7 +112,7 @@ #define CARRIER_AIDING (1) //!< Carrier aid the DLL #define PLL_BN (15) //!< PLL Bandwidth #define FLL_BN (10) //!< FLL Bandwidth -#define AGC_BITS (5) //!< AGC to this bit depth +#define AGC_BITS (6) //!< AGC to this bit depth #define OVERFLOW_LOW (4) //!< Overflow low #define OVERFLOW_HIGH (64) //!< Overflow high /*----------------------------------------------------------------------------------------------*/ @@ -144,9 +137,11 @@ enum TASK_IDS }; /*----------------------------------------------------------------------------------------------*/ + /* Account for GPS rollover here */ /*----------------------------------------------------------------------------------------------*/ #define CURRENT_GPS_WEEK_ROLLOVER (1) //!< The number of GPS week rollovers /*----------------------------------------------------------------------------------------------*/ + #endif diff --git a/includes/sdr_structs.h b/includes/sdr_structs.h index 13c03e4..acc86cf 100644 --- a/includes/sdr_structs.h +++ b/includes/sdr_structs.h @@ -73,6 +73,7 @@ typedef struct _Options_S int32 decimate; int32 realtime; int32 tlm_type; //!< Telemetry type (named pipe/serial) + int32 source; //!< GPS data source type double f_lo_a; //!< LO freq for board A double f_ddc_a; //!< DDC freq for board A double f_lo_b; //!< LO freq for board B diff --git a/includes/signaldef.h b/includes/signaldef.h index 7029511..ef4ea03 100644 --- a/includes/signaldef.h +++ b/includes/signaldef.h @@ -30,40 +30,18 @@ /* Data from the Universal Software Radio Peripheral */ /*----------------------------------------------------------------------------------------------*/ -#if USRP_RECORDER - - #define IF_SAMPLE_FREQUENCY (2048000) //!< How many CPX samples in a second - #define IF_FREQUENCY (160000) //!< IF frequency - #define ZERO_DOPPLER_RATE (IF_FREQUENCY) //!< IF frequency - #define NCO_CARR_INCR_NOM (0x14000000) //!< 160000 Hz - #define NCO_CODE_INCR_NOM (0x3FF00000) //!< = 1.023e6 Mcps, 1 chips/s = 1049 in terms of the code NCO - #define F_SAMPLE_NOM (64e6) - #define SAMPS_PER_READ (4096) - #define BYTES_PER_READ (SAMPS_PER_READ*4) - #define HZ_2_NCO_CARR_INCR (2.097152000000000e+03) - #define NCO_CARR_INCR_2_HZ (4.768371582031250e-04) - #define HZ_2_NCO_CODE_INCR (1.048576000000000e+03) - #define NCO_CODE_INCR_2_HZ (9.536743164062500e-04) - -#endif -/*----------------------------------------------------------------------------------------------*/ - -/* Data from the GN3S Recorder -/*----------------------------------------------------------------------------------------------*/ -#if GN3S_RECORDER - - #define IF_SAMPLE_FREQUENCY (2048000) //!< How many CPX samples in a second - #define IF_FREQUENCY (0) //!< IF frequency - #define ZERO_DOPPLER_RATE (IF_FREQUENCY) //!< IF frequency - #define NCO_CARR_INCR_NOM (0x0) //!< 0 Hz - #define NCO_CODE_INCR_NOM (0x3FF00000) //!< = 1.023e6 Mcps, 1 chips/s = 1049 in terms of the code NCO - #define IF_SAMPS_MS (2048) //!< Samples per millisecond - #define HZ_2_NCO_CARR_INCR (2.097152000000000e+03) - #define NCO_CARR_INCR_2_HZ (4.768371582031250e-04) - #define HZ_2_NCO_CODE_INCR (1.048576000000000e+03) - #define NCO_CODE_INCR_2_HZ (9.536743164062500e-04) - -#endif +#define IF_SAMPLE_FREQUENCY (2048000) //!< How many CPX samples in a second +#define IF_FREQUENCY (38400) //!< IF frequency +#define ZERO_DOPPLER_RATE (IF_FREQUENCY) //!< IF frequency +#define NCO_CARR_INCR_NOM (0x04CCCCCC) //!< 38400 Hz +#define NCO_CODE_INCR_NOM (0x3FF00000) //!< = 1.023e6 Mcps, 1 chips/s = 1049 in terms of the code NCO +#define F_SAMPLE_NOM (64e6) //!< Nominal USRP sample rate +#define SAMPS_PER_READ (4096) //!< Nominal samples per read +#define BYTES_PER_READ (4*SAMPS_PER_READ) //!< Read this many bytes +#define HZ_2_NCO_CARR_INCR (2.097152000000000e+03) //!< Convert from Hz to carrier NCO units +#define NCO_CARR_INCR_2_HZ (4.768371582031250e-04) //!< Convert from carrier NCO to Hz +#define HZ_2_NCO_CODE_INCR (1.048576000000000e+03) //!< Convert from Hz to code NCO units +#define NCO_CODE_INCR_2_HZ (9.536743164062500e-04) //!< Convert from code NCO to Hz /*----------------------------------------------------------------------------------------------*/ #endif diff --git a/main/init.cpp b/main/init.cpp index 25bdebc..6b45419 100644 --- a/main/init.cpp +++ b/main/init.cpp @@ -38,7 +38,7 @@ #include "telemetry.h" //!< Serial/GUI telemetry #include "commando.h" //!< Command interface #include "sv_select.h" //!< Drives acquisition/reacquisition process -#include "gps_source.h" +#include "gps_source.h" //!< Get GPS IF data from where? /*----------------------------------------------------------------------------------------------*/ @@ -47,16 +47,18 @@ void usage(char *_str) { fprintf(stdout,"\n"); - fprintf(stdout,"usage: [-c] [-v] [-gr] [-gi] [-d] [-l] [-w] [-x] [-s]\n"); + //fprintf(stdout,"usage: [-c] [-v] [-gr] [-gi] [-d] [-l] [-w] [-x] [-s]\n"); + fprintf(stdout,"usage: [-c] [-v] [-gr] [-gi] [-w] [-x] [-s]\n"); fprintf(stdout,"[-c] log high rate channel data\n"); fprintf(stdout,"[-v] be verbose \n"); fprintf(stdout,"[-gr] set rf gain in dB (DBSRX only)\n"); fprintf(stdout,"[-gi] set if gain in dB (DBSRX only)\n"); - fprintf(stdout,"[-d] operate in two antenna mode, A & B as L1\n"); - fprintf(stdout,"[-l] operate in L1-L2 mode, A as L1, B as L2\n"); +// fprintf(stdout,"[-d] operate in two antenna mode, A & B as L1\n"); +// fprintf(stdout,"[-l] operate in L1-L2 mode, A as L1, B as L2\n"); fprintf(stdout,"[-w] bandwidth of lowpass filter\n"); fprintf(stdout,"[-x] the USRP samples at a modified 65.536 MHz (default is 64 MHz)\n"); fprintf(stdout,"[-s] output over /dev/ttyS0 instead of the named pipe\n"); + fprintf(stdout,"[-gn3s] use the SIGE GN3S sampling device\n"); fflush(stdout); exit(1); } @@ -75,13 +77,16 @@ void echo_options() fprintf(stdout,"Verbose: %13d\n",gopt.verbose); fprintf(stdout,"Log channel: %13d\n",gopt.log_channel); fprintf(stdout,"Telemetry: %13d\n",gopt.tlm_type); - fprintf(stdout,"USRP Decimation: %13d\n",gopt.decimate); - fprintf(stdout,"USRP Sample Rate: %13.2f\n",gopt.f_sample); - fprintf(stdout,"DBSRX LO A: %13.2f\n",gopt.f_lo_a); - fprintf(stdout,"DBSRX LO B: %13.2f\n",gopt.f_lo_b); - fprintf(stdout,"RF Gain: %13.2f\n",gopt.gr); - fprintf(stdout,"IF Gain: %13.2f\n",gopt.gi); - fprintf(stdout,"DBSRX Bandwidth: %13.2f\n",gopt.bandwidth); + if(gopt.source != SOURCE_SIGE_GN3S) + { + fprintf(stdout,"USRP Decimation: %13d\n",gopt.decimate); + fprintf(stdout,"USRP Sample Rate: %13.2f\n",gopt.f_sample); + fprintf(stdout,"DBSRX LO A: %13.2f\n",gopt.f_lo_a); + fprintf(stdout,"DBSRX LO B: %13.2f\n",gopt.f_lo_b); + fprintf(stdout,"RF Gain: %13.2f\n",gopt.gr); + fprintf(stdout,"IF Gain: %13.2f\n",gopt.gi); + fprintf(stdout,"DBSRX Bandwidth: %13.2f\n",gopt.bandwidth); + } fprintf(stdout,"\n"); fflush(stdout); } @@ -113,10 +118,11 @@ void Parse_Arguments(int32 argc, char* argv[]) gopt.bandwidth = 6.0e6; //!< DBS-RX is set to 10 MHz wide gopt.f_sample = 64.0e6; //!< Nominal sample rate gopt.realtime = 1; + gopt.source = SOURCE_USRP_V1; for(lcv = 1; lcv < argc; lcv++) { - switch (argv[lcv][1]) + switch(argv[lcv][1]) { case 'c': @@ -148,16 +154,20 @@ void Parse_Arguments(int32 argc, char* argv[]) usage (argv[0]); break; } + else if(strcmp(argv[lcv], "-gn3s") == 0) + { + gopt.source = SOURCE_SIGE_GN3S; + } else usage(argv[0]); break; - case 'd': - gopt.mode = 1; - break; - case 'l': - gopt.mode = 2; - gopt.f_lo_b = L2; /* L2C center frequency */ - break; +// case 'd': +// gopt.mode = 1; +// break; +// case 'l': +// gopt.mode = 2; +// gopt.f_lo_b = L2; /* L2C center frequency */ +// break; case 'w': if(++lcv >= argc) usage (argv[0]); @@ -280,12 +290,12 @@ int32 Object_Init(void) for(lcv = 0; lcv < MAX_CHANNELS; lcv++) pChannels[lcv] = new Channel(lcv); - /* Draw the GPS data from somewhere */ - pSource = new GPS_Source(&gopt); - /* Get data from either the USRP or disk */ pFIFO = new FIFO; + /* Draw the GPS data from somewhere */ + pSource = new GPS_Source(&gopt); + pCorrelator = new Correlator(); if(gopt.verbose) diff --git a/matlab/plot_channel.m b/matlab/plot_channel.m index 8970c28..c5dfcb6 100644 --- a/matlab/plot_channel.m +++ b/matlab/plot_channel.m @@ -1,25 +1,17 @@ -clear; clc; close all; +clear; clc; close all; pause(1) [data] = get_channel('channel.log'); figure +pause(1) hold all; grid on; for(lcv = 1:32) plot(data(lcv).tic,data(lcv).cn0,'.','MarkerSize',1); end figure +pause(1) hold all; grid on; for(lcv = 1:32) plot(data(lcv).tic,data(lcv).sv,'o'); end - -figure -hold all; grid on; -for(lcv = 1:32) - plot(data(lcv).code_nco-1.023e6,'.','MarkerSize',1); -end - -for(lcv = 1:32) - plot((data(lcv).carrier_nco-160000)*(1.023e6/1.57542e9),'k'); -end \ No newline at end of file diff --git a/matlab/plot_ge.m b/matlab/plot_ge.m new file mode 100644 index 0000000..dfbf7b1 --- /dev/null +++ b/matlab/plot_ge.m @@ -0,0 +1,73 @@ +clear; clc; close all; +pause(1) + +% Grab the pvt only +[data] = get_pvt('pvt.log'); + +ind = find(data.p(:,1) ~= 0); +data.p = data.p(ind,:); + +%Convert to lat, long, alt +[phi, lambda, h] = ecef2geodetic (data.p(:,1),data.p(:,2),data.p(:,3),[6378137.0 0.081819190842622]); + +%Make degrees +phi = 180*phi/pi; +lambda = 180*lambda/pi; + +gfile = fopen('pvt.kml','wt'); + +fprintf(gfile,'\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'navigation.kml\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'GPS SDR\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'1\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'0\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'relativeToGround\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'0\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'0\n'); +fprintf(gfile,'0\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'absolute\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'%15.9f,%15.9f,%15.9f\n',[lambda,phi,h].'); +fprintf(gfile,'\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'\n'); +fprintf(gfile,'\n'); + +fclose(gfile); \ No newline at end of file diff --git a/matlab/plot_pvt.m b/matlab/plot_pvt.m index 976f17d..aefe9d5 100644 --- a/matlab/plot_pvt.m +++ b/matlab/plot_pvt.m @@ -19,4 +19,4 @@ subplot(313) plot(data.v) hold on; grid on; -axis([1 length(data.p) -1e4 1e4]) \ No newline at end of file +axis([1 length(data.p) -1e4 1e4]) diff --git a/objects/channel.cpp b/objects/channel.cpp index feef562..08fb0d2 100644 --- a/objects/channel.cpp +++ b/objects/channel.cpp @@ -437,19 +437,35 @@ void Channel::PLL() float dp; float dot; float cross; + int32 I1, I2, Q1, Q2, lcv; df = dp = 0; - /* FLL discriminator */ - dot = I[1]*I_prev + Q[1]*Q_prev; - cross = -I[1]*Q_prev + Q[1]*I_prev; + if(len != 1) + { + for(lcv = 0; lcv < 10; lcv++) + { + I2 += I_buff[lcv]; + Q2 += Q_buff[lcv]; + } + + for(lcv; lcv < 20; lcv++) + { + I1 += I_buff[lcv]; + Q1 += Q_buff[lcv]; + } + + /* FLL discriminator */ + dot = I2*I1 + Q2*Q1; + cross = -I2*Q1 + Q2*I1; - /* No FLL for now */ -// if((dot != 0.0) && (cross != 0.0)) -// { -// df = atan(dot/cross); -// df /= (aPLL.t * 360); -// } + /* No FLL for now */ + if((dot != 0.0) && (cross != 0.0)) + { + df = atan2(cross, dot); + df /= TWO_PI; + } + } /* PLL discriminator */ if(I[1] != 0) @@ -881,7 +897,7 @@ void Channel::PLL_W(float _bwpll) { aPLL.PLLBW = _bwpll; - aPLL.FLLBW = 50.0; + aPLL.FLLBW = 4.0; aPLL.b3 = 2.40; aPLL.a3 = 1.10; @@ -937,23 +953,23 @@ void Channel::Error() /* Adjust integration length based on cn0 */ if(bit_lock) { - if((mcn0 > 39.0) && (len != 1)) - { - len = 1; - PLL_W(30.0); - } +// if((mcn0 > 39.0) && (len != 1)) +// { +// len = 1; +// PLL_W(18.0); +// } - if((mcn0 < 37.0) && (len != 10)) - { - len = 10; - PLL_W(25.0); - } - - if((mcn0 < 30.0) && (len != 20)) +// if((mcn0 < 37.0) && (len != 20)) { len = 20; - PLL_W(20.0); + PLL_W(18.0); } + +// if((mcn0 < 30.0) && (len != 20)) +// { +// len = 20; +// PLL_W(20.0); +// } } } diff --git a/objects/fifo.cpp b/objects/fifo.cpp index 1bfd44d..e0590f7 100644 --- a/objects/fifo.cpp +++ b/objects/fifo.cpp @@ -57,14 +57,6 @@ void FIFO::Start() /*----------------------------------------------------------------------------------------------*/ -/*----------------------------------------------------------------------------------------------*/ -void FIFO::SetScale(int32 _agc_scale) -{ - agc_scale = _agc_scale; -} -/*----------------------------------------------------------------------------------------------*/ - - /*----------------------------------------------------------------------------------------------*/ FIFO::FIFO():Threaded_Object("FIFTASK") { @@ -82,9 +74,7 @@ FIFO::FIFO():Threaded_Object("FIFTASK") buff[FIFO_DEPTH-1].next = &buff[0]; - tic = overflw = soverflw = count = 0; - - agc_scale = 1; + tic = count = 0; sem_init(&sem_full, NULL, 0); sem_init(&sem_empty, NULL, FIFO_DEPTH); @@ -122,28 +112,6 @@ void FIFO::Import() /* Read from the GPS source */ pSource->Read(head); - /* Add to the buff */ - soverflw += run_agc(&head->data[0], SAMPS_MS, AGC_BITS, agc_scale); - - /* Figure out the agc_scale value */ - if((count & 0xF) == 0) - { - if(soverflw > OVERFLOW_HIGH*8) - agc_scale += 100; - - if(soverflw > OVERFLOW_HIGH) - agc_scale += 1; - - if(soverflw < OVERFLOW_LOW) - agc_scale -= 1; - - if(agc_scale < 1) - agc_scale = 1; - - overflw = soverflw; - soverflw = 0; - } - Enqueue(); IncStopTic(); diff --git a/objects/fifo.h b/objects/fifo.h index ef92dd9..7dea9b7 100644 --- a/objects/fifo.h +++ b/objects/fifo.h @@ -29,7 +29,6 @@ #define FIFO_H_ #include "includes.h" -#include "telemetry.h" #include "gps_source.h" #define FIFO_DEPTH (2500) //!< In ms @@ -40,8 +39,6 @@ class FIFO : public Threaded_Object { - friend class Telemetry; - private: sem_t sem_full; @@ -52,9 +49,6 @@ class FIFO : public Threaded_Object ms_packet *tail; //!< Pointer to the tail int32 count; //!< Count the number of packets received - int32 agc_scale; //!< To do the AGC - int32 overflw; //!< Overflow counter - int32 soverflw; //!< Overflow counter int32 tic; //!< Master receiver tic public: @@ -68,7 +62,6 @@ class FIFO : public Threaded_Object void Open(); void Enqueue(); void Dequeue(ms_packet *p); - void SetScale(int32 _agc_scale); }; diff --git a/objects/gps_source.cpp b/objects/gps_source.cpp index 4482f4c..2149e9e 100644 --- a/objects/gps_source.cpp +++ b/objects/gps_source.cpp @@ -25,26 +25,131 @@ */ /*----------------------------------------------------------------------------------------------*/ + #include "gps_source.h" + +/*----------------------------------------------------------------------------------------------*/ GPS_Source::GPS_Source(Options_S *_opt) { memcpy(&opt, _opt, sizeof(Options_S)); - Open_USRP_V1(); - if(gopt.verbose) + switch(opt.source) + { + case SOURCE_USRP_V1: + source_type = SOURCE_USRP_V1; + Open_USRP_V1(); + break; + case SOURCE_USRP_V2: +// source_type = SOURCE_USRP_V2; +// Open_USRP_V2(); + break; + case SOURCE_SIGE_GN3S : + source_type = SOURCE_SIGE_GN3S; + Open_GN3S(); + break; + default: + source_type = SOURCE_USRP_V1; + Open_USRP_V1(); + break; + } + + overflw = soverflw = 0; + agc_scale = 1; + + /* Assign to base */ + buff_out_p = &buff_out[0]; + ms_count = 0; + + if(opt.verbose) fprintf(stdout,"Creating GPS Source\n"); + } +/*----------------------------------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------------------------------*/ GPS_Source::~GPS_Source() { - Close_USRP_V1(); - if(gopt.verbose) + switch(source_type) + { + case SOURCE_USRP_V1: + Close_USRP_V1(); + break; + case SOURCE_USRP_V2: +// Close_SOURCE_USRP_V2(); + break; + case SOURCE_SIGE_GN3S : + Close_GN3S(); + break; + default: + Close_USRP_V1(); + break; + } + + if(opt.verbose) fprintf(stdout,"Destructing GPS Source\n"); } +/*----------------------------------------------------------------------------------------------*/ + + +/*----------------------------------------------------------------------------------------------*/ +void GPS_Source::Read(ms_packet *_p) +{ + double gain; + + switch(source_type) + { + case SOURCE_USRP_V1: + Read_USRP_V1(_p); + break; + case SOURCE_USRP_V2: +// Read_SOURCE_USRP_V2(_p); + break; + case SOURCE_SIGE_GN3S: + Read_GN3S(_p); + break; + default: + Read_USRP_V1(_p); + break; + } + + /* Dont need to AGC the SOURCE_SIGE_GN3S */ + if(source_type != SOURCE_SIGE_GN3S) + { + /* Add to the buff */ + soverflw += run_agc(&_p->data[0], SAMPS_MS, AGC_BITS, 1); + + /* Figure out the agc_scale value */ + if((ms_count & 0xF) == 0) + { + gain = dbs_rx_a->rf_gain(); + + if(soverflw > OVERFLOW_HIGH) + gain -= 0.5; + + if(soverflw < OVERFLOW_LOW) + gain += 0.5; + + dbs_rx_a->rf_gain(gain); + + overflw = soverflw; + soverflw = 0; + + agc_scale = (int32)floor(2.0*(dbs_rx_a->max_rf_gain() - gain)); + } + } + + ms_count++; + +} +/*----------------------------------------------------------------------------------------------*/ + + +/*----------------------------------------------------------------------------------------------*/ void GPS_Source::Open_USRP_V1() { @@ -202,8 +307,33 @@ void GPS_Source::Open_USRP_V1() urx->start(); } +/*----------------------------------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------------------------------*/ +void GPS_Source::Open_GN3S() +{ + + int32 lcv; + const double mul = 8.1838e6/2.048e6; + /* Create the object */ + gn3s_a = new gn3s(0); + + /* Create decimation lookup table */ + for(lcv = 0; lcv < 10240; lcv++) + { + gdec[lcv] = (int32)floor((double)lcv * mul); + } + + /* Everything is super! */ + fprintf(stdout,"GN3S Start\n"); + +} +/*----------------------------------------------------------------------------------------------*/ + + +/*----------------------------------------------------------------------------------------------*/ void GPS_Source::Close_USRP_V1() { @@ -222,8 +352,25 @@ void GPS_Source::Close_USRP_V1() fprintf(stdout,"Destructing USRP\n"); } +/*----------------------------------------------------------------------------------------------*/ -void GPS_Source::Read(ms_packet *_p) + +/*----------------------------------------------------------------------------------------------*/ +void GPS_Source::Close_GN3S() +{ + + if(gn3s_a != NULL) + delete gn3s_a; + + if(opt.verbose) + fprintf(stdout,"Destructing GN3S\n"); + +} +/*----------------------------------------------------------------------------------------------*/ + + +/*----------------------------------------------------------------------------------------------*/ +void GPS_Source::Read_USRP_V1(ms_packet *_p) { bool overrun; @@ -238,8 +385,8 @@ void GPS_Source::Read(ms_packet *_p) Resample_USRP_V1(buff, buff_out); memcpy(_p->data, buff_out, SAMPS_MS*sizeof(CPX)); leftover -= 4000; - memcpy(db_a, &buff[4000], leftover*sizeof(int32)); - memcpy(buff, db_a, leftover*sizeof(int32)); + memcpy(dbuff, &buff[4000], leftover*sizeof(int32)); + memcpy(buff, dbuff, leftover*sizeof(int32)); return; } break; @@ -251,8 +398,8 @@ void GPS_Source::Read(ms_packet *_p) Resample_USRP_V1(buff, buff_out); memcpy(_p->data, buff_out, SAMPS_MS*sizeof(CPX)); leftover -= 8000; - memcpy(db_a, &buff[8000], leftover*sizeof(int32)); - memcpy(buff, db_a, leftover*sizeof(int32)); + memcpy(dbuff, &buff[8000], leftover*sizeof(int32)); + memcpy(buff, dbuff, leftover*sizeof(int32)); return; } break; @@ -272,7 +419,6 @@ void GPS_Source::Read(ms_packet *_p) // fflush(stdout); // } - /* Now we have SAMPS_PER_READ samps, 4 possible things to do depending on the state: * 0) mode == 0 && f_sample == 65.536e6: This mode is the easiest, 1 ms of data per FIFO node, * hence just call resample() and stuff in the pipe @@ -304,8 +450,8 @@ void GPS_Source::Read(ms_packet *_p) memcpy(_p->data, buff_out, SAMPS_MS*sizeof(CPX)); /* Move excess bytes at end of buffer down to the base */ - memcpy(db_a, &buff[4000], leftover*sizeof(int32)); - memcpy(buff, db_a, leftover*sizeof(int32)); + memcpy(dbuff, &buff[4000], leftover*sizeof(int32)); + memcpy(buff, dbuff, leftover*sizeof(int32)); break; case 3: @@ -315,8 +461,8 @@ void GPS_Source::Read(ms_packet *_p) memcpy(_p->data, buff_out, SAMPS_MS*sizeof(CPX)); /* Move excess bytes at end of buffer down to the base */ - memcpy(db_a, &buff[8000], leftover*sizeof(int32)); - memcpy(buff, db_a, leftover*sizeof(int32)); + memcpy(dbuff, &buff[8000], leftover*sizeof(int32)); + memcpy(buff, dbuff, leftover*sizeof(int32)); break; default: @@ -327,6 +473,65 @@ void GPS_Source::Read(ms_packet *_p) /*----------------------------------------------------------------------------------------------*/ +/*----------------------------------------------------------------------------------------------*/ +void GPS_Source::Read_GN3S(ms_packet *_p) +{ + + int bread; + bool overrun; + int32 ms_mod5; + int32 lcv; + int16 LUT[4] = {1, -1, 1, -1}; + int16 *pbuff; + + ms_mod5 = ms_count % 5; + + if(ms_count == 0) + { + /* Start transfer */ + gn3s_a->usrp_xfer(VRQ_XFER, 1); + } + + /* Do the GN3S reading */ + if(ms_mod5 == 0) + { + pbuff = (int16 *)&buff[7]; + + /* Read 5 ms */ + bread = gn3s_a->read((void *)&gbuff[0], 40919*2); + + /* Convert to +-1 */ + for(lcv = 0; lcv < 40919*2; lcv++) + pbuff[lcv] = LUT[gbuff[lcv] & 0x3]; + + /* Filter & decimate the data to regain bit precision */ + Resample_GN3S(&buff[0], &buff_out[0]); + + /* Move last 7 elements to the bottom */ + memcpy(&buff[0], &buff[40919], 7*sizeof(CPX)); + + /* Check the overrun */ + overrun = gn3s_a->check_rx_overrun(); + if(overrun && opt.verbose) + { + time(&rawtime); + timeinfo = localtime (&rawtime); + fprintf(stdout, "GN3S overflow at time %s\n", asctime(timeinfo)); + fflush(stdout); + } + + } + + /* Move pointer */ + buff_out_p = &buff_out[SAMPS_MS*ms_mod5]; + + /* Copy to destination */ + memcpy(_p->data, buff_out_p, SAMPS_MS*sizeof(CPX)); + +} +/*----------------------------------------------------------------------------------------------*/ + + /*----------------------------------------------------------------------------------------------*/ void GPS_Source::Resample_USRP_V1(CPX *_in, CPX *_out) { @@ -375,3 +580,55 @@ void GPS_Source::Resample_USRP_V1(CPX *_in, CPX *_out) } } +/*----------------------------------------------------------------------------------------------*/ + + +/*----------------------------------------------------------------------------------------------*/ +void GPS_Source::Resample_GN3S(CPX *_in, CPX *_out) +{ + /* Runs specified filter on incoming signal. */ + //static short filter[7] = {3,4,5,6,5,4,3}; Mike's Filter + //static short filter[7] = {-3,10,27,34,27,10,-3}; Greg's Filter + int32 lcv, ind; + + /* Process the array */ + for(lcv = 0; lcv < 10240; lcv++) + { + ind = gdec[lcv]; + +// _out[lcv].i = _in[ind + 6].i * -3 + +// _in[ind + 5].i * 10 + +// _in[ind + 4].i * 27 + +// _in[ind + 3].i * 34 + +// _in[ind + 2].i * 27 + +// _in[ind + 1].i * 10 + +// _in[ind + 0].i * -3; +// +// _out[lcv].q = _in[ind + 6].q * -3 + +// _in[ind + 5].q * 10 + +// _in[ind + 4].q * 27 + +// _in[ind + 3].q * 34 + +// _in[ind + 2].q * 27 + +// _in[ind + 1].q * 10 + +// _in[ind + 0].q * -3; + + _out[lcv].i = _in[ind + 6].i * 4 + + _in[ind + 5].i * 5 + + _in[ind + 4].i * 6 + + _in[ind + 3].i * 7 + + _in[ind + 2].i * 6 + + _in[ind + 1].i * 5 + + _in[ind + 0].i * 4; + + _out[lcv].q = _in[ind + 6].q * 4 + + _in[ind + 5].q * 5 + + _in[ind + 4].q * 6 + + _in[ind + 3].q * 7 + + _in[ind + 2].q * 6 + + _in[ind + 1].q * 5 + + _in[ind + 0].q * 4; + } + + return; +} +/*----------------------------------------------------------------------------------------------*/ diff --git a/objects/gps_source.h b/objects/gps_source.h index f5045e4..0a592af 100644 --- a/objects/gps_source.h +++ b/objects/gps_source.h @@ -30,30 +30,53 @@ #include "includes.h" #include "db_dbs_rx.h" +#include "gn3s.h" enum GPS_SOURCE_TYPE { - USRP_V1, - USRP_V2, - SIGE_GN3S + SOURCE_USRP_V1, + SOURCE_USRP_V2, + SOURCE_SIGE_GN3S, + SOURCE_DISK_FILE, }; +/*! \ingroup CLASSES + * + */ class GPS_Source { private: - /* Generic variables */ - int32 source_open; - int32 source_type; - int32 sample_mode; - int32 leftover; - int32 bwrite; - CPX buff[16384]; //!< Base buffer - CPX buff_out[4096]; //!< Output buffer - CPX db_a[16384]; //!< Buffer for double buffering + /* Options */ Options_S opt; //!< Options + /* Generic variables */ +// int32 source_open; //!< Is the source open? + int32 source_type; //!< Source type + int32 sample_mode; //!< Sample mode + int32 leftover; //!< Leftover bytes for USRP double buffering + int32 bwrite; //!< Bytes somthing something? + int32 ms_count; //!< Count the numbers of ms processed + + /* Tag overflows */ + time_t rawtime; + struct tm * timeinfo; + + /* AGC Values */ + int32 agc_scale; //!< To do the AGC + int32 overflw; //!< Overflow counter + int32 soverflw; //!< Overflow counter + + /* Data buffers */ + int8 gbuff[40919*2]; //!< Byte buffer for GN3S + CPX buff[40926]; //!< Base buffer for GN3S/USRP + CPX buff_out[10240]; //!< Output buffer @ 2.048 Msps + CPX *buff_out_p; //!< Pointer to a spot in buff_out + CPX dbuff[16384]; //!< Buffer for double buffering + MIX gn3s_mix[10240]; //!< Mix GN3S to the same IF frequency + int32 gdec[10240]; //!< Index array to filter & resample GN3S data to 2.048 Msps + /* USRP V1 Handles */ usrp_standard_rx *urx; db_dbs_rx *dbs_rx_a; @@ -61,17 +84,16 @@ class GPS_Source /* USRP V2 Handles */ - /* SIGE_GN3S Handles */ + /* SOURCE_SIGE_GN3S Handles */ + gn3s *gn3s_a; + gn3s *gn3s_b; /* File handles */ - + FILE *fp_a; + FILE *fp_b; private: - void Read_USRP_V1(); //!< Read from the USRP Version 1 - void Read_USRP_V2(); //!< Read from the USRP Version 2 - void Read_GN3S(); //!< Read from the SparkFun GN3S Sampler - void Read_File(); //!< Read from a file void Open_USRP_V1(); //!< Open the USRP Version 1 void Open_USRP_V2(); //!< Open the USRP Version 2 void Open_GN3S(); //!< Open the SparkFun GN3S Sampler @@ -80,12 +102,20 @@ class GPS_Source void Close_USRP_V2(); //!< Close the USRP Version 2 void Close_GN3S(); //!< Close the SparkFun GN3S Sampler void Close_File(); //!< Close the file + void Read_USRP_V1(ms_packet *_p);//!< Read from the USRP Version 1 + void Read_USRP_V2(ms_packet *_p);//!< Read from the USRP Version 2 + void Read_GN3S(ms_packet *_p); //!< Read from the SparkFun GN3S Sampler + void Read_File(ms_packet *_p); //!< Read from a file void Resample_USRP_V1(CPX *_in, CPX *_out); + void Resample_GN3S(CPX *_in, CPX *_out); public: - GPS_Source(Options_S *_opt); //!< Create the GPS source with the proper hardware type - ~GPS_Source(); //!< Kill the object - void Read(ms_packet *_p); //!< Read in a single ms of data + + GPS_Source(Options_S *_opt); //!< Create the GPS source with the proper hardware type + ~GPS_Source(); //!< Kill the object + void Read(ms_packet *_p); //!< Read in a single ms of data + int32 getScale(){return(agc_scale);} + int32 getOvrflw(){return(overflw);} }; diff --git a/objects/pvt.cpp b/objects/pvt.cpp index db9124d..6fe24b1 100644 --- a/objects/pvt.cpp +++ b/objects/pvt.cpp @@ -494,7 +494,7 @@ void PVT::ClockInit() master_clock.bias = 0; master_clock.time = master_clock.time0; master_clock.time_raw = master_clock.time0; - master_clock.week = ephemerides[lcv].week_number; + master_clock.week = ephemerides[lcv].week_number + CURRENT_GPS_WEEK_ROLLOVER * 1024; master_clock.state = PVT_CLOCK_NOMINAL; break; } diff --git a/objects/telemetry.cpp b/objects/telemetry.cpp index 8e66625..e90980f 100644 --- a/objects/telemetry.cpp +++ b/objects/telemetry.cpp @@ -76,14 +76,17 @@ Telemetry::Telemetry():Threaded_Object("TLMTASK") signal(SIGPIPE, lost_gui_pipe); remove("/tmp/GPS2GUI"); - fifo[WRITE] = mkfifo("/tmp/GPS2GUI", S_IRWXG | S_IRWXU | S_IRWXO); + fifo[WRITE] = mkfifo("/tmp/GPS2GUI", S_IRWXU|S_IRWXG|S_IRWXO|S_IROTH|S_IWOTH); if(fifo[WRITE] == -1) fprintf(stderr,"Error creating the named pipe /tmp/GPS2GUI\n"); + chmod("/tmp/GPS2GUI", S_IRWXU|S_IRWXG|S_IRWXO|S_IROTH|S_IWOTH); + remove("/tmp/GUI2GPS"); - fifo[READ] = mkfifo("/tmp/GUI2GPS", S_IRWXG | S_IRWXU | S_IRWXO); + fifo[READ] = mkfifo("/tmp/GUI2GPS", S_IRWXU|S_IRWXG|S_IRWXO|S_IROTH|S_IWOTH); if(fifo[READ] == -1) fprintf(stderr,"Error creating the named pipe /tmp/GUI2GPS\n"); + chmod("/tmp/GUI2GPS", S_IRWXU|S_IRWXG|S_IRWXO|S_IROTH|S_IWOTH); /* Build the function pointer array */ msg_handlers[FIRST_M_ID] = NULL; @@ -534,13 +537,13 @@ void Telemetry::SendBoardHealth() board_health->fft_version = 0; /* DSA Values */ - board_health->dsa0 = pFIFO->agc_scale; + board_health->dsa0 = pSource->getScale(); board_health->dsa1 = 0; board_health->dsa2 = 0; board_health->dsa3 = 0; /* Overflow on A/Ds */ - board_health->ovrflw0 = pFIFO->overflw; + board_health->ovrflw0 = pSource->getOvrflw(); board_health->ovrflw1 = 0; board_health->ovrflw2 = 0; board_health->ovrflw3 = 0; diff --git a/objects/telemetry.h b/objects/telemetry.h index b8a652c..b0f5d77 100644 --- a/objects/telemetry.h +++ b/objects/telemetry.h @@ -47,6 +47,7 @@ enum Telemetry_Type #include "pvt.h" //!< Least squares PVT solution //#include "pps.h" //!< Control the PPS #include "channel.h" //!< Tracking loops +#include "gps_source.h" //!< Get GPS data from where /*! @ingroup CLASSES @brief The Telemetry services the RS422 port. diff --git a/usrp/Makefile b/usrp/Makefile index 4a5ad74..63e29a1 100644 --- a/usrp/Makefile +++ b/usrp/Makefile @@ -20,8 +20,8 @@ $(EXE): $(EXE).o $(OBJS) mv $(EXE) ../$(EXE) %.o:%.cpp - $(CC) $(CFLAGS) -c $< -o $@ - + $(CC) $(CFLAGS) -c $< -o $@ + clean: @rm -rvf *.dis @rm -rvf *.o diff --git a/usrp/fusb.h b/usrp/fusb.h new file mode 100644 index 0000000..8116ed0 --- /dev/null +++ b/usrp/fusb.h @@ -0,0 +1,138 @@ +/* -*- c++ -*- */ +/* + * Copyright 2003 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// Fast USB interface + +#ifndef _FUSB_H_ +#define _FUSB_H_ + + +struct usb_dev_handle; +class fusb_ephandle; + +/*! + * \brief abstract usb device handle + */ +class fusb_devhandle { +private: + // NOT IMPLEMENTED + fusb_devhandle (const fusb_devhandle &rhs); // no copy constructor + fusb_devhandle &operator= (const fusb_devhandle &rhs); // no assignment operator + +protected: + usb_dev_handle *d_udh; + +public: + // CREATORS + fusb_devhandle (usb_dev_handle *udh); + virtual ~fusb_devhandle (); + + // MANIPULATORS + + /*! + * \brief return an ephandle of the correct subtype + */ + virtual fusb_ephandle *make_ephandle (int endpoint, bool input_p, + int block_size = 0, int nblocks = 0) = 0; + + // ACCESSORS + usb_dev_handle *get_usb_dev_handle () const { return d_udh; } +}; + + +/*! + * \brief abstract usb end point handle + */ +class fusb_ephandle { +private: + // NOT IMPLEMENTED + fusb_ephandle (const fusb_ephandle &rhs); // no copy constructor + fusb_ephandle &operator= (const fusb_ephandle &rhs); // no assignment operator + +protected: + int d_endpoint; + bool d_input_p; + int d_block_size; + int d_nblocks; + bool d_started; + +public: + fusb_ephandle (int endpoint, bool input_p, + int block_size = 0, int nblocks = 0); + virtual ~fusb_ephandle (); + + virtual bool start () = 0; //!< begin streaming i/o + virtual bool stop () = 0; //!< stop streaming i/o + + /*! + * \returns \p nbytes if write was successfully enqueued, else -1. + * Will block if no free buffers available. + */ + virtual int write (const void *buffer, int nbytes) = 0; + + /*! + * \returns number of bytes read or -1 if error. + * number of bytes read will be <= nbytes. + * Will block if no input available. + */ + virtual int read (void *buffer, int nbytes) = 0; + + /* + * block until all outstanding writes have completed + */ + virtual void wait_for_completion () = 0; + + /*! + * \brief returns current block size. + */ + int block_size () { return d_block_size; }; +}; + + +/*! + * \brief factory for creating concrete instances of the appropriate subtype. + */ +class fusb_sysconfig { +public: + /*! + * \brief returns fusb_devhandle or throws if trouble + */ + static fusb_devhandle *make_devhandle (usb_dev_handle *udh); + + /*! + * \brief Returns max block size in bytes (hard limit). + */ + static int max_block_size (); + + /*! + * \brief Returns default block size in bytes. + */ + static int default_block_size (); + + /*! + * \brief Returns the default buffer size in bytes. + */ + static int default_buffer_size (); + +}; + +#endif /* _FUSB_H_ */ diff --git a/usrp/fusb_linux.h b/usrp/fusb_linux.h new file mode 100644 index 0000000..b2d46a5 --- /dev/null +++ b/usrp/fusb_linux.h @@ -0,0 +1,116 @@ +/* -*- c++ -*- */ +/* + * Copyright 2003 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +// Fast USB interface + +#ifndef _FUSB_LINUX_H_ +#define _FUSB_LINUX_H_ + +#include +#include + +struct usbdevfs_urb; +class fusb_ephandle_linux; + +/*! + * \brief linux specific implementation of fusb_devhandle using usbdevice_fs + */ +class fusb_devhandle_linux : public fusb_devhandle { +private: + std::list d_pending_rqsts; + + void pending_add (usbdevfs_urb *urb); + bool pending_remove (usbdevfs_urb *urb); + usbdevfs_urb * pending_get (); + + +public: + // CREATORS + fusb_devhandle_linux (usb_dev_handle *udh); + virtual ~fusb_devhandle_linux (); + + // MANIPULATORS + virtual fusb_ephandle *make_ephandle (int endpoint, bool input_p, + int block_size = 0, int nblocks = 0); + + // internal use only + bool _submit_urb (usbdevfs_urb *urb); + bool _cancel_urb (usbdevfs_urb *urb); + void _cancel_pending_rqsts (fusb_ephandle_linux *eph); + bool _reap (bool ok_to_block_p); + void _wait_for_completion (); +}; + + /*! + * \brief linux specific implementation of fusb_ephandle using usbdevice_fs + */ + +class fusb_ephandle_linux : public fusb_ephandle { +private: + fusb_devhandle_linux *d_devhandle; + std::list d_free_list; + std::list d_completed_list; + usbdevfs_urb *d_write_work_in_progress; + unsigned char *d_write_buffer; + usbdevfs_urb *d_read_work_in_progress; + unsigned char *d_read_buffer; + unsigned char *d_read_buffer_end; + + usbdevfs_urb *get_write_work_in_progress (); + void reap_complete_writes (); + bool reload_read_buffer (); + bool submit_urb (usbdevfs_urb *urb); + +public: + fusb_ephandle_linux (fusb_devhandle_linux *dh, int endpoint, bool input_p, + int block_size = 0, int nblocks = 0); + virtual ~fusb_ephandle_linux (); + + virtual bool start (); //!< begin streaming i/o + virtual bool stop (); //!< stop streaming i/o + + /*! + * \returns \p nbytes if write was successfully enqueued, else -1. + * Will block if no free buffers available. + */ + virtual int write (const void *buffer, int nbytes); + + /*! + * \returns number of bytes read or -1 if error. + * number of bytes read will be <= nbytes. + * Will block if no input available. + */ + virtual int read (void *buffer, int nbytes); + + /* + * block until all outstanding writes have completed + */ + virtual void wait_for_completion (); + + // internal use only + void free_list_add (usbdevfs_urb *urb); + void completed_list_add (usbdevfs_urb *urb); + usbdevfs_urb *free_list_get (); // pop and return head of list or 0 + usbdevfs_urb *completed_list_get (); // pop and return head of list or 0 +}; + +#endif /* _FUSB_LINUX_H_ */ diff --git a/usrp/gn3s.cpp b/usrp/gn3s.cpp new file mode 100644 index 0000000..363b9c4 --- /dev/null +++ b/usrp/gn3s.cpp @@ -0,0 +1,529 @@ +/*----------------------------------------------------------------------------------------------*/ +/*! \file gn3s.cpp +// +// FILENAME: gn3s.cpp +// +// DESCRIPTION: Impelements the GN3S class. +// +// DEVELOPERS: Gregory W. Heckler (2003-2009) +// +// LICENSE TERMS: Copyright (c) Gregory W. Heckler 2009 +// +// This file is part of the GPS Software Defined Radio (GPS-SDR) +// +// The GPS-SDR is free software; you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. The GPS-SDR is distributed in the hope that +// it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. +// +// Note: Comments within this file follow a syntax that is compatible with +// DOXYGEN and are utilized for automated document extraction +// +// Reference: +*/ +/*----------------------------------------------------------------------------------------------*/ + +#include "gn3s.h" + +static char debug = 1; //!< 1 = Verbose + +/*----------------------------------------------------------------------------------------------*/ +gn3s::gn3s(int _which) +{ + + int fsize; + bool ret; + which = _which; + + fx2_device = NULL; + fx2_handle = NULL; + gn3s_vid = GN3S_VID; + gn3s_pid = GN3S_PID; + + /* Get the firmware embedded in the executable */ + fstart = (int) &_binary_usrp_gn3s_firmware_ihx_start; + fsize = strlen(_binary_usrp_gn3s_firmware_ihx_start); + + gn3s_firmware = new char[fsize + 10]; + memcpy(&gn3s_firmware[0], (void *)fstart, fsize); + gn3s_firmware[fsize] = NULL; + + /* Search all USB busses for the device specified by VID/PID */ + fx2_device = usb_fx2_find(gn3s_vid, gn3s_pid, debug, 0); + if (!fx2_device) + { + /* Program the board */ + ret = prog_gn3s_board(); + if(ret) + { + fprintf(stdout, "Could not flash GN3S device\n"); + exit(-1); + } + + /* Need to wait to catch change */ + sleep(2); + + /* Search all USB busses for the device specified by VID/PID */ + fx2_device = usb_fx2_find(gn3s_vid, gn3s_pid, debug, 0); + } + else + { + fprintf(stdout, "Found GN3S Device\n"); + } + + /* Open and configure FX2 device if found... */ + ret = usb_fx2_configure(fx2_device, &fx2_config); + if(ret) + { + fprintf(stdout, "Could not obtain a handle to the GN3S device\n"); + exit(-1); + } + +} +/*----------------------------------------------------------------------------------------------*/ + + +/*----------------------------------------------------------------------------------------------*/ +gn3s::~gn3s() +{ + + usrp_xfer(VRQ_XFER, 0); + + //delete gn3s_firmware; + delete fx2_config.d_ephandle; + delete fx2_config.d_devhandle; + + usb_release_interface(fx2_config.udev, fx2_config.interface); + usb_close(fx2_config.udev); + +} +/*----------------------------------------------------------------------------------------------*/ + + +/*----------------------------------------------------------------------------------------------*/ +int gn3s::prog_gn3s_board() +{ + + char a; + struct usb_bus *bus; + struct usb_device *dev; + struct usb_dev_handle *han; + int vid, pid; + + dev = NULL; + + usb_init(); + usb_find_busses(); + usb_find_devices(); + + vid = (VID_OLD); + pid = (PID_OLD); + + for(bus = usb_busses; bus; bus = bus->next) + { + for(dev = bus->devices; dev; dev = dev->next) + { + if((dev->descriptor.idVendor == vid) && (dev->descriptor.idProduct == pid)) + { + fx2_device = dev; + fprintf(stdout,"GN3S Device Found... awaiting firmware flash \n"); + break; + } + } + } + + if(fx2_device == NULL) + { + fprintf(stderr,"Cannot find vid 0x%x pid 0x%x \n", vid, pid); + return -1; + } + + printf("Using device vendor id 0x%04x product id 0x%04x\n", + fx2_device->descriptor.idVendor, fx2_device->descriptor.idProduct); + + fx2_handle = usb_open(fx2_device); + + /* Do the first set 0xE600 1 */ + char c[] = "1"; + char d[] = "0"; + + a = atoz(c); + + fprintf(stdout,"GN3S flashing ... \n"); + + upload_ram(&a, (PROG_SET_CMD),1); + + program_fx2(NULL, 1); + + a = atoz(d); + + upload_ram(&a, (PROG_SET_CMD),1); + + fprintf(stdout,"GN3S flash complete! \n"); + + usb_close(fx2_handle); + + return(0); +} +/*----------------------------------------------------------------------------------------------*/ + + +/*----------------------------------------------------------------------------------------------*/ +int gn3s::atoz(char *s) +{ + int a; + if(!strncasecmp("0x", s, 2)){ + sscanf(s, "%x", &a); + return a; + } + return atoi(s); +} +/*----------------------------------------------------------------------------------------------*/ + + +/*----------------------------------------------------------------------------------------------*/ +void gn3s::upload_ram(char *buf, int start, int len) +{ + int i; + int tlen; + int quanta = 16; + int a; + + for (i = start; i < start + len; i += quanta) { + tlen = len + start - i; + + if (tlen > quanta) + tlen = quanta; + + if (debug >= 3) + printf("i = %d, tlen = %d \n", i, tlen); + a = usb_control_msg(fx2_handle, 0x40, 0xa0, i, 0, + buf + (i - start), tlen, 1000); + + if (a < 0) { + fprintf(stderr, "Request to upload ram contents failed: %s\n", + usb_strerror()); + return; + } + } +} +/*----------------------------------------------------------------------------------------------*/ + + +/*----------------------------------------------------------------------------------------------*/ +void gn3s::program_fx2(char *filename, char mem) +{ + FILE *f; + char s[1024]; + char data[256]; + char checksum, a; + int length, addr, type, i; + unsigned int b; + + f = tmpfile(); + + /* Dump firmware into temp file */ + fputs(gn3s_firmware, f); + rewind(f); + + while (!feof(f)) { + fgets(s, 1024, f); /* we should not use more than 263 bytes normally */ + + if (s[0] != ':') { + fprintf(stderr, "%s: invalid string: \"%s\"\n", filename, s); + continue; + } + + sscanf(s + 1, "%02x", &length); + sscanf(s + 3, "%04x", &addr); + sscanf(s + 7, "%02x", &type); + + if (type == 0) { + // printf("Programming %3d byte%s starting at 0x%04x", + // length, length==1?" ":"s", addr); + a = length + (addr & 0xff) + (addr >> 8) + type; + + for (i = 0; i < length; i++) { + sscanf(s + 9 + i * 2, "%02x", &b); + data[i] = b; + a = a + data[i]; + } + + sscanf(s + 9 + length * 2, "%02x", &b); + checksum = b; + + if (((a + checksum) & 0xff) != 0x00) { + printf(" ** Checksum failed: got 0x%02x versus 0x%02x\n", (-a) + & 0xff, checksum); + continue; + } else { + //printf(", checksum ok\n"); + } + + upload_ram(data, addr, length); + + } else { + if (type == 0x01) { + printf("End of file\n"); + fclose(f); + + return; + } else { + if (type == 0x02) { + printf("Extended address: whatever I do with it ?\n"); + continue; + } + } + } + } + + fclose(f); +} +/*----------------------------------------------------------------------------------------------*/ + + +/*----------------------------------------------------------------------------------------------*/ +struct usb_device* gn3s::usb_fx2_find(int vid, int pid, char info, int ignore) +{ + struct usb_bus *bus; + struct usb_device *dev; + struct usb_device *fx2 = NULL; + usb_dev_handle *udev; + int count = 0; + int ret; + char str[256]; + + usb_init(); + usb_find_busses(); + usb_find_devices(); + + for(bus = usb_busses; bus; bus = bus->next) + { + for(dev = bus->devices; dev; dev = dev->next) + { + if((dev->descriptor.idVendor == vid) && (dev->descriptor.idProduct == pid)) + { + fx2 = dev; + } + + if(fx2 != NULL && info) + { + udev = usb_open(fx2); + if(udev && dev->descriptor.idVendor == vid && dev->descriptor.idProduct == pid && count < ignore) + { + if(fx2->descriptor.iManufacturer) + { + ret = usb_get_string_simple(udev, fx2->descriptor.iManufacturer, str, sizeof(str)); + + if(ret > 0) + printf("- Manufacturer : %s\n", str); + else + printf("- Unable to fetch manufacturer string\n"); + } + + if(fx2->descriptor.iProduct) + { + ret = usb_get_string_simple(udev, fx2->descriptor.iProduct, str, sizeof(str)); + + if(ret > 0) + printf("- Product : %s\n", str); + else + printf("- Unable to fetch product string\n"); + } + + if(fx2->descriptor.iSerialNumber) + { + ret = usb_get_string_simple(udev, fx2->descriptor.iSerialNumber, str, sizeof(str)); + + if(ret > 0) + printf("- Serial Number: %s\n", str); + else + printf("- Unable to fetch serial number string\n"); + } + + usb_close (udev); + return fx2; + } + else if(udev && dev->descriptor.idVendor == vid && dev->descriptor.idProduct == pid && count >= ignore) + { + count++; + } + + if(!fx2->config) + { + printf(" Could not retrieve descriptors\n"); + continue; + } + + for(int i = 0; i < fx2->descriptor.bNumConfigurations; i++) + { + //print_configuration(&fx2->config[i]); + } + } + } + } + + return fx2; +} +/*----------------------------------------------------------------------------------------------*/ + + +/*----------------------------------------------------------------------------------------------*/ +bool gn3s::usb_fx2_configure(struct usb_device *fx2, fx2Config *fx2c) +{ + + char status = 0; + int interface = RX_INTERFACE; + int altinterface = RX_ALTINTERFACE; + usb_dev_handle *udev; + fusb_ephandle *d_ephandle; + fusb_devhandle *d_devhandle; + + udev = usb_open(fx2); + + if(!udev) + { + fprintf(stdout, "Could not obtain a handle to GNSS Front-End device \n"); + return -1; + } + else + { + if(debug) + printf("Received handle for GNSS Front-End device \n"); + + if(usb_set_configuration (udev, 1) < 0) + { + fprintf (stdout, + "error in %s, \n%s \n", + __FUNCTION__, + usb_strerror()); + usb_close (udev); + status = -1; + } + + if(usb_claim_interface (udev, interface) < 0) + { + fprintf (stdout, + "error in %s, \n%s \n", + __FUNCTION__, + usb_strerror()); + usb_close (udev); + fprintf (stdout, "\nDevice not programmed? \n"); + usb_close (udev); + status = -1; + exit(0); + } + + if(usb_set_altinterface (udev, altinterface) < 0) + { + fprintf (stdout, + "error in %s, \n%s \n", + __FUNCTION__, + usb_strerror()); + usb_close (udev); + usb_release_interface (udev, interface); + usb_close (udev); + status = -1; + } + + d_devhandle = make_devhandle(udev); + d_ephandle = d_devhandle->make_ephandle(RX_ENDPOINT, true, FUSB_BLOCK_SIZE, FUSB_NBLOCKS); + + if(!d_ephandle->start()) + { + fprintf (stdout, "usrp0_rx: failed to start end point streaming"); + usb_strerror (); + status = -1; + } + + if(status == 0) + { + fx2c->interface = interface; + fx2c->altinterface = altinterface; + fx2c->udev = udev; + fx2c->d_devhandle = d_devhandle; + fx2c->d_ephandle = d_ephandle; + return 0; + } + else + { + return -1; + } + } +} +/*----------------------------------------------------------------------------------------------*/ + + +/*----------------------------------------------------------------------------------------------*/ +fusb_devhandle* gn3s::make_devhandle(usb_dev_handle *udh) +{ + return new fusb_devhandle_linux(udh); +} +/*----------------------------------------------------------------------------------------------*/ + + +/*----------------------------------------------------------------------------------------------*/ +int gn3s::read(void *buff, int bytes) +{ + return(fx2_config.d_ephandle->read(buff, bytes)); +} +/*----------------------------------------------------------------------------------------------*/ + + +/*----------------------------------------------------------------------------------------------*/ +bool gn3s::check_rx_overrun() +{ + bool overrun; + + _get_status(GS_RX_OVERRUN, &overrun); + + return(overrun); +} +/*----------------------------------------------------------------------------------------------*/ + + +/*----------------------------------------------------------------------------------------------*/ +bool gn3s::_get_status(int command, bool *trouble) +{ + unsigned char status; + + if(write_cmd(VRQ_GET_STATUS, 0, command, &status, sizeof(status)) != sizeof (status)) + return false; + + *trouble = status; + return true; +} +/*----------------------------------------------------------------------------------------------*/ + + +/*----------------------------------------------------------------------------------------------*/ +bool gn3s::usrp_xfer(char VRQ_TYPE, bool start) +{ + int r; + + r = write_cmd(VRQ_TYPE, start, 0, 0, 0); + + return(r == 0); +} +/*----------------------------------------------------------------------------------------------*/ + + +/*----------------------------------------------------------------------------------------------*/ +int gn3s::write_cmd(int request, int value, int index, unsigned char *bytes, int len) +{ + int requesttype; + int r; + + requesttype = (request & 0x80) ? VRT_VENDOR_IN : VRT_VENDOR_OUT; + r = usb_control_msg (fx2_config.udev, requesttype, request, value, index, (char *) bytes, len, 1000); + if(r < 0) + { + /* We get EPIPE if the firmware stalls the endpoint. */ + if(errno != EPIPE) + fprintf (stdout, "usb_control_msg failed: %s\n", usb_strerror()); + } + return r; +} +/*----------------------------------------------------------------------------------------------*/ diff --git a/usrp/gn3s.h b/usrp/gn3s.h new file mode 100644 index 0000000..50f47ed --- /dev/null +++ b/usrp/gn3s.h @@ -0,0 +1,143 @@ +/*----------------------------------------------------------------------------------------------*/ +/*! \file gn3s.h +// +// FILENAME: gn3s.h +// +// DESCRIPTION: Defines the GN3S class. +// +// DEVELOPERS: Gregory W. Heckler (2003-2009) +// +// LICENSE TERMS: Copyright (c) Gregory W. Heckler 2009 +// +// This file is part of the GPS Software Defined Radio (GPS-SDR) +// +// The GPS-SDR is free software; you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. The GPS-SDR is distributed in the hope that +// it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. +// +// Note: Comments within this file follow a syntax that is compatible with +// DOXYGEN and are utilized for automated document extraction +// +// Reference: +*/ +/*----------------------------------------------------------------------------------------------*/ + + +#ifndef GN3S_H_ +#define GN3S_H_ + + +/* Includes */ +/*--------------------------------------------------------------*/ +#include +#include +#include +#include +#include +#include +#include "fusb.h" +#include "fusb_linux.h" +#include "usrp_bytesex.h" +#include "usrp_prims.h" +/*--------------------------------------------------------------*/ + + +/* FX2 Configuration Structure */ +/*--------------------------------------------------------------*/ +struct fx2Config +{ + int interface; + int altinterface; + usb_dev_handle *udev; + fusb_ephandle *d_ephandle; + fusb_devhandle *d_devhandle; +}; +/*--------------------------------------------------------------*/ + + +/* FX2 Stuff */ +/*--------------------------------------------------------------*/ +#define RX_ENDPOINT (0x86) +#define VRT_VENDOR_IN (0xC0) +#define VRT_VENDOR_OUT (0x40) +#define RX_INTERFACE (2) +#define RX_ALTINTERFACE (0) +#define VRQ_GET_STATUS (0x80) +#define GS_RX_OVERRUN (1) //!< Returns 1 byte +#define VRQ_XFER (0x01) +/*--------------------------------------------------------------*/ + + +/* GN3S Stuff */ +/*--------------------------------------------------------------*/ +#define GN3S_VID (0x16C0) +#define GN3S_PID (0x072F) +#define VID_OLD (0x1781) +#define PID_OLD (0x0B39) +#define PROG_SET_CMD (0xE600) +#define FUSB_BUFFER_SIZE (16 * (1L << 20)) //!< 8 MB +#define FUSB_BLOCK_SIZE (16 * (1L << 10)) //!< 16KB is hard limit +#define FUSB_NBLOCKS (FUSB_BUFFER_SIZE / FUSB_BLOCK_SIZE) +/*--------------------------------------------------------------*/ + + +/* The firmware is embedded into the executable */ +/*--------------------------------------------------------------*/ +extern char _binary_usrp_gn3s_firmware_ihx_start[]; +/*--------------------------------------------------------------*/ + + +/*--------------------------------------------------------------*/ +/*! \ingroup CLASSES + * + */ +class gn3s +{ + + private: + + /* First or second board */ + int which; + + /* GN3S FX2 Stuff */ + struct fx2Config fx2_config; + struct usb_device *fx2_device; + struct usb_dev_handle *fx2_handle; + + /* USB IDs */ + uint32_t gn3s_vid, gn3s_pid; + + /* Pull in the binary firmware */ + int fstart; + int fsize; + char *gn3s_firmware; + + public: + + gn3s(int _which); //!< Constructor + ~gn3s(); //!< Destructor + + /* FX2 functions */ + struct usb_device* usb_fx2_find(int vid, int pid, char info, int ignore); + bool usb_fx2_configure(struct usb_device *fx2, fx2Config *fx2c); + fusb_devhandle* make_devhandle (usb_dev_handle *udh); + int read(void *buff, int bytes); + int write_cmd(int request, int value, int index, unsigned char *bytes, int len); + bool _get_status(int which, bool *trouble); + bool check_rx_overrun(); + bool usrp_xfer(char VRQ_TYPE, bool start); + + /* Used to flash the GN3S */ + int atoz(char *s); + void upload_ram(char *buf, int start, int len); + void program_fx2(char *filename, char mem); + int prog_gn3s_board(); + +}; +/*--------------------------------------------------------------*/ + + +#endif /*GN3S_H_ */ diff --git a/usrp/gn3s_firmware.ihx b/usrp/gn3s_firmware.ihx new file mode 100644 index 0000000..faad32a --- /dev/null +++ b/usrp/gn3s_firmware.ihx @@ -0,0 +1,526 @@ +:06000000020FE702006B95 +:03000B0002006B85 +:0300130002006B7D +:03001B0002006B75 +:0300230002006B6D +:03002B0002006B65 +:0300330002006B5D +:03003B0002006B55 +:0300430002006B4D +:03004B0002006B45 +:0300530002006B3D +:03005B0002006B35 +:0300630002006B2D +:01006B003262 +:0900800002006B0002006B00029B +:08008900006B0002006B000295 +:08009100006B0002006B00028D +:08009900006B0002006B000285 +:0800A100006B0002006B00027D +:0800A900006B0002006B000275 +:0700B100006B0002006B0070 +:0901000002006B0002006B00021A +:08010900006B0002006B000214 +:08011100006B0002006B00020C +:08011900006B0002006B000204 +:08012100006B0002006B0002FC +:08012900006B0002006B0002F4 +:08013100006B0002006B0002EC +:08013900006B0002006B0002E4 +:08014100006B0002006B0002DC +:08014900006B0002006B0002D4 +:08015100006B0002006B0002CC +:08015900006B0002006B0002C4 +:08016100006B0002006B0002BC +:08016900006B0002006B0002B4 +:08017100006B0002006B0002AC +:07017900006B0002006B00A7 +:030FF000020FF3FA +:030FE700750A0088 +:0310060002018064 +:0501800012018580FE64 +:0701850012057A12060212B6 +:08018C000661120560C2AF120A +:0A0194000F1A120A7BD2EAD2AF1252 +:06019E0009901206830225 +:0201A40005272D +:0501A60090E68BE4F07F +:0901AB0090E6A0E0FA20E1F82240 +:0A01B40090E6B8E0FABAC00280033A +:0301BE0002031425 +:0A01C10090E6B9E0FABA800280125D +:0501CB00BAA2028057FA +:0501D000BAA3028052F9 +:0501D500BAA9028047F9 +:0301DA000203100D +:0E01DD0090E6BCE0FA601EBA013690E6C1E082 +:0E01EB00FA235401FA90E740F090E68AE4F01F +:0901F90090E68B7401F00205236D +:0E02020090E6C1E0FA235401FA90E740F09034 +:0D021000E68AE4F090E68B7401F00205230D +:04021D0075820022C4 +:060221007508014309010C +:0A02270090E6BAE0FA8A0B750C00AD +:0C02310090E6BBE0FC8C05E4FC420BED09 +:0A023D00420C90E6BEE0FC8C0D754B +:0C0247000E0090E6BFE0FE8E07E4FE42D1 +:040253000DEF420E5B +:07025700E50D450E700302E6 +:02025E00052376 +:0C02600090E6A0E0FE20E1F8C3E50D945C +:0A026C0040E50E94005006AE0DAF01 +:030276000E8004F3 +:040279007E407F0044 +:0C027D0090E6B9E0F8B8A32D7A007B00F1 +:0E028900C3EA9EEB9F505EEA2440FCEB34E794 +:0A029700FDA80BA90CEA28F582EB84 +:0E02A10039F583E0F88C828D83F00ABA00DA1A +:0302AF000B80D7EA +:0402B2007C007D004F +:0E02B600C3EC9EED9F5014EC2440F582ED3415 +:0D02C400E7F58374CDF00CBC00E80D80E57B +:0902D1008E137C407DE78C148D36 +:0502DA0015850B828573 +:0C02DF000C83C006C007120779D007D0BE +:0302EB0006E433F3 +:0C02EE0090E68AE4F090E68BEEF0EE253E +:0502FA000BF50BEF35D0 +:0402FF000CF50CE509 +:060303000DC39EF50DE59F +:050309000E9FF50E023D +:02030E00025794 +:0403100075820022D0 +:0A03140090E6B8E0FCBC4002800354 +:03031E0002051FB6 +:0A03210090E6B9E0FCBC0102801573 +:06032B00BCA2030203D88E +:06033100BCA3030203D887 +:06033700BCA9030203D281 +:03033D0002051B9B +:0D03400090E6BAE0606390E6C67480F0902D +:0E034D00E6C774EDF090E6C8E4F090E6C9F063 +:0E035B0090E6CAF090E6CBF090E6CC7403F08A +:0D03690090E6CD7402F090E60CE4F00090F8 +:0E037600E6F574FFF00075BB000090E6C7745A +:0E038400EDF00090E6047480F00090E6047442 +:0E03920002F00090E6047406F00090E604E429 +:0903A000F00075BB060002052304 +:0E03A90075BB000090E6F574FFF00090E604CE +:0E03B7007480F00090E6047402F00090E604FA +:0D03C5007406F00090E604E4F00002052349 +:0603D2007508014309015A +:0A03D80090E6BAE0FC8C0B750C00F7 +:0C03E20090E6BBE0FC8C05E4FC420BED57 +:0A03EE00420C90E6BEE0FC8C0D7599 +:0C03F8000E0090E6BFE0FC8C05E4FC4227 +:050404000DED420EE5C4 +:080409000A70061208AA8582A0 +:010411000AE0 +:07041200E50D450E70030229 +:020419000523B9 +:09041B0090E68AE4F090E68BF013 +:0E04240090E6A0E0FC20E1F890E68BE0FC8C76 +:0E043200067F0090E6B9E0FCBCA3307A007BA8 +:0104400000BB +:0A044100C3EA9EEB9F40030205038F +:0A044B00A80BA90CEA28F8EB39F918 +:0E045500EA2440F582EB34E7F583E0FC888270 +:0A0463008983F00ABA00D70B80D499 +:04046D007C007D0092 +:0A047100C3EC9EED9F40030205035B +:09047B00E50AF50FB40102804608 +:09048400EC250BF9ED350CF8AA8A +:08048D000A7B001ABAFF011BF3 +:0C049500EA5201EB5200E9486010AA0B8B +:0A04A100ECFB2AFAE50A145AD39581 +:0404AB000AF4F50F4B +:0C04AF00EEC39CFAEF9DFBA80F7900C380 +:0E04BB00EA98EB9950098E028C03EAC39BF578 +:0104C9000F23 +:0A04CA00EC250BF582ED350CF583EF +:0A04D400EC2440F510ED34E7F511BB +:0A04DE00850F12C004C005C006C05F +:0E04E800071206A5D007D006D005D004E433D5 +:0B04F600A80F7A00E82CFCEA3DFD0294 +:02050100047183 +:07050300EE250BF50BEF35AF +:04050A000CF50CE5FB +:06050E000DC39EF50DE592 +:050514000E9FF50E0230 +:020519000412CA +:04051B0075820022C3 +:04051F0075820022BF +:0405230075820122BA +:0D05270090E6C67480F090E6C774EDF09089 +:0D053400E6C8E4F090E6C9F090E6CAF09049 +:0E054100E6CBF090E6CC7403F090E6CD7402A9 +:07054F00F090E60CE4F0005F +:070556003000FD120B11C281 +:03055D000080F625 +:0C056000750A0090E678E05410FAC454CC +:0A056C000FFA74504AF509740155A6 +:0405760009F5082259 +:0E057A0090E6007410F0758E0090E601740299 +:0E058800F00090E61074A0F00090E61174E010 +:0E059600F00090E612E4F00090E613E4F000AE +:0E05A40090E61474E0F00090E615E4F000908C +:0E05B200E6047480F00090E6047406F00090F9 +:0E05C000E604E4F00090E618E4F090E619F08E +:0D05CE0090E61A740CF090E61BE4F000902B +:0E05DB00E68AE4F00090E68DE4F00090E6E29F +:0E05E9007402F00090E6E37401F00090E62446 +:0B05F7007402F00090E625E4F0002202 +:0E06020090E6F574FFF0009010ADE493FA90CE +:0E061000E6F3F09010AEE493FA90E6C3F0909B +:0E061E0010AFE493FA90E6C1F09010B0E493B0 +:0E062C00FA90E6C2F09010B2E493FA90E6C0A5 +:03063A00F07A0053 +:03063D00BA800080 +:0C06400050198A037CE4EA2409F582E4E6 +:0C064C003410F583E493FD8B828C83F066 +:030658000A80E233 +:06065B0090E6C6E4F02267 +:0E1009000101010101010107000000000000CB +:0E1017000000000000000000000000000000CB +:0E1025000000003F0101010101010107000070 +:0E1033000000000000000000000000000000AF +:0E104100000000000000003F38010101010125 +:0E104F0001070302020202020200000000007C +:0E105D0000000000360000000000003F3801D7 +:0E106B0001010101010703020202020202005C +:0E107900000000000000000036000000000033 +:02108700003F28 +:0E108900000000000000000000000000000059 +:0E1097000000000080ED000000000302008059 +:0810A500EE0000000003020050 +:0710AD00A0000000AE4E00A0 +:0E066100C2B0C2B2D2B3C2B475B51DD280C24F +:0E066F0081C282D283C284C285C286C28775D0 +:06067D00B2FF75820022AD +:08068300D284D28575820022A9 +:08068B00C284C28575820022C1 +:0E069300C284C285900001120FD6D284D28597 +:0406A100758200223C +:0E06A500AA82AB83C002C003120770D003D03C +:0E06B30002C002C003120741D003D002C002F1 +:0E06C100C00312088CD003D00250047C0180CC +:0106CF006BBF +:0C06D000E508601690E679EBF0C002C06F +:0E06DC000312088CD003D00250047C01805120 +:0E06EA007B0090E679EAF012088C50047C0147 +:0206F80080413F +:0606FA00AA10AB117D0007 +:0C070000C3ED951250288A828B83E0FE26 +:0E070C00A3AA82AB8390E679EEF0C002C00390 +:0E071A00C005120876D005D003D00250047C32 +:030728000180103D +:03072B000D80D26C +:0D072E0090E678E0FA4440F01207517C009C +:06073B0053B27F8C822204 +:0A07410090E6787480F0E5092509C0 +:06074B00FA90E679F022AD +:030751001207701C +:0E075400120741120876E43390E678E0FA448A +:0E07620040F012077090E678E0FA30E1E522F0 +:0907700090E678E0FA20E6F82298 +:0E077900AA82AB83C002C003120770D003D067 +:0E07870002C002C003120741D003D002C0021C +:0E079500C00312088CD003D0025004758201FC +:0107A3002233 +:0C07A400E508601690E679EBF0C002C09A +:0E07B0000312088CD003D0025004758201227F +:0E07BE007B0090E679EAF012088C50047582F8 +:0207CC00012208 +:0A07CE0090E6787480F0E509250933 +:0E07D800FA90E67974014AF012087650047522 +:0307E6008201226B +:0D07E90090E679E012087650047582012236 +:0407F6007A007B000A +:0907FA00AC137D001CBCFF011DC5 +:0E0803008B067F00C3EE9CEF64808DF063F0E7 +:0B0811008095F05024EB2514FCE4352A +:0C081C0015FD90E679E0FE8C828D83F0E3 +:0D082800C003120876D0035004758201222F +:050835000B8B0280C0E6 +:0E083A0090E6787420F0C002120876D00250CA +:0508480004758201228D +:09084D00EA2514FAE43515FB90CC +:0E085600E679E0FC8A828B83F012087650046B +:040864007582012276 +:0E08680090E6787440F090E679E07582002208 +:0E08760090E678E0FA8A0330E0F6EB30E20418 +:040884007582012256 +:040888007582002253 +:0E088C0090E678E0FA8A0330E0F6EB30E20402 +:04089A007582012240 +:08089E00EB20E1047582012248 +:0408A6007582002235 +:0808AA00E508700475820122CB +:0408B2007514407504 +:0308B6001518759D +:0A08B90013409000001207797A0046 +:0308C300BA400038 +:0A08C600500FEA2400F582E4341814 +:0708D000F583EAF00A80EC59 +:0408D7007510007523 +:0308DB001118757C +:0A08DE0012409000001206A57A00F7 +:0308E800BA400013 +:0A08EB005011EA2400F582E43418ED +:0908F500F583EAF4FBF00A80EA45 +:0508FE007513407514A4 +:0309030000751567 +:0809060018900000120779901F +:0B090E001800E0FA30E0047B018006D6 +:0609190063023F0A8A039D +:02091F007A005C +:03092100BA4000D9 +:0A09240050208A047D007510407514 +:03092E0011188B12 +:0C093100128C828D83C002C0031206A548 +:09093D00D003D002EB2AFA80DBA2 +:030946008B82227F +:0EE0000012010002FFFFFF40C0162F070201B1 +:04E00E000102060104 +:0AE012000A060002FFFFFF400100B4 +:0EE01C0009023200030100C0000904000000E8 +:0EE02A00FFFFFF030904010001FFFFFF0407D1 +:0EE038000502020002000904020001FFFFFFC2 +:08E04600050705860200020037 +:0EE04E0012010002FFFFFF40C0162F07020163 +:04E05C0001020001BC +:0AE060000A060002FFFFFF40010066 +:0EE06A0009021200010100C0000904000000BC +:04E07800FFFFFF03A4 +:01E07C00079C +:02E07D008CE035 +:02E07F0092E02D +:02E08100B8E005 +:02E08300C8E0F3 +:02E08500EAE0CF +:02E0870006E1B0 +:02E0890020E194 +:06E08C0006030000090478 +:0EE0920026035300690047006500200053007C +:0EE0A00065006D00690063006F006E00640093 +:0AE0AE007500630074006F0072003B +:0EE0B8001003530045003400310031003000E9 +:02E0C6004C000C +:0EE0C800220343006F006D006D0061006E00CA +:0EE0D60064002000260020005300740061004A +:06E0E400740075007300DA +:0EE0EA001C035400720061006E0073006D0094 +:0EE0F800690074002000500061007400680090 +:0EE106001A0352006500630065006900760090 +:0CE11400650020005000610074006800ED +:0CE120000C0331003000300030003000F3 +:080949007880E84400600C799D +:0C09510001901800E4F0A3D8FCD9FAD003 +:0E095D0083D082F6D8FDC082C083758200224E +:09096B0090E6A0E0FA4401F0223C +:0E097400AA8274805AFBC423541FFB740F5ACE +:0E09820090E6834BF090E683E0FA4420F022EA +:0E09900090E680E0FA440AF09000FA120FD6CA +:0E099E0090E65D74FFF090E65F74FFF05391F9 +:0A09AC00EF90E680E0FA54F7F02225 +:06100000E478FFF6D8FDC4 +:060FEA00751600751700EA +:0A09B60090E680E0FA30E7197518AA +:0309C000007519A6 +:0309C300E0751AC2 +:0309C60012751B8C +:0309C900E0751CBA +:0309CC001C751D7A +:0309CF00E0751EB2 +:0309D2006A751F24 +:0209D500E0221E +:0409D70075184E75CC +:0309DB0019E075AB +:0309DE001A607527 +:0309E1001BE075A3 +:0309E4001C6A7515 +:0309E7001DE0759B +:0309EA001E1C755B +:0309ED001FE022E6 +:0909F0005391EF75A100D2003211 +:0E09F900C0E0C0F0C082C083C002C003C004D2 +:0E0A0700C005C006C007C000C001C0D075D039 +:0E0A1500005391EF75A1001209B6D0D0D001A8 +:0E0A2300D000D007D006D005D004D003D002FA +:090A3100D083D082D0F0D0E03275 +:0E0A3A00C0E0C0F0C082C083C002C003C00490 +:0E0A4800C005C006C007C000C001C0D075D0F8 +:0E0A5600005391EF75A1001209B6D0D0D00167 +:0E0A6400D000D007D006D005D004D003D002B9 +:090A7200D083D082D0F0D0E03234 +:050A7B001209B675210F +:030A8000F07522EC +:080A830009758200120E68756E +:030A8B0021F975D9 +:060A8E002209758210121E +:040A94000E68752152 +:030A98003A75228A +:0C0A9B000A758214120E6890E65C74313B +:020AA700F0223B +:0D0AA900E582547FFA24F750047582002284 +:070AB600BA01047582012260 +:080ABD00530201E4BA00010438 +:030AC500F5822295 +:0E0AC800AA82BA010C90E6A1E0FB7C008B82B2 +:030AD6008C8322EC +:0E0AD900BA810C90E6A2E0FB7C008B828C833D +:010AE70022EC +:0E0AE80053027FEA700C90E6A0E0FB7C008BCE +:040AF600828C832249 +:0E0AFA0090E6A3E0FB7C00EAC313FA7D00EA5D +:090B08002BFBED3C8B82F58322EE +:0C0B1100C20090E6B8E0FA530260BA009F +:030B1D000280282B +:050B2000BA2002800D67 +:050B2500BA4002800E41 +:050B2A00BA6002800327 +:030B2F00020DFCB8 +:060B320012096B020DFC2C +:0A0B38001201B4E5826003020DFC17 +:060B420012096B020DFC1C +:0D0B480090E6B8E0FA530280BA8002800304 +:030B5500020CCFC0 +:0B0B580090E6B9E0FABA0003020C4B73 +:050B6300BA0602803516 +:050B6800BA080280083C +:050B6D00BA0A02801726 +:030B7200020CC9A9 +:0C0B750090E740E516F090E68AE4F0906E +:080B8100E68B7401F0020DFC8B +:0C0B890090E740E517F090E68AE4F09059 +:080B9500E68B7401F0020DFC77 +:0A0B9D0090E6BBE0FABA01028017EF +:050BA700BA02028038D3 +:050BAC00BA03028059AC +:050BB100BA0602801BE2 +:050BB600BA0702803CBB +:030BBB00020C45E4 +:0A0BBE00AA18AB1990E6B3EBF07B28 +:090BC8000090E6B4EAF0020DFC15 +:0A0BD100AA1AAB1B90E6B3EBF07B11 +:090BDB000090E6B4EAF0020DFC02 +:0A0BE400AA1CAB1D90E6B3EBF07BFA +:090BEE000090E6B4EAF0020DFCEF +:0A0BF700AA1EAB1F90E6B3EBF07BE3 +:090C01000090E6B4EAF0020DFCDB +:0E0C0A0090E6BAE0FA90E07CE0FBC3EA9B4083 +:070C18000612096B020DFC3E +:0C0C1F0090E6BAE0FA75F002A4247DF51E +:0C0C2B008274E035F0F583E0FAA3E0FBF2 +:0E0C370090E6B3F07B0090E6B4EAF0020DFC0C +:060C450012096B020DFC18 +:0D0C4B0090E6B8E0FA53021FBA0002800ADA +:050C5800BA0102801C3E +:050C5D00BA0266802CC4 +:0E0C620090E7407401F090E741E4F090E68ADC +:090C7000F090E68B7402F0805054 +:0E0C790090E740E4F090E741F090E68AF090BA +:070C8700E68B7402F0803BD4 +:0E0C8E0090E6BCE0FAF582120AA9E582602524 +:0E0C9C0090E6BCE0FAF582120AC8E0FA5302B4 +:0E0CAA000190E740EAF090E741E4F090E68A1E +:090CB800F090E68B7402F0800854 +:050CC10012096B800325 +:030CC60012096BA5 +:060CC90012096B020DFC94 +:0C0CCF0090E6B9E0FA24F45003020DF99D +:070CDB00EA2A2A900CE273E3 +:070CE200020DF9020D1802DA +:060CE9000DAB020D8C02B0 +:060CEF000DF9020DF902EF +:060CF5000DF9020DF902E9 +:060CFB000DF9020D0602D6 +:050D01000DF9020D0FC9 +:090D060090E6BAE0F516020DFCBE +:090D0F0090E6BAE0F517020DFCB4 +:0D0D180090E6B8E0FA53021FBA0002800511 +:050D2500BA025E800A25 +:0A0D2A0090E6BAE012096B020DFC1E +:0E0D340090E6BAE0704690E6BCE0FAF5821256 +:0E0D42000AA9E582603890E6BCE0FAF582125C +:0E0D50000AC8AA82AB8390E6BCE0FCF582C024 +:0E0D5E0002C003120AC8D003D002E0FC530406 +:0E0D6C00FE8A828B83ECF090E6BCE0FAF58202 +:060D7A00120974020DFCD9 +:060D800012096B020DFCDC +:060D860012096B020DFCD6 +:0E0D8C0090E6B8E0FA53021FBA006590E6BA8E +:070D9A00E0FABA0102800536 +:050DA100BA02028056B9 +:050DA60012096B8051F1 +:090DAB0090E6BAE0FA6002804013 +:0E0DB40090E6BCE0FAF582120AA9E582602DF5 +:0E0DC20090E6BCE0FAF582120AC8AA82AB8362 +:0E0DD00090E6BCE0FCF582C002C003120AC827 +:0E0DDE00D003D002E0FC4304018A828B83EC38 +:030DEC00F0800D87 +:050DEF0012096B8008F1 +:050DF40012096B8003F1 +:030DF90012096B71 +:090DFC0090E6A0E0FA4480F02228 +:050E0500AA82BA0300FF +:070E0A004005EA249C5001A1 +:010E110022BE +:090E1200740F5AFBBB03028007B8 +:070E1B00740F5AFBBB0B45ED +:0A0E2200A2AF9202C2AFEA2400F56D +:0C0E2C0082E43400F5837402F07B007453 +:0C0E3800012AFCE43BFDEC2400F582EDF7 +:0A0E44003400F583E522FCF074028F +:0C0E4E002AFAE43BFBEA2400F582EB34B6 +:0A0E5A0000F583AA217B00EAF0A254 +:030E64000292AF48 +:010E67002268 +:050E6800AA82BA00009F +:070E6D004005EA2483500157 +:010E7400225B +:060E7500EA5403600122B3 +:0A0E7B00A2AF9203C2AFEA2400F513 +:0C0E850082E43401F5837402F07B0074F9 +:0C0E9100012AFCE43BFDEC2400F582ED9E +:0A0E9D003401F583E522FCF0740235 +:0C0EA7002AFAE43BFBEA2400F582EB345D +:0A0EB30001F583AA217B00EAF0A2FA +:040EBD000392AF22CB +:050EC100AA82BA8000C6 +:070EC6004005EA244B500136 +:010ECD002202 +:060ECE00EA54036001225A +:0A0ED400A2AF9204C2AFEA2480F539 +:0C0EDE0082E43400F5837402F07B0074A1 +:0C0EEA00012AFCE43BFDEC2480F582EDC5 +:0A0EF6003400F583E522FCF07402DD +:0C0F00002AFAE43BFBEA2480F582EB3483 +:0A0F0C0000F583AA217B00EAF0A2A1 +:040F16000492AF2270 +:080F1A00C2E8C2EA752100756E +:060F22002201758243125A +:040F28000E0575211C +:030F2C00807522AB +:0C0F2F0000758253120E050090E650E49D +:0E0F3B00F00090E652E4F00090E654E4F0007E +:0E0F490090E656E4F00090E65174FFF0009040 +:0E0F5700E65374FFF00090E65574FFF0009032 +:0E0F6500E65774FFF00090E658E4F090E6596D +:0E0F730074FFF090E65AE4F090E65B74FFF035 +:0E0F810090E65CE4F090E65D74FFF090E65EB2 +:0E0F8F00E4F090E65F74FFF00090E660E4F09E +:0D0F9D000090E66174FFF090E662E4F090D1 +:0E0FAA00E66374FFF090E665E4F090E668748C +:0A0FB8000BF05391AFD2E8D2EA2209 +:010FC200220C +:020FC300AA8200 +:060FC500120FC2DAFB224C +:030FCB0090FB5048 +:080FCE00A3E582458370F922BE +:040FD600AA82AB83BD +:080FDA00120FCB1ABAFF011B34 +:050FE200EA4B70F4224F +:030FF300758122E3 +:0A0FF600120949E582600302018040 +:00000001FF diff --git a/usrp/gn3s_firmware.iic b/usrp/gn3s_firmware.iic new file mode 100644 index 0000000..69c290d Binary files /dev/null and b/usrp/gn3s_firmware.iic differ diff --git a/usrp/gps-usrp.cpp b/usrp/gps-usrp.cpp index 23f362c..d945222 100644 --- a/usrp/gps-usrp.cpp +++ b/usrp/gps-usrp.cpp @@ -44,8 +44,8 @@ typedef struct _options #define BYTES_PER_READ (SAMPS_PER_READ*4) #define READ (0) #define WRITE (1) -#define F_L1 (1.57542e9 - 160000) -#define F_L2 (1.2276e9 - 160000) +#define F_L1 (1.57542e9 - 38400) +#define F_L2 (1.2276e9 - 38400) #define FIFO_SIZE (4000) //!< 2 seconds deep? /*----------------------------------------------------------------------------------------------*/ diff --git a/usrp/install_gn3s.sh b/usrp/install_gn3s.sh new file mode 100644 index 0000000..f11ed1d --- /dev/null +++ b/usrp/install_gn3s.sh @@ -0,0 +1,10 @@ +sudo addgroup gn3s +sudo usermod -G gn3s -a $USERNAME +echo 'ACTION=="add", BUS=="usb", SYSFS{idVendor}=="1781", SYSFS{idProduct}=="0b39", GROUP:="gn3s", MODE:="0777"' > tmp1 +echo 'ACTION=="add", BUS=="usb", SYSFS{idVendor}=="16c0", SYSFS{idProduct}=="072f", GROUP:="gn3s", MODE:="0777"' > tmp2 +cat tmp1 tmp2 > tmpfile +sudo chown root.root tmpfile +sudo mv tmpfile /etc/udev/rules.d/10-gn3s.rules +sudo /etc/init.d/udev stop +sudo /etc/init.d/udev start +ls -lR /dev/bus/usb | grep gn3s \ No newline at end of file