diff --git a/app/rtkrcv/gcc/makefile b/app/rtkrcv/gcc/makefile index bdc987579..f615d7069 100644 --- a/app/rtkrcv/gcc/makefile +++ b/app/rtkrcv/gcc/makefile @@ -14,7 +14,7 @@ all : rtkrcv rtkrcv : rtkrcv.o rtkcmn.o rtksvr.o rtkpos.o geoid.o solution.o lambda.o rtkrcv : sbas.o stream.o rcvraw.o rtcm.o preceph.o options.o pntpos.o ppp.o ppp_ar.o rtkrcv : novatel.o ublox.o ss2.o crescent.o skytraq.o gw10.o javad.o nvs.o binex.o -rtkrcv : rt17.o ephemeris.o rinex.o ionex.o rtcm2.o rtcm3.o rtcm3e.o qzslex.o +rtkrcv : rt17.o ephemeris.o rinex.o ionex.o rtcm2.o rtcm3.o rtcm3e.o qzslex.o spi.o rtkrcv.o : ../rtkrcv.c $(CC) -c $(CFLAGS) ../rtkrcv.c @@ -83,6 +83,9 @@ ionex.o : $(SRC)/ionex.c qzslex.o : $(SRC)/qzslex.c $(CC) -c $(CFLAGS) $(SRC)/qzslex.c +spi.o : $(SRC)/spi.c + $(CC) -c $(CFLAGS) $(SRC)/spi.c + rtkrcv.o : $(SRC)/rtklib.h rtkcmn.o : $(SRC)/rtklib.h rtksvr.o : $(SRC)/rtklib.h diff --git a/app/rtkrcv/gcc/rtkrcv.conf b/app/rtkrcv/gcc/rtkrcv.conf index cabe22f70..3f2e0f5ce 100644 --- a/app/rtkrcv/gcc/rtkrcv.conf +++ b/app/rtkrcv/gcc/rtkrcv.conf @@ -4,9 +4,9 @@ console-passwd =admin console-timetype =gpst # (0:gpst,1:utc,2:jst,3:tow) console-soltype =dms # (0:dms,1:deg,2:xyz,3:enu,4:pyl) console-solflag =1 # (0:off,1:std+2:age/ratio/ns) -inpstr1-type =serial # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,7:ntripcli,8:ftp,9:http) -inpstr2-type =serial # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,7:ntripcli,8:ftp,9:http) -inpstr3-type =ftp # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,7:ntripcli,8:ftp,9:http) +inpstr1-type =serial # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,7:ntripcli,8:ftp,9:http,10:spi) +inpstr2-type =serial # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,7:ntripcli,8:ftp,9:http,10:spi) +inpstr3-type =ftp # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,7:ntripcli,8:ftp,9:http,10:spi) inpstr1-path =ttyS0:115200:8:n:1:off inpstr2-path =ttyS1:115200:8:n:1:off inpstr3-path =anonymous:passwd@cddis.gsfc.nasa.gov/gps/products/%W/igu%W%D_%hb.sp3.Z::T=-14400,21600,7200,600 diff --git a/app/rtkrcv/rtkrcv.c b/app/rtkrcv/rtkrcv.c index 6e8e3733c..839ff8678 100644 --- a/app/rtkrcv/rtkrcv.c +++ b/app/rtkrcv/rtkrcv.c @@ -185,7 +185,7 @@ static const char *pathopts[]={ /* path options help */ #define TIMOPT "0:gpst,1:utc,2:jst,3:tow" #define CONOPT "0:dms,1:deg,2:xyz,3:enu,4:pyl" #define FLGOPT "0:off,1:std+2:age/ratio/ns" -#define ISTOPT "0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,7:ntripcli,8:ftp,9:http" +#define ISTOPT "0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,7:ntripcli,8:ftp,9:http,10:spi" #define OSTOPT "0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,6:ntripsvr" #define FMTOPT "0:rtcm2,1:rtcm3,2:oem4,3:oem3,4:ubx,5:ss2,6:hemis,7:skytraq,8:gw10,9:javad,10:nvs,11:binex,12:rt17,15:sp3" #define NMEOPT "0:off,1:latlon,2:single" diff --git a/app/str2str/gcc/makefile b/app/str2str/gcc/makefile index ffb232f5b..2b432d222 100644 --- a/app/str2str/gcc/makefile +++ b/app/str2str/gcc/makefile @@ -14,7 +14,7 @@ LDLIBS = -lm -lrt -lpthread all : str2str str2str : str2str.o stream.o rtkcmn.o solution.o sbas.o geoid.o str2str : rcvraw.o novatel.o ublox.o ss2.o crescent.o skytraq.o gw10.o javad.o -str2str : nvs.o binex.o rt17.o rtcm.o rtcm2.o rtcm3.o rtcm3e.o preceph.o streamsvr.o +str2str : nvs.o binex.o rt17.o rtcm.o rtcm2.o rtcm3.o rtcm3e.o preceph.o streamsvr.o spi.o str2str.o : ../str2str.c $(CC) -c $(CFLAGS) ../str2str.c @@ -62,6 +62,9 @@ rtcm3e.o : $(SRC)/rtcm3e.c $(CC) -c $(CFLAGS) $(SRC)/rtcm3e.c preceph.o : $(SRC)/preceph.c $(CC) -c $(CFLAGS) $(SRC)/preceph.c +spi.o : $(SRC)/spi.c + $(CC) -c $(CFLAGS) $(SRC)/spi.c + str2str.o : $(SRC)/rtklib.h stream.o : $(SRC)/rtklib.h @@ -86,6 +89,7 @@ rtcm2.o : $(SRC)/rtklib.h rtcm3.o : $(SRC)/rtklib.h rtcm3e.o : $(SRC)/rtklib.h preceph.o : $(SRC)/rtklib.h +spi.o : $(SRC)/rtklib.h install: cp str2str $(BINDIR) diff --git a/app/str2str/str2str.c b/app/str2str/str2str.c index f24849b50..1f80f6c40 100644 --- a/app/str2str/str2str.c +++ b/app/str2str/str2str.c @@ -146,6 +146,7 @@ static int decodepath(const char *path, int *type, char *strpath, int *fmt) else if (!strncmp(path,"ntrips",6)) *type=STR_NTRIPSVR; else if (!strncmp(path,"ntrip", 5)) *type=STR_NTRIPCLI; else if (!strncmp(path,"file", 4)) *type=STR_FILE; + else if (!strncmp(path,"spi", 3)) *type=STR_SPI; else { fprintf(stderr,"stream path error: %s\n",buff); return 0; diff --git a/bin-rpi/convbin b/bin-rpi/convbin new file mode 100755 index 000000000..fe9ac8a0d Binary files /dev/null and b/bin-rpi/convbin differ diff --git a/bin-rpi/opts1.conf b/bin-rpi/opts1.conf new file mode 100644 index 000000000..c97fa8d39 --- /dev/null +++ b/bin-rpi/opts1.conf @@ -0,0 +1,84 @@ +# rtkpost options (2010/08/07 09:24:29, v.2.4.0) + +#pos1-posmode =kinematic # (0:single,1:dgps,2:kinematic,3:static,4:movingbase,5:fixed,6:ppp-kine,7:ppp-static) +pos1-posmode =static # (0:single,1:dgps,2:kinematic,3:static,4:movingbase,5:fixed,6:ppp-kine,7:ppp-static) +pos1-frequency =l1+l2 # (1:l1,2:l1+l2,3:l1+l2+l5) +pos1-soltype =forward # (0:forward,1:backward,2:combined) +pos1-elmask =10 # (deg) +pos1-snrmask =0 # (dBHz) +pos1-dynamics =off # (0:off,1:on) +pos1-tidecorr =off # (0:off,1:on) +pos1-ionoopt =brdc # (0:off,1:brdc,2:sbas,3:dual-freq,4:est-stec) +pos1-tropopt =saas # (0:off,1:saas,2:sbas,3:est-ztd,4:est-ztdgrad) +pos1-sateph =brdc # (0:brdc,1:precise,2:brdc+sbas,3:brdc+ssrapc,4:brdc+ssrcom) +pos1-exclsats = # (prn ...) +pos1-navsys =1 # (1:gps+2:sbas+4:glo+8:gal+16:qzs+32:comp) +pos2-armode =fix-and-hold # (0:off,1:continous,2:instantaneous,3:fix-and-hold) +pos2-gloarmode =on # (0:off,1:on,2:autocal) +pos2-arthres =5 +pos2-arlockcnt =0 +pos2-arelmask =0 # (deg) +pos2-aroutcnt =5 +pos2-arminfix =10 +pos2-slipthres =0.05 # (m) +pos2-maxage =30 # (s) +pos2-rejionno =30 # (m) +pos2-niter =1 +pos2-baselen =0 # (m) +pos2-basesig =0 # (m) +out-solformat =llh # (0:llh,1:xyz,2:enu,3:nmea) +out-outhead =on # (0:off,1:on) +out-outopt =on # (0:off,1:on) +out-timesys =gpst # (0:gpst,1:utc,2:jst) +out-timeform =hms # (0:tow,1:hms) +out-timendec =3 +out-degform =deg # (0:deg,1:dms) +out-fieldsep = +out-height =ellipsoidal # (0:ellipsoidal,1:geodetic) +out-geoid =internal # (0:internal,1:egm96,2:egm08_2.5,3:egm08_1,4:gsi2000) +#out-solstatic =all # (0:all,1:single) +out-solstatic =single # (0:all,1:single) +out-nmeaintv1 =0 # (s) +out-nmeaintv2 =0 # (s) +out-outstat =off # (0:off,1:state,2:residual) +stats-errratio =100 +stats-errphase =0.003 # (m) +stats-errphaseel =0.003 # (m) +stats-errphasebl =0 # (m/10km) +stats-errdoppler =10 # (Hz) +stats-stdbias =30 # (m) +stats-stdiono =0.03 # (m) +stats-stdtrop =0.3 # (m) +stats-prnaccelh =1 # (m/s^2) +stats-prnaccelv =0.1 # (m/s^2) +stats-prnbias =0.0001 # (m) +stats-prniono =0.001 # (m) +stats-prntrop =0.0001 # (m) +stats-clkstab =5e-12 # (s/s) +ant1-postype =llh # (0:llh,1:xyz,2:single,3:posfile,4:rinexhead,5:rtcm) +ant1-pos1 =0 # (deg|m) +ant1-pos2 =0 # (deg|m) +ant1-pos3 =0 # (m|m) +ant1-anttype =* +ant1-antdele =0 # (m) +ant1-antdeln =0 # (m) +ant1-antdelu =0 # (m) +ant2-postype =single # (0:llh,1:xyz,2:single,3:posfile,4:rinexhead,5:rtcm) +ant2-pos1 =0 # (deg|m) +ant2-pos2 =0 # (deg|m) +ant2-pos3 =0 # (m|m) +ant2-anttype =* +ant2-antdele =0 # (m) +ant2-antdeln =0 # (m) +ant2-antdelu =0 # (m) +misc-timeinterp =on # (0:off,1:on) +misc-sbasatsel =0 # (0:all) +file-satantfile =../../../data/igs05.atx +file-rcvantfile =../../../data/igs05.atx +file-staposfile =../../../data/stations.pos +file-geoidfile = +file-dcbfile =../../../data/P1C1_ALL.DCB +file-tempdir = +file-geexefile = +file-solstatfile = +file-tracefile = diff --git a/bin-rpi/opts2.conf b/bin-rpi/opts2.conf new file mode 100644 index 000000000..9a26cfff1 --- /dev/null +++ b/bin-rpi/opts2.conf @@ -0,0 +1,82 @@ +# rtkpost options (2010/08/07 09:24:41, v.2.4.0) + +pos1-posmode =kinematic # (0:single,1:dgps,2:kinematic,3:static,4:movingbase,5:fixed,6:ppp-kine,7:ppp-static) +pos1-frequency =l1+l2 # (1:l1,2:l1+l2,3:l1+l2+l5) +pos1-soltype =combined # (0:forward,1:backward,2:combined) +pos1-elmask =10 # (deg) +pos1-snrmask =20 # (dBHz) +pos1-dynamics =off # (0:off,1:on) +pos1-tidecorr =off # (0:off,1:on) +pos1-ionoopt =brdc # (0:off,1:brdc,2:sbas,3:dual-freq,4:est-stec) +pos1-tropopt =saas # (0:off,1:saas,2:sbas,3:est-ztd,4:est-ztdgrad) +pos1-sateph =brdc # (0:brdc,1:precise,2:brdc+sbas,3:brdc+ssrapc,4:brdc+ssrcom) +pos1-exclsats = # (prn ...) +pos1-navsys =1 # (1:gps+2:sbas+4:glo+8:gal+16:qzs+32:comp) +pos2-armode =continuous # (0:off,1:continuous,2:instantaneous,3:fix-and-hold) +pos2-gloarmode =on # (0:off,1:on,2:autocal) +pos2-arthres =3 +pos2-arlockcnt =5 +pos2-arelmask =0 # (deg) +pos2-aroutcnt =5 +pos2-arminfix =10 +pos2-slipthres =0.05 # (m) +pos2-maxage =30 # (s) +pos2-rejionno =30 # (m) +pos2-niter =1 +pos2-baselen =0 # (m) +pos2-basesig =0 # (m) +out-solformat =llh # (0:llh,1:xyz,2:enu,3:nmea) +out-outhead =on # (0:off,1:on) +out-outopt =on # (0:off,1:on) +out-timesys =gpst # (0:gpst,1:utc,2:jst) +out-timeform =hms # (0:tow,1:hms) +out-timendec =3 +out-degform =deg # (0:deg,1:dms) +out-fieldsep = +out-height =ellipsoidal # (0:ellipsoidal,1:geodetic) +out-geoid =internal # (0:internal,1:egm96,2:egm08_2.5,3:egm08_1,4:gsi2000) +out-solstatic =all # (0:all,1:single) +out-nmeaintv1 =0 # (s) +out-nmeaintv2 =0 # (s) +out-outstat =off # (0:off,1:state,2:residual) +stats-errratio =100 +stats-errphase =0.003 # (m) +stats-errphaseel =0.003 # (m) +stats-errphasebl =0 # (m/10km) +stats-errdoppler =10 # (Hz) +stats-stdbias =30 # (m) +stats-stdiono =0.03 # (m) +stats-stdtrop =0.3 # (m) +stats-prnaccelh =1 # (m/s^2) +stats-prnaccelv =0.1 # (m/s^2) +stats-prnbias =0.0001 # (m) +stats-prniono =0.001 # (m) +stats-prntrop =0.0001 # (m) +stats-clkstab =5e-12 # (s/s) +ant1-postype =llh # (0:llh,1:xyz,2:single,3:posfile,4:rinexhead,5:rtcm) +ant1-pos1 =0 # (deg|m) +ant1-pos2 =0 # (deg|m) +ant1-pos3 =0 # (m|m) +ant1-anttype =* +ant1-antdele =0 # (m) +ant1-antdeln =0 # (m) +ant1-antdelu =0 # (m) +ant2-postype =llh # (0:llh,1:xyz,2:single,3:posfile,4:rinexhead,5:rtcm) +ant2-pos1 =35.1320570679997 # (deg|m) +ant2-pos2 =139.624306577 # (deg|m) +ant2-pos3 =73.907699999947 # (m|m) +ant2-anttype =* +ant2-antdele =0 # (m) +ant2-antdeln =0 # (m) +ant2-antdelu =0 # (m) +misc-timeinterp =on # (0:off,1:on) +misc-sbasatsel =0 # (0:all) +file-satantfile =../../../data/igs05.atx +file-rcvantfile =../../../data/igs05.atx +file-staposfile =../../../data/stations.pos +file-geoidfile = +file-dcbfile =../../../data/P1C1_ALL.DCB +file-tempdir = +file-geexefile = +file-solstatfile = +file-tracefile = diff --git a/bin-rpi/opts3.conf b/bin-rpi/opts3.conf new file mode 100644 index 000000000..8c6ae2d2a --- /dev/null +++ b/bin-rpi/opts3.conf @@ -0,0 +1,82 @@ +# rtkpost options (2010/08/07 09:24:53, v.2.4.0) + +pos1-posmode =kinematic # (0:single,1:dgps,2:kinematic,3:static,4:movingbase,5:fixed,6:ppp-kine,7:ppp-static) +pos1-frequency =l1+l2 # (1:l1,2:l1+l2,3:l1+l2+l5) +pos1-soltype =forward # (0:forward,1:backward,2:combined) +pos1-elmask =15 # (deg) +pos1-snrmask =0 # (dBHz) +pos1-dynamics =off # (0:off,1:on) +pos1-tidecorr =off # (0:off,1:on) +pos1-ionoopt =brdc # (0:off,1:brdc,2:sbas,3:dual-freq,4:est-stec) +pos1-tropopt =saas # (0:off,1:saas,2:sbas,3:est-ztd,4:est-ztdgrad) +pos1-sateph =brdc # (0:brdc,1:precise,2:brdc+sbas,3:brdc+ssrapc,4:brdc+ssrcom) +pos1-exclsats = # (prn ...) +pos1-navsys =1 # (1:gps+2:sbas+4:glo+8:gal+16:qzs+32:comp) +pos2-armode =fix-and-hold # (0:off,1:continous,2:instantaneous,3:fix-and-hold) +pos2-gloarmode =on # (0:off,1:on,2:autocal) +pos2-arthres =3 +pos2-arlockcnt =5 +pos2-arelmask =0 # (deg) +pos2-aroutcnt =5 +pos2-arminfix =10 +pos2-slipthres =0.05 # (m) +pos2-maxage =30 # (s) +pos2-rejionno =30 # (m) +pos2-niter =1 +pos2-baselen =0 # (m) +pos2-basesig =0 # (m) +out-solformat =llh # (0:llh,1:xyz,2:enu,3:nmea) +out-outhead =on # (0:off,1:on) +out-outopt =on # (0:off,1:on) +out-timesys =gpst # (0:gpst,1:utc,2:jst) +out-timeform =hms # (0:tow,1:hms) +out-timendec =9 +out-degform =dms # (0:deg,1:dms) +out-fieldsep = +out-height =geodetic # (0:ellipsoidal,1:geodetic) +out-geoid =internal # (0:internal,1:egm96,2:egm08_2.5,3:egm08_1,4:gsi2000) +out-solstatic =all # (0:all,1:single) +out-nmeaintv1 =0 # (s) +out-nmeaintv2 =0 # (s) +out-outstat =off # (0:off,1:state,2:residual) +stats-errratio =100 +stats-errphase =0.003 # (m) +stats-errphaseel =0.003 # (m) +stats-errphasebl =0 # (m/10km) +stats-errdoppler =10 # (Hz) +stats-stdbias =30 # (m) +stats-stdiono =0.03 # (m) +stats-stdtrop =0.3 # (m) +stats-prnaccelh =1 # (m/s^2) +stats-prnaccelv =0.1 # (m/s^2) +stats-prnbias =0.0001 # (m) +stats-prniono =0.001 # (m) +stats-prntrop =0.0001 # (m) +stats-clkstab =5e-12 # (s/s) +ant1-postype =llh # (0:llh,1:xyz,2:single,3:posfile,4:rinexhead,5:rtcm) +ant1-pos1 =0 # (deg|m) +ant1-pos2 =0 # (deg|m) +ant1-pos3 =0 # (m|m) +ant1-anttype =* +ant1-antdele =0 # (m) +ant1-antdeln =0 # (m) +ant1-antdelu =0 # (m) +ant2-postype =llh # (0:llh,1:xyz,2:single,3:posfile,4:rinexhead,5:rtcm) +ant2-pos1 =35.1320570679997 # (deg|m) +ant2-pos2 =139.624306577 # (deg|m) +ant2-pos3 =73.907699999947 # (m|m) +ant2-anttype =* +ant2-antdele =0 # (m) +ant2-antdeln =0 # (m) +ant2-antdelu =0 # (m) +misc-timeinterp =on # (0:off,1:on) +misc-sbasatsel =0 # (0:all) +file-satantfile =../../../data/igs05.atx +file-rcvantfile =../../../data/igs05.atx +file-staposfile =../../../data/stations.pos +file-geoidfile = +file-dcbfile =../../../data/P1C1_ALL.DCB +file-tempdir = +file-geexefile = +file-solstatfile = +file-tracefile = diff --git a/bin-rpi/opts4.conf b/bin-rpi/opts4.conf new file mode 100644 index 000000000..71e571b6d --- /dev/null +++ b/bin-rpi/opts4.conf @@ -0,0 +1,82 @@ +# rtkpost options (2010/08/07 09:24:53, v.2.4.0) + +pos1-posmode =static # (0:single,1:dgps,2:kinematic,3:static,4:movingbase,5:fixed,6:ppp-kine,7:ppp-static) +pos1-frequency =l1+l2 # (1:l1,2:l1+l2,3:l1+l2+l5) +pos1-soltype =combined # (0:forward,1:backward,2:combined) +pos1-elmask =15 # (deg) +pos1-snrmask =0 # (dBHz) +pos1-dynamics =off # (0:off,1:on) +pos1-tidecorr =off # (0:off,1:on) +pos1-ionoopt =brdc # (0:off,1:brdc,2:sbas,3:dual-freq,4:est-stec) +pos1-tropopt =saas # (0:off,1:saas,2:sbas,3:est-ztd,4:est-ztdgrad) +pos1-sateph =brdc # (0:brdc,1:precise,2:brdc+sbas,3:brdc+ssrapc,4:brdc+ssrcom) +pos1-exclsats = # (prn ...) +pos1-navsys =1 # (1:gps+2:sbas+4:glo+8:gal+16:qzs+32:comp) +pos2-armode =fix-and-hold # (0:off,1:continous,2:instantaneous,3:fix-and-hold) +pos2-gloarmode =on # (0:off,1:on,2:autocal) +pos2-arthres =3 +pos2-arlockcnt =5 +pos2-arelmask =0 # (deg) +pos2-aroutcnt =5 +pos2-arminfix =10 +pos2-slipthres =0.05 # (m) +pos2-maxage =30 # (s) +pos2-rejionno =30 # (m) +pos2-niter =1 +pos2-baselen =0 # (m) +pos2-basesig =0 # (m) +out-solformat =llh # (0:llh,1:xyz,2:enu,3:nmea) +out-outhead =on # (0:off,1:on) +out-outopt =on # (0:off,1:on) +out-timesys =gpst # (0:gpst,1:utc,2:jst) +out-timeform =hms # (0:tow,1:hms) +out-timendec =9 +out-degform =dms # (0:deg,1:dms) +out-fieldsep = +out-height =geodetic # (0:ellipsoidal,1:geodetic) +out-geoid =internal # (0:internal,1:egm96,2:egm08_2.5,3:egm08_1,4:gsi2000) +out-solstatic =single # (0:all,1:single) +out-nmeaintv1 =0 # (s) +out-nmeaintv2 =0 # (s) +out-outstat =off # (0:off,1:state,2:residual) +stats-errratio =100 +stats-errphase =0.003 # (m) +stats-errphaseel =0.003 # (m) +stats-errphasebl =0 # (m/10km) +stats-errdoppler =10 # (Hz) +stats-stdbias =30 # (m) +stats-stdiono =0.03 # (m) +stats-stdtrop =0.3 # (m) +stats-prnaccelh =1 # (m/s^2) +stats-prnaccelv =0.1 # (m/s^2) +stats-prnbias =0.0001 # (m) +stats-prniono =0.001 # (m) +stats-prntrop =0.0001 # (m) +stats-clkstab =5e-12 # (s/s) +ant1-postype =llh # (0:llh,1:xyz,2:single,3:posfile,4:rinexhead,5:rtcm) +ant1-pos1 =0 # (deg|m) +ant1-pos2 =0 # (deg|m) +ant1-pos3 =0 # (m|m) +ant1-anttype =* +ant1-antdele =0 # (m) +ant1-antdeln =0 # (m) +ant1-antdelu =0 # (m) +ant2-postype =llh # (0:llh,1:xyz,2:single,3:posfile,4:rinexhead,5:rtcm) +ant2-pos1 =35.1320570679997 # (deg|m) +ant2-pos2 =139.624306577 # (deg|m) +ant2-pos3 =73.907699999947 # (m|m) +ant2-anttype =* +ant2-antdele =0 # (m) +ant2-antdeln =0 # (m) +ant2-antdelu =0 # (m) +misc-timeinterp =on # (0:off,1:on) +misc-sbasatsel =0 # (0:all) +file-satantfile =../../../data/igs05.atx +file-rcvantfile =../../../data/igs05.atx +file-staposfile =../../../data/stations.pos +file-geoidfile = +file-dcbfile =../../../data/P1C1_ALL.DCB +file-tempdir = +file-geexefile = +file-solstatfile = +file-tracefile = diff --git a/bin-rpi/rnx2rtkp b/bin-rpi/rnx2rtkp new file mode 100755 index 000000000..6cbd76618 Binary files /dev/null and b/bin-rpi/rnx2rtkp differ diff --git a/bin-rpi/rover-single.conf b/bin-rpi/rover-single.conf new file mode 100644 index 000000000..9be6bf74a --- /dev/null +++ b/bin-rpi/rover-single.conf @@ -0,0 +1,121 @@ +# rtkrcv options (2010/08/12 07:12:16, v.2.4.0) + +console-passwd =admin +console-timetype =gpst # (0:gpst,1:utc,2:jst,3:tow) +console-soltype =dms # (0:dms,1:deg,2:xyz,3:enu,4:pyl) +console-solflag =1 # (0:off,1:std+2:age/ratio/ns) +inpstr1-type =spi # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,7:ntripcli,8:ftp,9:http,10:spi) +inpstr2-type =off # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,7:ntripcli,8:ftp,9:http,10:spi) +inpstr3-type =off # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,7:ntripcli,8:ftp,9:http,10:spi) +inpstr1-path =/dev/spidev0.0 +inpstr2-path = +inpstr3-path = +inpstr1-format =ubx # (0:rtcm2,1:rtcm3,2:oem4,3:oem3,4:ubx,5:ss2,6:hemis,7:skytraq,14:sp3) +inpstr2-format =rtcm2 # (0:rtcm2,1:rtcm3,2:oem4,3:oem3,4:ubx,5:ss2,6:hemis,7:skytraq,14:sp3) +inpstr3-format =rtcm2 # (0:rtcm2,1:rtcm3,2:oem4,3:oem3,4:ubx,5:ss2,6:hemis,7:skytraq,14:sp3) +inpstr2-nmeareq =off # (0:off,1:latlon,2:single) +inpstr2-nmealat =0 # (deg) +inpstr2-nmealon =0 # (deg) +outstr1-type =off # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,6:ntripsvr) +outstr2-type =off # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,6:ntripsvr) +outstr1-path =sol1_%Y%m%d%h%M.pos +outstr2-path =sol2_%Y%m%d%h%M.pos +outstr1-format =llh # (0:llh,1:xyz,2:enu,3:nmea) +outstr2-format =nmea # (0:llh,1:xyz,2:enu,3:nmea) +logstr1-type =off # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,6:ntripsvr) +logstr2-type =off # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,6:ntripsvr) +logstr3-type =off # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,6:ntripsvr) +logstr1-path =rov_%Y%m%d%h%M.log +logstr2-path =ref_%Y%m%d%h%M.log +logstr3-path =cor_%Y%m%d%h%M.log +misc-svrcycle =10 # (ms) +misc-timeout =30000 # (ms) +misc-reconnect =30000 # (ms) +misc-nmeacycle =5000 # (ms) +misc-buffsize =32768 # (bytes) +misc-navmsgsel =rover # (0:all,1:rover,1:base,2:corr) +misc-startcmd = +misc-stopcmd = +file-cmdfile1 =../data/ubx_spi_raw_5hz.cmd +file-cmdfile2 = +file-cmdfile3 = +pos1-posmode =single # (0:single,1:dgps,2:kinematic,3:static,4:movingbase,5:fixed,6:ppp-kine,7:ppp-static) +pos1-frequency =l1 # (1:l1,2:l1+l2,3:l1+l2+l5) +pos1-soltype =forward # (0:forward,1:backward,2:combined) +pos1-elmask =15 # (deg) +pos1-snrmask =0 # (dBHz) +pos1-dynamics =off # (0:off,1:on) +pos1-tidecorr =off # (0:off,1:on) +pos1-ionoopt =brdc # (0:off,1:brdc,2:sbas,3:dual-freq,4:est-stec) +pos1-tropopt =saas # (0:off,1:saas,2:sbas,3:est-ztd,4:est-ztdgrad) +pos1-sateph =brdc # (0:brdc,1:precise,2:brdc+sbas,3:brdc+ssrapc,4:brdc+ssrcom) +pos1-exclsats = # (prn ...) +pos1-navsys =1 # (1:gps+2:sbas+4:glo+8:gal+16:qzs+32:comp) +pos2-armode =off # (0:off,1:continuous,2:instantaneous,3:fix-and-hold) +pos2-gloarmode =off # (0:off,1:on,2:autocal) +pos2-arthres =5 +pos2-arlockcnt =0 +pos2-arelmask =0 # (deg) +pos2-aroutcnt =5 +pos2-arminfix =10 +pos2-slipthres =0.05 # (m) +pos2-maxage =30 # (s) +pos2-rejionno =30 # (m) +pos2-niter =1 +pos2-baselen =0 # (m) +pos2-basesig =0 # (m) +out-solformat =llh # (0:llh,1:xyz,2:enu,3:nmea) +out-outhead =on # (0:off,1:on) +out-outopt =off # (0:off,1:on) +out-timesys =gpst # (0:gpst,1:utc,2:jst) +out-timeform =tow # (0:tow,1:hms) +out-timendec =3 +out-degform =deg # (0:deg,1:dms) +out-fieldsep = +out-height =ellipsoidal # (0:ellipsoidal,1:geodetic) +out-geoid =internal # (0:internal,1:egm96,2:egm08_2.5,3:egm08_1,4:gsi2000) +out-solstatic =all # (0:all,1:single) +out-nmeaintv1 =0 # (s) +out-nmeaintv2 =0 # (s) +out-outstat =off # (0:off,1:state,2:residual) +stats-errratio =100 +stats-errphase =0.003 # (m) +stats-errphaseel =0.003 # (m) +stats-errphasebl =0 # (m/10km) +stats-errdoppler =1 # (Hz) +stats-stdbias =30 # (m) +stats-stdiono =0.03 # (m) +stats-stdtrop =0.3 # (m) +stats-prnaccelh =1 # (m/s^2) +stats-prnaccelv =0.1 # (m/s^2) +stats-prnbias =0.0001 # (m) +stats-prniono =0.001 # (m) +stats-prntrop =0.0001 # (m) +stats-clkstab =5e-12 # (s/s) +ant1-postype =llh # (0:llh,1:xyz,2:single,3:posfile,4:rinexhead,5:rtcm) +ant1-pos1 =0 # (deg|m) +ant1-pos2 =0 # (deg|m) +ant1-pos3 =0 # (m|m) +ant1-anttype = +ant1-antdele =0 # (m) +ant1-antdeln =0 # (m) +ant1-antdelu =0 # (m) +ant2-postype =llh # (0:llh,1:xyz,2:single,3:posfile,4:rinexhead,5:rtcm) +ant2-pos1 =0 # (deg|m) +ant2-pos2 =0 # (deg|m) +ant2-pos3 =0 # (m|m) +ant2-anttype = +ant2-antdele =0 # (m) +ant2-antdeln =0 # (m) +ant2-antdelu =0 # (m) +misc-timeinterp =off # (0:off,1:on) +misc-sbasatsel =0 # (0:all) +file-satantfile =../data/igs05.atx +file-rcvantfile =../data/igs05.atx +file-staposfile =../data/station.pos +file-geoidfile = +file-dcbfile =../data/P1C1_ALL.DCB +file-tempdir =temp +file-geexefile = +file-solstatfile = +file-tracefile = diff --git a/bin-rpi/rtkrcv b/bin-rpi/rtkrcv new file mode 100755 index 000000000..7dab8afda Binary files /dev/null and b/bin-rpi/rtkrcv differ diff --git a/bin-rpi/rtkrcv.conf b/bin-rpi/rtkrcv.conf new file mode 100644 index 000000000..cabe22f70 --- /dev/null +++ b/bin-rpi/rtkrcv.conf @@ -0,0 +1,121 @@ +# rtkrcv options (2010/08/12 07:12:16, v.2.4.0) + +console-passwd =admin +console-timetype =gpst # (0:gpst,1:utc,2:jst,3:tow) +console-soltype =dms # (0:dms,1:deg,2:xyz,3:enu,4:pyl) +console-solflag =1 # (0:off,1:std+2:age/ratio/ns) +inpstr1-type =serial # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,7:ntripcli,8:ftp,9:http) +inpstr2-type =serial # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,7:ntripcli,8:ftp,9:http) +inpstr3-type =ftp # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,7:ntripcli,8:ftp,9:http) +inpstr1-path =ttyS0:115200:8:n:1:off +inpstr2-path =ttyS1:115200:8:n:1:off +inpstr3-path =anonymous:passwd@cddis.gsfc.nasa.gov/gps/products/%W/igu%W%D_%hb.sp3.Z::T=-14400,21600,7200,600 +inpstr1-format =oem4 # (0:rtcm2,1:rtcm3,2:oem4,3:oem3,4:ubx,5:ss2,6:hemis,7:skytraq,14:sp3) +inpstr2-format =oem4 # (0:rtcm2,1:rtcm3,2:oem4,3:oem3,4:ubx,5:ss2,6:hemis,7:skytraq,14:sp3) +inpstr3-format =sp3 # (0:rtcm2,1:rtcm3,2:oem4,3:oem3,4:ubx,5:ss2,6:hemis,7:skytraq,14:sp3) +inpstr2-nmeareq =off # (0:off,1:latlon,2:single) +inpstr2-nmealat =0 # (deg) +inpstr2-nmealon =0 # (deg) +outstr1-type =off # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,6:ntripsvr) +outstr2-type =off # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,6:ntripsvr) +outstr1-path =sol1_%Y%m%d%h%M.pos +outstr2-path =sol2_%Y%m%d%h%M.pos +outstr1-format =llh # (0:llh,1:xyz,2:enu,3:nmea) +outstr2-format =nmea # (0:llh,1:xyz,2:enu,3:nmea) +logstr1-type =off # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,6:ntripsvr) +logstr2-type =off # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,6:ntripsvr) +logstr3-type =off # (0:off,1:serial,2:file,3:tcpsvr,4:tcpcli,6:ntripsvr) +logstr1-path =rov_%Y%m%d%h%M.log +logstr2-path =ref_%Y%m%d%h%M.log +logstr3-path =cor_%Y%m%d%h%M.log +misc-svrcycle =10 # (ms) +misc-timeout =30000 # (ms) +misc-reconnect =30000 # (ms) +misc-nmeacycle =5000 # (ms) +misc-buffsize =32768 # (bytes) +misc-navmsgsel =rover # (0:all,1:rover,1:base,2:corr) +misc-startcmd =./rtkstart.sh +misc-stopcmd =./rtkshut.sh +file-cmdfile1 =../../../data/oem4_raw_1hz.cmd +file-cmdfile2 =../../../data/oem4_raw_1hz.cmd +file-cmdfile3 = +pos1-posmode =single # (0:single,1:dgps,2:kinematic,3:static,4:movingbase,5:fixed,6:ppp-kine,7:ppp-static) +pos1-frequency =l1 # (1:l1,2:l1+l2,3:l1+l2+l5) +pos1-soltype =forward # (0:forward,1:backward,2:combined) +pos1-elmask =15 # (deg) +pos1-snrmask =0 # (dBHz) +pos1-dynamics =off # (0:off,1:on) +pos1-tidecorr =off # (0:off,1:on) +pos1-ionoopt =brdc # (0:off,1:brdc,2:sbas,3:dual-freq,4:est-stec) +pos1-tropopt =saas # (0:off,1:saas,2:sbas,3:est-ztd,4:est-ztdgrad) +pos1-sateph =precise # (0:brdc,1:precise,2:brdc+sbas,3:brdc+ssrapc,4:brdc+ssrcom) +pos1-exclsats = # (prn ...) +pos1-navsys =1 # (1:gps+2:sbas+4:glo+8:gal+16:qzs+32:comp) +pos2-armode =off # (0:off,1:continuous,2:instantaneous,3:fix-and-hold) +pos2-gloarmode =off # (0:off,1:on,2:autocal) +pos2-arthres =5 +pos2-arlockcnt =0 +pos2-arelmask =0 # (deg) +pos2-aroutcnt =5 +pos2-arminfix =10 +pos2-slipthres =0.05 # (m) +pos2-maxage =30 # (s) +pos2-rejionno =30 # (m) +pos2-niter =1 +pos2-baselen =0 # (m) +pos2-basesig =0 # (m) +out-solformat =llh # (0:llh,1:xyz,2:enu,3:nmea) +out-outhead =on # (0:off,1:on) +out-outopt =off # (0:off,1:on) +out-timesys =gpst # (0:gpst,1:utc,2:jst) +out-timeform =tow # (0:tow,1:hms) +out-timendec =3 +out-degform =deg # (0:deg,1:dms) +out-fieldsep = +out-height =ellipsoidal # (0:ellipsoidal,1:geodetic) +out-geoid =internal # (0:internal,1:egm96,2:egm08_2.5,3:egm08_1,4:gsi2000) +out-solstatic =all # (0:all,1:single) +out-nmeaintv1 =0 # (s) +out-nmeaintv2 =0 # (s) +out-outstat =off # (0:off,1:state,2:residual) +stats-errratio =100 +stats-errphase =0.003 # (m) +stats-errphaseel =0.003 # (m) +stats-errphasebl =0 # (m/10km) +stats-errdoppler =1 # (Hz) +stats-stdbias =30 # (m) +stats-stdiono =0.03 # (m) +stats-stdtrop =0.3 # (m) +stats-prnaccelh =1 # (m/s^2) +stats-prnaccelv =0.1 # (m/s^2) +stats-prnbias =0.0001 # (m) +stats-prniono =0.001 # (m) +stats-prntrop =0.0001 # (m) +stats-clkstab =5e-12 # (s/s) +ant1-postype =llh # (0:llh,1:xyz,2:single,3:posfile,4:rinexhead,5:rtcm) +ant1-pos1 =0 # (deg|m) +ant1-pos2 =0 # (deg|m) +ant1-pos3 =0 # (m|m) +ant1-anttype = +ant1-antdele =0 # (m) +ant1-antdeln =0 # (m) +ant1-antdelu =0 # (m) +ant2-postype =llh # (0:llh,1:xyz,2:single,3:posfile,4:rinexhead,5:rtcm) +ant2-pos1 =0 # (deg|m) +ant2-pos2 =0 # (deg|m) +ant2-pos3 =0 # (m|m) +ant2-anttype = +ant2-antdele =0 # (m) +ant2-antdeln =0 # (m) +ant2-antdelu =0 # (m) +misc-timeinterp =off # (0:off,1:on) +misc-sbasatsel =0 # (0:all) +file-satantfile =../../../data/igs05.atx +file-rcvantfile =../../../data/igs05.atx +file-staposfile =../../../data/station.pos +file-geoidfile = +file-dcbfile =../../../data/P1C1_ALL.DCB +file-tempdir =temp +file-geexefile = +file-solstatfile = +file-tracefile = diff --git a/bin-rpi/rtkshut.sh b/bin-rpi/rtkshut.sh new file mode 100644 index 000000000..0bc65ded7 --- /dev/null +++ b/bin-rpi/rtkshut.sh @@ -0,0 +1,5 @@ +#!/bin/sh +# rtkrcv shutdown script + +echo shutdown script ok + diff --git a/bin-rpi/rtkstart.sh b/bin-rpi/rtkstart.sh new file mode 100644 index 000000000..1aff931bc --- /dev/null +++ b/bin-rpi/rtkstart.sh @@ -0,0 +1,5 @@ +#!/bin/sh +# rtkrcv startup script + +echo statup script ok + diff --git a/bin-rpi/str2str b/bin-rpi/str2str new file mode 100755 index 000000000..caa4ad806 Binary files /dev/null and b/bin-rpi/str2str differ diff --git a/bin-rpi/ublox-spi-to-tcp b/bin-rpi/ublox-spi-to-tcp new file mode 100755 index 000000000..228e69319 Binary files /dev/null and b/bin-rpi/ublox-spi-to-tcp differ diff --git a/data/ubx_spi_raw_5hz.cmd b/data/ubx_spi_raw_5hz.cmd new file mode 100644 index 000000000..77fcb9ecc --- /dev/null +++ b/data/ubx_spi_raw_5hz.cmd @@ -0,0 +1,13 @@ +!UBX CFG-PRT 4 0 0 65286 0 1 1 0 +!UBX CFG-MSG 1 3 0 0 0 0 0 0 +!UBX CFG-MSG 1 3 0 0 0 0 0 0 +!UBX CFG-MSG 1 6 0 0 0 0 0 0 +!UBX CFG-MSG 1 18 0 0 0 0 0 0 +!UBX CFG-MSG 1 34 0 0 0 0 0 0 +!UBX CFG-MSG 1 48 0 0 0 0 0 0 +!UBX CFG-MSG 2 16 0 0 0 0 1 0 +!UBX CFG-MSG 2 17 0 0 0 0 1 0 +!UBX CFG-RATE 200 1 1 + +@ + diff --git a/readme.txt b/readme.txt index 8b58dfdce..19c38afd4 100644 --- a/readme.txt +++ b/readme.txt @@ -104,11 +104,12 @@ ver.2.4.2 and the previous ones. LICENSE The RTKLIB software package is distributed under the following BSD 2-clause -license (http://opensource.org/licenses/BSD-2-Clause). Users are permitted to -develop, produce or sell their own non-commercial or commercial products -utilizing, linking or including RTKLIB as long as they comply with the license. +license (http://opensource.org/licenses/BSD-2-Clause) and additional two +exclusive clauses. Users are permitted to develop, produce or sell their own +non-commercial or commercial products utilizing, linking or including RTKLIB as +long as they comply with the license. - Copyright (c) 2007-2014, T. Takasu, All rights reserved. + Copyright (c) 2007-2013, T. Takasu, All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -203,3 +204,5 @@ HISTORY ver.2.4.2 2013/04/19 see relnotes_2.4.2.htm -------------------------------------------------------------------------------- + +Join the chat at https://gitter.im/nopeppermint/RTKLIB diff --git a/src/rtklib.h b/src/rtklib.h index f042aeffd..f416e896e 100644 --- a/src/rtklib.h +++ b/src/rtklib.h @@ -376,6 +376,7 @@ extern "C" { #define STR_NTRIPCLI 7 /* stream type: NTRIP client */ #define STR_FTP 8 /* stream type: ftp */ #define STR_HTTP 9 /* stream type: http */ +#define STR_SPI 10 /* stream type: spi */ #define STRFMT_RTCM2 0 /* stream format: RTCM 2 */ #define STRFMT_RTCM3 1 /* stream format: RTCM 3 */ diff --git a/src/spi.c b/src/spi.c new file mode 100644 index 000000000..2bd4e2288 --- /dev/null +++ b/src/spi.c @@ -0,0 +1,186 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "spi.h" +#include "rtklib.h" + +#define SPI_IO_DEBUG 0 +#ifdef SPI_IO_DEBUG +#define debug(fmt, args ...) do {fprintf(stderr,"%s:%d: " fmt "\n", __FUNCTION__, __LINE__, ## args); } while(0) +#else +#define debug(fmt, args ...) +#endif + +#define BUFFER_LENGTH 300 +#define SPI_DEFAULT_SPEED 245000 + +static int spi_parse_path(const char *path, char *device_path, uint32_t *speed, uint16_t *mode) +{ + char *p; + size_t path_length; + + /* Check if any additional parameters have been provided */ + if ((p = strchr(path,':')) == NULL) { + + /* If there's no additional parameters, use default */ + strcpy(device_path, path); + *speed = SPI_DEFAULT_SPEED; + + return 1; + } + + sscanf(p + 1, "%" SCNu32 ":%" SCNu16, speed, mode); /* p points to the delimiter. */ + debug("%" SCNu32 ":%" SCNu16, *speed, *mode); + + switch (*mode) { + case 0: + *mode = SPI_MODE_0; + break; + case 1: + *mode = SPI_MODE_1; + break; + case 2: + *mode = SPI_MODE_2; + break; + case 3: + *mode = SPI_MODE_3; + break; + default: + fprintf(stderr, "Wrong mode for SPI\n"); + return 0; + } + + path_length = p - path; + strncpy(device_path, path, path_length); + device_path[path_length] = '\0'; /* strncpy doesn't null-terminate the string */ + + return 1; +} + +spi_t *openspi(const char *path, int mode, char *msg) +{ + spi_t *device; + int flags = O_RDWR; + uint32_t speed = 0; + uint16_t spi_mode = SPI_MODE_0; + char device_path[PATH_MAX]; + + if (!spi_parse_path(path, device_path, &speed, &spi_mode)) { + return NULL; + } + + device = malloc(sizeof(spi_t)); + + if (device == NULL) { + perror("malloc: "); + return NULL; + } + + if ((mode & STR_MODE_R) && + (mode & STR_MODE_W)) { + flags = O_RDWR; + } else if (mode & STR_MODE_R) { + flags = O_RDONLY; + } else if (mode & STR_MODE_W) { + flags = O_WRONLY; + } + + device->fd = open(device_path, flags); + + if (device->fd < 0) { + perror("open: "); + goto errout_with_free; + } + + /* hardcoded spi mode for Ublox */ + device->mode = mode; + device->speed = speed; + + return device; + +errout_with_free: + free(device); + return NULL; +} + + +static const uint8_t io_buffer[BUFFER_LENGTH]; + +int writespi (spi_t *device, unsigned char *buff, int n, char *msg) +{ + int rc; + struct spi_ioc_transfer transaction = {0}; + + ioctl(device->fd, SPI_IOC_WR_MODE, device->mode); + + if (n > BUFFER_LENGTH) { + n = BUFFER_LENGTH; + } + + transaction.tx_buf = (unsigned long) buff; + transaction.rx_buf = (unsigned long) NULL; + transaction.len = n; + transaction.speed_hz = device->speed; + transaction.bits_per_word = 8; + + rc = ioctl(device->fd, SPI_IOC_MESSAGE(1), &transaction); + if (rc < 0) { + debug("n: %d\n", n); + perror("ioctl: "); + return 0; + } + + return n; +} + +int readspi (spi_t *device, unsigned char *buff, int n, char *msg) +{ + int rc; + struct spi_ioc_transfer transaction = {0}; + + ioctl(device->fd, SPI_IOC_WR_MODE, device->mode); + + if (n > BUFFER_LENGTH) { + n = BUFFER_LENGTH; + } + + transaction.tx_buf = (unsigned long) NULL; + transaction.rx_buf = (unsigned long) buff; + transaction.len = n; + transaction.speed_hz = device->speed; + transaction.bits_per_word = 8; + + rc = ioctl(device->fd, SPI_IOC_MESSAGE(1), &transaction); + if (rc < 0) { + debug("n: %d\n", n); + perror("ioctl: "); + return 0; + } + + return n; +} + +int statespi (spi_t *device) +{ + return 3; +} + +void closespi (spi_t *device) +{ + int rc; + + rc = close(device->fd); + + if (rc < 0) { + perror("close: "); + } +} diff --git a/src/spi.h b/src/spi.h new file mode 100644 index 000000000..34109dbdc --- /dev/null +++ b/src/spi.h @@ -0,0 +1,21 @@ +#ifndef __SPI_H__ +#define __SPI_H__ + +#include + +struct spi_s +{ + int fd; + uint16_t mode; + uint32_t speed; +}; + +typedef struct spi_s spi_t; + +spi_t *openspi(const char *path, int mode, char *msg); +int writespi (spi_t *device, unsigned char *buff, int n, char *msg); +int readspi (spi_t *device, unsigned char *buff, int n, char *msg); +int statespi (spi_t *device); +void closespi (spi_t *device); + +#endif diff --git a/src/stream.c b/src/stream.c index 03ce41f06..bf5802bd8 100644 --- a/src/stream.c +++ b/src/stream.c @@ -59,6 +59,7 @@ #include #endif +#include "spi.h" static const char rcsid[]="$Id$"; /* constants -----------------------------------------------------------------*/ @@ -1840,6 +1841,7 @@ extern int stropen(stream_t *stream, int type, int mode, const char *path) case STR_NTRIPCLI: stream->port=openntrip (path,1, stream->msg); break; case STR_FTP : stream->port=openftp (path,0, stream->msg); break; case STR_HTTP : stream->port=openftp (path,1, stream->msg); break; + case STR_SPI : stream->port=openspi (path, mode, stream->msg); break; default: stream->state=0; return 1; } stream->state=!stream->port?-1:1; @@ -1864,6 +1866,7 @@ extern void strclose(stream_t *stream) case STR_NTRIPCLI: closentrip ((ntrip_t *)stream->port); break; case STR_FTP : closeftp ((ftp_t *)stream->port); break; case STR_HTTP : closeftp ((ftp_t *)stream->port); break; + case STR_SPI : closespi ((spi_t *)stream->port); break; } } else { @@ -1928,6 +1931,7 @@ extern int strread(stream_t *stream, unsigned char *buff, int n) case STR_NTRIPCLI: nr=readntrip ((ntrip_t *)stream->port,buff,n,msg); break; case STR_FTP : nr=readftp ((ftp_t *)stream->port,buff,n,msg); break; case STR_HTTP : nr=readftp ((ftp_t *)stream->port,buff,n,msg); break; + case STR_SPI : nr=readspi ((spi_t *)stream->port,buff,n,msg); break; default: strunlock(stream); return 0; @@ -1971,6 +1975,7 @@ extern int strwrite(stream_t *stream, unsigned char *buff, int n) case STR_NTRIPSVR: ns=writentrip ((ntrip_t *)stream->port,buff,n,msg); break; case STR_FTP : case STR_HTTP : + case STR_SPI : ns=writespi ((spi_t *)stream->port,buff,n,msg); break; default: strunlock(stream); return 0; @@ -2014,6 +2019,7 @@ extern int strstat(stream_t *stream, char *msg) case STR_NTRIPCLI: state=statentrip ((ntrip_t *)stream->port); break; case STR_FTP : state=stateftp ((ftp_t *)stream->port); break; case STR_HTTP : state=stateftp ((ftp_t *)stream->port); break; + case STR_SPI : state=statespi ((spi_t *)stream->port); break; default: strunlock(stream); return 0;