lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

January 2022

  • 3 participants
  • 781 discussions
Change in osmo-dev[master]: net/templates/run.sh: refactor kill logic
by osmith 17 Jan '22

17 Jan '22
osmith has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-dev/+/26667 ) Change subject: net/templates/run.sh: refactor kill logic ...................................................................... Patch Set 1: Verified+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-dev/+/26667 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-dev Gerrit-Branch: master Gerrit-Change-Id: Iaf6c175de2edf720009af13eace2b0ef83b0735b Gerrit-Change-Number: 26667 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Mon, 17 Jan 2022 09:11:44 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in osmo-dev[master]: all.deps, werror.opts: add osmo-bsc-nat
by osmith 17 Jan '22

17 Jan '22
osmith has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-dev/+/26666 ) Change subject: all.deps, werror.opts: add osmo-bsc-nat ...................................................................... Patch Set 1: Verified+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-dev/+/26666 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-dev Gerrit-Branch: master Gerrit-Change-Id: Ica90826c8bfbf4f295c49702d36e7c88e43f80cd Gerrit-Change-Number: 26666 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Mon, 17 Jan 2022 09:11:42 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in osmo-ttcn3-hacks[master]: mgw: Introduce test TC_two_crcx_mdcx_and_iuup_rtp
by pespin 17 Jan '22

17 Jan '22
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26860 ) Change subject: mgw: Introduce test TC_two_crcx_mdcx_and_iuup_rtp ...................................................................... mgw: Introduce test TC_two_crcx_mdcx_and_iuup_rtp This test validates we can connect 3G to 2G AMR calls fine. Change-Id: I3627711d80c5e42d56e478c1c4ff3fb5b27adfdf --- M mgw/MGCP_Test.ttcn 1 file changed, 122 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/60/26860/1 diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn index e1d713e..9defea7 100644 --- a/mgw/MGCP_Test.ttcn +++ b/mgw/MGCP_Test.ttcn @@ -2463,7 +2463,7 @@ setverdict(pass); } - /* create two local RTP emulations and pass data in both directions */ + /* create two local RTP+IuUP emulations and pass data in both directions */ function f_tc_two_crcx_mdcx_and_iuup(charstring local_ip_a, charstring remote_ip_a, charstring local_ip_b, charstring remote_ip_b) runs on dummy_CT { var RtpFlowData flow[2]; @@ -2580,6 +2580,126 @@ mp_local_ipv4, mp_remote_ipv4); } + /* create two local emulations (1 RTP, 1 RTP+IuUP) and pass data in both directions */ + function f_tc_two_crcx_mdcx_and_iuup_rtp(charstring local_ip_a, charstring remote_ip_a, + charstring local_ip_b, charstring remote_ip_b) runs on dummy_CT { + var RtpFlowData flow[2]; + var RtpemStats stats[2]; + var MgcpResponse resp; + var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain; + var MgcpCallId call_id := '1227'H; + var integer num_pkts_tx[2]; + var integer temp; + + f_init(ep); + + /* Create the first connection in receive only mode (RNC side, IuUP-Init active) */ + flow[0] := valueof(t_RtpFlow(local_ip_a, remote_ip_a, 96, "VND.3GPP.IUFP/16000")); + flow[0].em.portnr := 10000; + flow[0].rtp_cfg := c_RtpemDefaultCfg; + flow[0].rtp_cfg.tx_payload_type := flow[0].pt; + flow[0].rtp_cfg.tx_fixed_payload := '4f28959ffeb80181f5c4e83d176c897b4a4e333298333419a493ca63ded6e0'O; + flow[0].rtp_cfg.rx_fixed_payload := '08556d944c71a1a081e7ead204244480000ecd82b81118000097c4794e7740'O; /* flow[1].rtp_cfg.tx_fixed_payload converted AMR-BE-RTP->AMR-IUUP*/ + flow[0].rtp_cfg.iuup_mode := true; + flow[0].rtp_cfg.iuup_tx_init := true; + f_flow_create(RTPEM[0], ep, call_id, "recvonly", flow[0], true); + f_rtpem_mode(RTPEM[0], RTPEM_MODE_RXONLY); + + /* Create the second connection. This connection will be also + * in receive only mode (CN side, regular RTP) */ + flow[1] := valueof(t_RtpFlow(local_ip_b, remote_ip_b, 112, "AMR/8000")); + flow[1].em.portnr := 20000; + flow[1].rtp_cfg := c_RtpemDefaultCfg; + flow[1].rtp_cfg.tx_payload_type := flow[1].pt; + flow[1].rtp_cfg.tx_fixed_payload := '0382155b65131c68682079fab4810911200003b360ae0446000025f11e539dd0'O; + flow[1].rtp_cfg.rx_fixed_payload := 'f3d3ca2567ffae00607d713a0f45db225ed2938ccca60ccd066924f298f7b5b8'O; /* flow[0].rtp_cfg.tx_fixed_payload converted AMR-IuUP->AMR-BE-RTP*/ + flow[1].rtp_cfg.iuup_mode := false; + f_flow_create(RTPEM[1], ep, call_id, "recvonly", flow[1], true); + f_rtpem_mode(RTPEM[1], RTPEM_MODE_RXONLY); + + /* The first leg starts transmitting */ + f_rtpem_mode(RTPEM[0], RTPEM_MODE_TXONLY); + f_sleep(0.5); + stats[0] := f_rtpem_stats_get(RTPEM[0]); + if (stats[0].num_pkts_rx_err_disabled != 0) { + setverdict(fail, "received packets from MGW on recvonly connection 0"); + mtc.stop; + } + stats[1] := f_rtpem_stats_get(RTPEM[1]); + if (stats[1].num_pkts_rx_err_disabled != 0) { + setverdict(fail, "received packets from MGW on recvonly connection 1"); + mtc.stop; + } + + /* The second leg starts transmitting a little later */ + f_rtpem_mode(RTPEM[1], RTPEM_MODE_TXONLY); + f_sleep(1.0); + stats[0] := f_rtpem_stats_get(RTPEM[0]); + if (stats[0].num_pkts_rx_err_disabled != 0) { + setverdict(fail, "received packets from MGW on recvonly connection 0"); + mtc.stop; + } + stats[1] := f_rtpem_stats_get(RTPEM[1]); + if (stats[1].num_pkts_rx_err_disabled != 0) { + setverdict(fail, "received packets from MGW on recvonly connection 1"); + mtc.stop; + } + + /* The first leg will now be switched into bidirectional + * mode, but we do not expect any data coming back yet. */ + f_rtpem_mode(RTPEM[0], RTPEM_MODE_BIDIR); + stats[1] := f_rtpem_stats_get(RTPEM[1]); + num_pkts_tx[1] := stats[1].num_pkts_tx; + f_flow_modify(RTPEM[0], ep, call_id, "sendrecv", flow[0]); + f_sleep(0.5); + stats[0] := f_rtpem_stats_get(RTPEM[0]); + if (stats[0].num_pkts_rx_err_disabled != 0) { + setverdict(fail, "received packets from MGW on recvonly connection 0"); + mtc.stop; + } + stats[1] := f_rtpem_stats_get(RTPEM[1]); + if (stats[1].num_pkts_rx_err_disabled != 0) { + setverdict(fail, "received packets from MGW on recvonly connection 1"); + mtc.stop; + } + + /* When the second leg is switched into bidirectional mode + * as well, then the MGW will connect the two together and + * we should see RTP streams passing through from both ends. */ + f_rtpem_mode(RTPEM[1], RTPEM_MODE_BIDIR); + stats[0] := f_rtpem_stats_get(RTPEM[0]); + num_pkts_tx[0] := stats[0].num_pkts_tx; + f_flow_modify(RTPEM[1], ep, call_id, "sendrecv", flow[1]); + f_sleep(2.0); + + stats[0] := f_rtpem_stats_get(RTPEM[0]); + stats[1] := f_rtpem_stats_get(RTPEM[1]); + + temp := stats[0].num_pkts_tx - num_pkts_tx[0] - stats[1].num_pkts_rx; + if (temp > 3 or temp < -3) { + setverdict(fail, "number of packets not within normal parameters:", temp); + mtc.stop; + } + + temp := stats[1].num_pkts_tx - num_pkts_tx[1] - stats[0].num_pkts_rx; + if (temp > 3 or temp < -3) { + setverdict(fail, "number of packets not within normal parameters:", temp); + mtc.stop; + } + + f_rtpem_stats_err_check(stats[0]); + f_rtpem_stats_err_check(stats[1]); + + /* Tear down */ + f_flow_delete(RTPEM[0]); + f_flow_delete(RTPEM[1], ep, call_id); + setverdict(pass); + } + testcase TC_two_crcx_mdcx_and_iuup_rtp() runs on dummy_CT { + f_tc_two_crcx_mdcx_and_iuup_rtp(mp_local_ipv4, mp_remote_ipv4, + mp_local_ipv4, mp_remote_ipv4); + } + control { execute(TC_selftest()); execute(TC_crcx()); @@ -2655,6 +2775,7 @@ execute(TC_two_crcx_mdcx_and_rtp_osmux_ipv6_ipv4()); execute(TC_two_crcx_mdcx_and_iuup()); + execute(TC_two_crcx_mdcx_and_iuup_rtp()); /* Note: This testcase will trigger an OSMO_ASSERT() bug in * older versions of osmo-mgw. This eventually leads into -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26860 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I3627711d80c5e42d56e478c1c4ff3fb5b27adfdf Gerrit-Change-Number: 26860 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
2 3
0 0
Change in libosmocore[master]: PFCP: add DLPFCP and osmo-upf port numbers
by lynxis lazus 17 Jan '22

17 Jan '22
lynxis lazus has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/26606 ) Change subject: PFCP: add DLPFCP and osmo-upf port numbers ...................................................................... Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26606 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I0a46b147ec6a76d909df28136cfd2b764b2c75ea Gerrit-Change-Number: 26606 Gerrit-PatchSet: 2 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Mon, 17 Jan 2022 08:07:47 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Build failed in Jenkins: master-osmo-sip-connector » a1=default,a2=default,a3=default,a4=default,osmocom-master-debian9 #4098
by jenkins@lists.osmocom.org 16 Jan '22

16 Jan '22
See <https://jenkins.osmocom.org/jenkins/job/master-osmo-sip-connector/a1=defaul…> Changes: ------------------------------------------ Started by upstream project "master-osmo-sip-connector" build number 4098 originally caused by: Started by timer Running as SYSTEM Building remotely on gtp0-deb9build (ttcn3 osmocom-gerrit-debian9 osmocom-master-debian9) in workspace /home/osmocom-build/jenkins/workspace/master-osmo-sip-connector/a1/default/a2/default/a3/default/a4/default/label/osmocom-master-debian9 FATAL: java.io.IOException: Unexpected termination of the channel java.io.EOFException at java.base/java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2872) at java.base/java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:3367) at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:936) at java.base/java.io.ObjectInputStream.<init>(ObjectInputStream.java:379) at hudson.remoting.ObjectInputStreamEx.<init>(ObjectInputStreamEx.java:49) at hudson.remoting.Command.readFrom(Command.java:142) at hudson.remoting.Command.readFrom(Command.java:128) at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:35) at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:61) Caused: java.io.IOException: Unexpected termination of the channel at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:75) Also: hudson.remoting.Channel$CallSiteStackTrace: Remote call to gtp0-deb9build at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1795) at hudson.remoting.Request.call(Request.java:199) at hudson.remoting.Channel.call(Channel.java:1000) at hudson.FilePath.act(FilePath.java:1165) at hudson.FilePath.act(FilePath.java:1154) at hudson.FilePath.mkdirs(FilePath.java:1340) at hudson.model.AbstractProject.checkout(AbstractProject.java:1207) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:637) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:85) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:509) at hudson.model.Run.execute(Run.java:1888) at hudson.matrix.MatrixRun.run(MatrixRun.java:153) at hudson.model.ResourceController.execute(ResourceController.java:99) at hudson.model.Executor.run(Executor.java:431) Caused: hudson.remoting.RequestAbortedException at hudson.remoting.Request.abort(Request.java:345) at hudson.remoting.Channel.terminate(Channel.java:1082) at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:90)
1 1
0 0
Change in osmo-e1-hardware[master]: icE1usb doc: DAHDI driver no longer experimental
by laforge 16 Jan '22

16 Jan '22
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26923 ) Change subject: icE1usb doc: DAHDI driver no longer experimental ...................................................................... icE1usb doc: DAHDI driver no longer experimental Change-Id: I0c65d7be98f514a5f106472389472a177d3c58c2 --- M doc/manuals/chapters/host-software.adoc 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/23/26923/1 diff --git a/doc/manuals/chapters/host-software.adoc b/doc/manuals/chapters/host-software.adoc index 1d23312..356c897 100644 --- a/doc/manuals/chapters/host-software.adoc +++ b/doc/manuals/chapters/host-software.adoc @@ -26,7 +26,7 @@ DAHDI is supported by a wide range of open source PBX / softswitch software, including Asterisk, FreeSWITCH and yate. -There is an experimental DAHDI driver for the icE1usb available from +There is a DAHDI driver for the icE1usb available from the `laforge/icE1usb` branch of the https://github.com/osmocom/dahdi-linux git repository. -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26923 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1-hardware Gerrit-Branch: master Gerrit-Change-Id: I0c65d7be98f514a5f106472389472a177d3c58c2 Gerrit-Change-Number: 26923 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 2
0 0
Change in osmo-e1-hardware[master]: jenkins.sh: Fix upload of tagged releases
by laforge 16 Jan '22

16 Jan '22
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26922 ) Change subject: jenkins.sh: Fix upload of tagged releases ...................................................................... jenkins.sh: Fix upload of tagged releases Tagged releases get something like icE1usb-fw-0.2.elf without a git-hash component suffix. So the old glob *-*-*-*.{bin,elf} was not matching and we got errors like rsync: link_stat "/build/firmware/ice40-riscv/icE1usb/*-*-*-*.bin" failed: No such file or directory (2) rsync: link_stat "/build/firmware/ice40-riscv/icE1usb/*-*-*-*.elf" failed: No such file or directory (2) Change-Id: I7509f9d92ec19c1702af5f958d495e21321053bc --- M contrib/jenkins.sh 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/22/26922/1 diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 9352a47..79d6571 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -50,9 +50,9 @@ [ftp.osmocom.org]:48 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK8iivY70EiR5NiGChV39gRLjNpC8lvu1ZdHtdMw2zuX EOF SSH_COMMAND="ssh -o 'UserKnownHostsFile=/build/known_hosts' -p 48" - rsync --archive --verbose --compress --rsh "$SSH_COMMAND" $TOPDIR/firmware/ice40-riscv/icE1usb/*-*-*-*.{bin,elf} binaries@ftp.osmocom.org:web-files/icE1usb/firmware/all/ + rsync --archive --verbose --compress --rsh "$SSH_COMMAND" $TOPDIR/firmware/ice40-riscv/icE1usb/icE1usb-fw-*.{bin,elf} binaries@ftp.osmocom.org:web-files/icE1usb/firmware/all/ rsync --archive --copy-links --verbose --compress --rsh "$SSH_COMMAND" $TOPDIR/firmware/ice40-riscv/icE1usb/icE1usb-fw.{bin,elf} binaries@ftp.osmocom.org:web-files/icE1usb/firmware/latest/ - rsync --archive --verbose --compress --rsh "$SSH_COMMAND" $TOPDIR/firmware/ice40-riscv/e1-tracer/*-*-*-*.{bin,elf} binaries@ftp.osmocom.org:web-files/e1-tracer/firmware/all/ + rsync --archive --verbose --compress --rsh "$SSH_COMMAND" $TOPDIR/firmware/ice40-riscv/e1-tracer/e1_tracer-fw-*.{bin,elf} binaries@ftp.osmocom.org:web-files/e1-tracer/firmware/all/ rsync --verbose --copy-links --compress --rsh "$SSH_COMMAND" $TOPDIR/firmware/ice40-riscv/e1-tracer/e1_tracer-fw.{bin,elf} binaries@ftp.osmocom.org:web-files/e1-tracer/firmware/latest/ fi -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26922 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1-hardware Gerrit-Branch: master Gerrit-Change-Id: I7509f9d92ec19c1702af5f958d495e21321053bc Gerrit-Change-Number: 26922 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 2
0 0
Change in osmo-remsim[master]: Fix client_id/bank_id/slot_nr range in manual + --help output
by laforge 16 Jan '22

16 Jan '22
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-remsim/+/26921 ) Change subject: Fix client_id/bank_id/slot_nr range in manual + --help output ...................................................................... Fix client_id/bank_id/slot_nr range in manual + --help output The RSPRO.asn protocol defines the ranges 0..1023 for slot, bank and client IDs. Don't make misleading claims in manual and/or help messages. Change-Id: Id383b2bea4c014e7b61ae02e7062ba4db5c2dc20 --- M doc/manuals/chapters/remsim-bankd.adoc M doc/manuals/chapters/remsim-client.adoc M src/bankd/bankd_main.c M src/client/remsim_client_main.c 4 files changed, 11 insertions(+), 11 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/21/26921/1 diff --git a/doc/manuals/chapters/remsim-bankd.adoc b/doc/manuals/chapters/remsim-bankd.adoc index da529e2..7c102de 100644 --- a/doc/manuals/chapters/remsim-bankd.adoc +++ b/doc/manuals/chapters/remsim-bankd.adoc @@ -61,7 +61,7 @@ ==== SYNOPSIS -*osmo-remsim-bankd* [-h] [-V] [-d LOGOPT] [-i A.B.C.D] [-p <1-65535>] [-b <1-65535>] [-n <1-65535>] [-I A.B.C.D] [-P <1-65535> ] +*osmo-remsim-bankd* [-h] [-V] [-d LOGOPT] [-i A.B.C.D] [-p <1-65535>] [-b <1-1023>] [-n <1-1023>] [-I A.B.C.D] [-P <1-65535> ] ==== OPTIONS @@ -77,11 +77,11 @@ *-p, --server-port <1-65535>*:: Specify the remote TCP port number of the `osmo-remsim-server` to which this bankd shall establish its RSPRO control connection -*-b, --bank-id <1-65535>*:: +*-b, --bank-id <1-1023>*:: Specify the numeric bank identifier of the SIM bank this bankd instance operates. Must be unique among all banks connecting to the same `osmo-remsim-server`. -*-n, --num-slots <1-65535>*:: +*-n, --num-slots <1-1023>*:: Specify the number of slots that this bankd handles. *-I, --bind-IP A.B.C.D*:: Specify the local IP address to which the socket for incoming connections diff --git a/doc/manuals/chapters/remsim-client.adoc b/doc/manuals/chapters/remsim-client.adoc index efd1752..d897431 100644 --- a/doc/manuals/chapters/remsim-client.adoc +++ b/doc/manuals/chapters/remsim-client.adoc @@ -82,11 +82,11 @@ *-p, --server-port <1-65535>*:: Specify the remote TCP port number of the `osmo-remsim-server` to which this client shall establish its RSPRO control connection -*-c, --client-id <1-65535>*:: +*-c, --client-id <1-1023>*:: Specify the numeric client identifier of the SIM bank this bankd instance operates. The tuple of client-id and client-slot must be unique among all clients connecting to the same `osmo-remsim-server`. -*-n, --client-slot <0-65535>*:: +*-n, --client-slot <0-1023>*:: Specify the slot number served within this client. The tuple of client-id and client-slot must be unique among all clients connecting to the same `osmo-remsim-server`. @@ -224,11 +224,11 @@ *-p, --server-port <1-65535>*:: Specify the remote TCP port number of the `osmo-remsim-server` to which this client shall establish its RSPRO control connection -*-c, --client-id <1-65535>*:: +*-c, --client-id <1-1023>*:: Specify the numeric client identifier of the SIM bank this bankd instance operates. The tuple of client-id and client-slot must be unique among all clients connecting to the same `osmo-remsim-server`. -*-n, --client-slot <0-65535>*:: +*-n, --client-slot <0-1023>*:: Specify the slot number served within this client. The tuple of client-id and client-slot must be unique among all clients connecting to the same `osmo-remsim-server`. diff --git a/src/bankd/bankd_main.c b/src/bankd/bankd_main.c index 2923924..fcdbf76 100644 --- a/src/bankd/bankd_main.c +++ b/src/bankd/bankd_main.c @@ -277,8 +277,8 @@ " -d --debug option Enable debug logging (e.g. DMAIN:DST2)\n" " -i --server-host A.B.C.D remsim-server IP address (default: 127.0.0.1)\n" " -p --server-port <1-65535> remsim-server TCP port (default: 9998)\n" -" -b --bank-id <1-65535> Bank Identifier of this SIM bank (default: 1)\n" -" -n --num-slots <1-65535> Number of Slots in this SIM bank (default: 8)\n" +" -b --bank-id <1-1023> Bank Identifier of this SIM bank (default: 1)\n" +" -n --num-slots <1-1023> Number of Slots in this SIM bank (default: 8)\n" " -I --bind-ip A.B.C.D Local IP address to bind for incoming client\n" " connections (default: INADDR_ANY)\n" " -P --bind-port <1-65535> Local TCP port to bind for incoming client\n" diff --git a/src/client/remsim_client_main.c b/src/client/remsim_client_main.c index 47ec8ac..e3d3cf8 100644 --- a/src/client/remsim_client_main.c +++ b/src/client/remsim_client_main.c @@ -30,8 +30,8 @@ " -d --debug option Enable debug logging (e.g. DMAIN:DST2)\n" " -i --server-ip A.B.C.D remsim-server IP address\n" " -p --server-port 13245 remsim-server TCP port\n" - " -c --client-id <0-65535> RSPRO ClientId of this client\n" - " -n --client-slot <0-65535> RSPRO SlotNr of this client\n" + " -c --client-id <0-1023> RSPRO ClientId of this client\n" + " -n --client-slot <0-1023> RSPRO SlotNr of this client\n" " -e --event-script <path> event script to be called by client\n" #ifdef USB_SUPPORT " -V --usb-vendor VENDOR_ID\n" -- To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/26921 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-remsim Gerrit-Branch: master Gerrit-Change-Id: Id383b2bea4c014e7b61ae02e7062ba4db5c2dc20 Gerrit-Change-Number: 26921 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 2
0 0
Change in osmo-e1-hardware[master]: icE1usb fw: Expose the GPS NMEA data as a CDC ACM
by tnt 16 Jan '22

16 Jan '22
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26914 ) Change subject: icE1usb fw: Expose the GPS NMEA data as a CDC ACM ...................................................................... icE1usb fw: Expose the GPS NMEA data as a CDC ACM Note that this is read-only. We drop all data from the host because we can't have the host reconfigure the module ... Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com> Change-Id: Ieb6a653ece882c5f90ab27da1bca04c94184dc5a --- M firmware/ice40-riscv/icE1usb/Makefile M firmware/ice40-riscv/icE1usb/fw_app.c M firmware/ice40-riscv/icE1usb/gps.c M firmware/ice40-riscv/icE1usb/usb_desc_app.c M firmware/ice40-riscv/icE1usb/usb_desc_ids.h A firmware/ice40-riscv/icE1usb/usb_gps.c A firmware/ice40-riscv/icE1usb/usb_gps.h M gateware/cores/no2usb 8 files changed, 247 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/14/26914/1 diff --git a/firmware/ice40-riscv/icE1usb/Makefile b/firmware/ice40-riscv/icE1usb/Makefile index 6725f6a..a6e9138 100644 --- a/firmware/ice40-riscv/icE1usb/Makefile +++ b/firmware/ice40-riscv/icE1usb/Makefile @@ -54,6 +54,7 @@ usb_desc_ids.h \ usb_dev.h \ usb_e1.h \ + usb_gps.h \ usb_str_app.gen.h \ $(NULL) @@ -65,6 +66,7 @@ usb_desc_app.c \ usb_dev.c \ usb_e1.c \ + usb_gps.c \ $(NULL) diff --git a/firmware/ice40-riscv/icE1usb/fw_app.c b/firmware/ice40-riscv/icE1usb/fw_app.c index c5c2b7c..78da8b6 100644 --- a/firmware/ice40-riscv/icE1usb/fw_app.c +++ b/firmware/ice40-riscv/icE1usb/fw_app.c @@ -21,6 +21,7 @@ #include "spi.h" #include "usb_dev.h" #include "usb_e1.h" +#include "usb_gps.h" #include "utils.h" @@ -105,6 +106,7 @@ usb_dev_init(); usb_dfu_rt_init(); usb_e1_init(); + usb_gps_init(); /* Start */ led_state(true); @@ -168,5 +170,6 @@ /* GPS poll */ gps_poll(); + usb_gps_poll(); } } diff --git a/firmware/ice40-riscv/icE1usb/gps.c b/firmware/ice40-riscv/icE1usb/gps.c index 2fd6ab8..c1ad3a8 100644 --- a/firmware/ice40-riscv/icE1usb/gps.c +++ b/firmware/ice40-riscv/icE1usb/gps.c @@ -13,6 +13,7 @@ #include "console.h" #include "gps.h" #include "misc.h" +#include "usb_gps.h" #include "utils.h" #include "config.h" @@ -217,6 +218,9 @@ /* If we do, process it locally to update our state */ _gps_parse_nmea(nmea); + + /* And queue it for USB */ + usb_gps_puts(nmea); } void diff --git a/firmware/ice40-riscv/icE1usb/usb_desc_app.c b/firmware/ice40-riscv/icE1usb/usb_desc_app.c index 22a81d3..e0edf80 100644 --- a/firmware/ice40-riscv/icE1usb/usb_desc_app.c +++ b/firmware/ice40-riscv/icE1usb/usb_desc_app.c @@ -42,7 +42,6 @@ } __attribute__ ((packed)) e1[2]; /* CDC */ -#if 0 struct { struct usb_intf_desc intf_ctl; struct usb_cdc_hdr_desc cdc_hdr; @@ -53,7 +52,6 @@ struct usb_ep_desc ep_data_out; struct usb_ep_desc ep_data_in; } __attribute__ ((packed)) cdc; -#endif /* DFU Runtime */ struct { @@ -207,7 +205,6 @@ }, }, }, -#if 0 .cdc = { .intf_ctl = { .bLength = sizeof(struct usb_intf_desc), @@ -230,21 +227,24 @@ .bLength = sizeof(struct usb_cdc_acm_desc), .bDescriptorType = USB_CS_DT_INTF, .bDescriptorsubtype = USB_CDC_DST_ACM, + /* Set_Line_Coding, Set_Control_Line_State, Get_Line_Coding, */ + /* and the notification Serial_State */ .bmCapabilities = 0x02, }, .cdc_union = { .bLength = sizeof(struct usb_cdc_union_desc) + 1, .bDescriptorType = USB_CS_DT_INTF, .bDescriptorsubtype = USB_CDC_DST_UNION, - .bMasterInterface = 1, - .bSlaveInterface = { 2 }, + .bMasterInterface = USB_INTF_GPS_CDC_CTL, + .bSlaveInterface = { USB_INTF_GPS_CDC_DATA }, }, .ep_ctl = { .bLength = sizeof(struct usb_ep_desc), .bDescriptorType = USB_DT_EP, .bEndpointAddress = USB_EP_GPS_CDC_CTL, .bmAttributes = 0x03, - .wMaxPacketSize = 64, + /* Longest notif is SERIAL_STATE with 2 data bytes */ + .wMaxPacketSize = sizeof(struct usb_ctrl_req) + 2, .bInterval = 0x40, }, .intf_data = { @@ -275,7 +275,6 @@ .bInterval = 0x00, }, }, -#endif .dfu = { .intf = { .bLength = sizeof(struct usb_intf_desc), diff --git a/firmware/ice40-riscv/icE1usb/usb_desc_ids.h b/firmware/ice40-riscv/icE1usb/usb_desc_ids.h index 00dbb34..3fbc417 100644 --- a/firmware/ice40-riscv/icE1usb/usb_desc_ids.h +++ b/firmware/ice40-riscv/icE1usb/usb_desc_ids.h @@ -9,9 +9,15 @@ #define USB_INTF_E1(p) (0 + (p)) #define USB_INTF_DFU 2 -#define USB_INTF_NUM 3 +#define USB_INTF_GPS_CDC_CTL 3 +#define USB_INTF_GPS_CDC_DATA 4 +#define USB_INTF_NUM 5 #define USB_EP_E1_IN(p) (0x82 + (3 * (p))) #define USB_EP_E1_OUT(p) (0x01 + (3 * (p))) #define USB_EP_E1_FB(p) (0x81 + (3 * (p))) #define USB_EP_E1_INT(p) (0x83 + (3 * (p))) + +#define USB_EP_GPS_CDC_CTL 0x88 +#define USB_EP_GPS_CDC_OUT 0x09 +#define USB_EP_GPS_CDC_IN 0x89 diff --git a/firmware/ice40-riscv/icE1usb/usb_gps.c b/firmware/ice40-riscv/icE1usb/usb_gps.c new file mode 100644 index 0000000..1c10033 --- /dev/null +++ b/firmware/ice40-riscv/icE1usb/usb_gps.c @@ -0,0 +1,211 @@ +/* + * usb_gps.c + * + * Copyright (C) 2019-2022 Sylvain Munaut <tnt(a)246tNt.com> + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#include <stdint.h> +#include <stdbool.h> +#include <string.h> + +#include <no2usb/usb.h> +#include <no2usb/usb_hw.h> +#include <no2usb/usb_priv.h> + +#include <no2usb/usb_proto.h> +#include <no2usb/usb_cdc_proto.h> + +#include "console.h" +#include "usb_desc_ids.h" + + +#define BUF_SIZE_LOG 9 +#define BUF_SIZE (1 << BUF_SIZE_LOG) +#define BUF_MASK (BUF_SIZE - 1) + +static struct { + /* State */ + bool active; + + /* Buffer */ + struct { + unsigned int wr; + unsigned int rd; + char data[BUF_SIZE] __attribute__((aligned(4))); + } buf; +} g_usb_gps; + + +static void +_usb_gps_set_active(bool active) +{ + /* Save new state */ + g_usb_gps.active = active; + + /* Reset FIFO if disabled */ + if (!active) + g_usb_gps.buf.wr = g_usb_gps.buf.rd = 0; +} + +static int +_usb_gps_fill_packet(unsigned int dst_ofs) +{ + unsigned int len; + + /* Len available, limited to 64 */ + len = (g_usb_gps.buf.wr - g_usb_gps.buf.rd) & BUF_MASK; + + if (len > 64) + len = 64; + + /* Copy block */ + usb_data_write(dst_ofs, &g_usb_gps.buf.data[g_usb_gps.buf.rd], (len + 3) & ~3); + + /* Increment read pointer */ + g_usb_gps.buf.rd = (g_usb_gps.buf.rd + len) & BUF_MASK; + + /* If length was not multiple of 4, we emptied the FIFO, + * so we reset it to 0 so we're aligned again */ + if (len & 3) + g_usb_gps.buf.wr = g_usb_gps.buf.rd = 0; + + return len; +} + + +void +usb_gps_puts(const char *str) +{ + unsigned int nxt; + char c; + + if (!g_usb_gps.active) + return; + + while ((c = *str++) != '\0') + { + /* Next write pointer pos and full check */ + nxt = (g_usb_gps.buf.wr + 1) & BUF_MASK; + if (nxt == g_usb_gps.buf.rd) + /* If overflow, we keep the latest content ... */ + g_usb_gps.buf.rd = (g_usb_gps.buf.rd + 1) & BUF_MASK; + + /* Write data */ + g_usb_gps.buf.data[g_usb_gps.buf.wr] = c; + + /* Update write pointer */ + g_usb_gps.buf.wr = nxt; + } +} + +void +usb_gps_poll(void) +{ + volatile struct usb_ep *ep_regs; + + /* OUT EP: We accept data and throw it away */ + ep_regs = &usb_ep_regs[USB_EP_GPS_CDC_OUT & 0x1f].out; + ep_regs->bd[0].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN(64); + + /* IN EP: Send whatever is queued */ + ep_regs = &usb_ep_regs[USB_EP_GPS_CDC_OUT & 0x1f].in; + + if ((ep_regs->bd[0].csr & USB_BD_STATE_MSK) != USB_BD_STATE_RDY_DATA) + { + int len = _usb_gps_fill_packet(ep_regs->bd[0].ptr); + + if (len) + ep_regs->bd[0].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN(len); + else + ep_regs->bd[0].csr = 0; + } +} + + +static enum usb_fnd_resp +_cdc_set_conf(const struct usb_conf_desc *conf) +{ + const struct usb_intf_desc *intf; + + if (!conf) + return USB_FND_SUCCESS; + + /* Configure control interface */ + intf = usb_desc_find_intf(conf, USB_INTF_GPS_CDC_CTL, 0, NULL); + if (!intf) + return USB_FND_ERROR; + + usb_ep_boot(intf, USB_EP_GPS_CDC_CTL, false); + + /* Configure data interface */ + intf = usb_desc_find_intf(conf, USB_INTF_GPS_CDC_DATA, 0, NULL); + if (!intf) + return USB_FND_ERROR; + + usb_ep_boot(intf, USB_EP_GPS_CDC_OUT, false); + usb_ep_boot(intf, USB_EP_GPS_CDC_IN, false); + + return USB_FND_SUCCESS; +} + +static enum usb_fnd_resp +_cdc_ctrl_req(struct usb_ctrl_req *req, struct usb_xfer *xfer) +{ + static const struct usb_cdc_line_coding linecoding = { + .dwDTERate = 115200, + .bCharFormat = 2, + .bParityType = 0, + .bDataBits = 8, + }; + + /* Check this is handled here */ + if (USB_REQ_TYPE_RCPT(req) != (USB_REQ_TYPE_CLASS | USB_REQ_RCPT_INTF)) + return USB_FND_CONTINUE; + + if (req->wIndex != USB_INTF_GPS_CDC_CTL) + return USB_FND_CONTINUE; + + /* Process request */ + switch (req->bRequest) { + case USB_REQ_CDC_SEND_ENCAPSULATED_COMMAND: + /* We don't support any, so just accept and don't care */ + return USB_FND_SUCCESS; + + case USB_REQ_CDC_GET_ENCAPSULATED_RESPONSE: + /* Never anything to return */ + xfer->len = 0; + return USB_FND_SUCCESS; + + case USB_REQ_CDC_SET_LINE_CODING: + /* We only support 1 config, doesn't matter what the hosts sends */ + return USB_FND_SUCCESS; + + case USB_REQ_CDC_GET_LINE_CODING: + /* We only support 1 config, send that back */ + xfer->data = (void*)&linecoding; + xfer->len = sizeof(linecoding); + return USB_FND_ERROR; + + case USB_REQ_CDC_SET_CONTROL_LINE_STATE: + /* Enable if DTR is set */ + _usb_gps_set_active((req->wValue & 1) != 0); + return USB_FND_SUCCESS; + } + + /* Anything else is not handled */ + return USB_FND_ERROR; +} + + +static struct usb_fn_drv _cdc_drv = { + .set_conf = _cdc_set_conf, + .ctrl_req = _cdc_ctrl_req, +}; + +void +usb_gps_init(void) +{ + memset(&g_usb_gps, 0x00, sizeof(g_usb_gps)); + usb_register_function_driver(&_cdc_drv); +} diff --git a/firmware/ice40-riscv/icE1usb/usb_gps.h b/firmware/ice40-riscv/icE1usb/usb_gps.h new file mode 100644 index 0000000..3324a45 --- /dev/null +++ b/firmware/ice40-riscv/icE1usb/usb_gps.h @@ -0,0 +1,13 @@ +/* + * usb_gps.h + * + * Copyright (C) 2019-2022 Sylvain Munaut <tnt(a)246tNt.com> + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#pragma once + +void usb_gps_puts(const char *str); + +void usb_gps_poll(void); +void usb_gps_init(void); diff --git a/gateware/cores/no2usb b/gateware/cores/no2usb index e9d1fbb..fdf42a6 160000 --- a/gateware/cores/no2usb +++ b/gateware/cores/no2usb @@ -1 +1 @@ -Subproject commit e9d1fbb8a1796444091cd8a39e2a4318530b4daf +Subproject commit fdf42a6571a4ae49556626e6fffca1582796f7e8 -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26914 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1-hardware Gerrit-Branch: master Gerrit-Change-Id: Ieb6a653ece882c5f90ab27da1bca04c94184dc5a Gerrit-Change-Number: 26914 Gerrit-PatchSet: 1 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-MessageType: newchange
2 4
0 0
Change in osmo-e1-hardware[master]: icE1usb fw: Add GPSDO VCXO trimming loop
by tnt 16 Jan '22

16 Jan '22
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26915 ) Change subject: icE1usb fw: Add GPSDO VCXO trimming loop ...................................................................... icE1usb fw: Add GPSDO VCXO trimming loop Rather basic and not super well tested, use with caution Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com> Change-Id: I5f9ce6621492be967d6a44d31f270e107f3ef686 --- M firmware/ice40-riscv/icE1usb/Makefile M firmware/ice40-riscv/icE1usb/fw_app.c A firmware/ice40-riscv/icE1usb/gpsdo.c A firmware/ice40-riscv/icE1usb/gpsdo.h 4 files changed, 279 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/15/26915/1 diff --git a/firmware/ice40-riscv/icE1usb/Makefile b/firmware/ice40-riscv/icE1usb/Makefile index a6e9138..25c65d1 100644 --- a/firmware/ice40-riscv/icE1usb/Makefile +++ b/firmware/ice40-riscv/icE1usb/Makefile @@ -49,6 +49,7 @@ config.h \ e1.h \ gps.h \ + gpsdo.h \ ice1usb_proto.h \ misc.h \ usb_desc_ids.h \ @@ -62,6 +63,7 @@ e1.c \ fw_app.c \ gps.c \ + gpsdo.c \ misc.c \ usb_desc_app.c \ usb_dev.c \ diff --git a/firmware/ice40-riscv/icE1usb/fw_app.c b/firmware/ice40-riscv/icE1usb/fw_app.c index 78da8b6..c1fe295 100644 --- a/firmware/ice40-riscv/icE1usb/fw_app.c +++ b/firmware/ice40-riscv/icE1usb/fw_app.c @@ -15,6 +15,7 @@ #include "console.h" #include "e1.h" #include "gps.h" +#include "gpsdo.h" #include "led.h" #include "misc.h" #include "mini-printf.h" @@ -94,12 +95,13 @@ pdm_set(PDM_E1_RX1, true, 128 + d, false); #endif - /* Setup clock tuning */ - pdm_set(PDM_CLK_HI, true, 2048, false); - pdm_set(PDM_CLK_LO, false, 0, false); - /* GPS init */ gps_init(); +#if defined(BOARD_ICE1USB_PROTO_ICEBREAKER) || defined(BOARD_ICE1USB_PROTO_BITSY) + gpsdo_init(VCTXO_TAITIEN_VT40); +#else + gpsdo_init(VCTXO_SITIME_SIT3808_E); +#endif /* Enable USB directly */ usb_init(&app_stack_desc); @@ -170,6 +172,7 @@ /* GPS poll */ gps_poll(); + gpsdo_poll(); usb_gps_poll(); } } diff --git a/firmware/ice40-riscv/icE1usb/gpsdo.c b/firmware/ice40-riscv/icE1usb/gpsdo.c new file mode 100644 index 0000000..ca9b806 --- /dev/null +++ b/firmware/ice40-riscv/icE1usb/gpsdo.c @@ -0,0 +1,254 @@ +/* + * gpsdo.c + * + * Copyright (C) 2019-2022 Sylvain Munaut <tnt(a)246tNt.com> + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#include <stdint.h> +#include <string.h> + +#include "console.h" +#include "gps.h" +#include "gpsdo.h" +#include "misc.h" + + +struct { + /* Current tuning */ + struct { + uint16_t coarse; + uint16_t fine; + } tune; + + /* Measurements */ + struct { + uint32_t tick_prev; /* Previous tick value */ + uint32_t last; /* Last measurement */ + int skip; /* Number of measurement left to discard */ + int invalid; /* Number of consecutive invalid measurements */ + } meas; + + /* FSM */ + enum { + STATE_DISABLED, /* Forced to manual */ + STATE_HOLD_OVER, /* GPS invalid data, hold */ + STATE_TUNE_COARSE, /* Adjust coarse tuning until we're +- 3 Hz */ + STATE_TUNE_FINE, /* Fine tracking */ + } state; + + /* Coarse tuning */ + struct { + int vctxo_sensitivity; + int step; + } coarse; + + /* Fine tracking */ + struct { + int acc; + int div; + } fine; + +} g_gpsdo; + + +/* VCXTO sensitivity vs 'coarse' count for fast initial acquisition */ + /* + * Note that the spec if often a guaranteed minimum range and goes + * from ~0.1V to 3.2V instead of 0-3.3V so actual sensitivity is + * higher than the "theoritical value". We boost it by ~ 10% here. + */ +static const int +vctxo_sensitivity[] = { + /* +- 50 ppm pull range => ~ 0.75 Hz / hi-count (set to 0.85) */ + [VCTXO_TAITIEN_VT40] = 300, + + /* +- 100 ppm pull range => ~ 1.50 Hz / hi-count (set to 1.6) */ + [VCTXO_SITIME_SIT3808_E] = 160, +}; + +/* Tuning params */ +#define TARGET 30720000 +#define MAX_DEV_VALID 1000 +#define MAX_DEV_FINE 3 +#define MAX_INVALID 5 + + +static void +_gpsdo_coarse_start(void) +{ + /* Set the state */ + g_gpsdo.state = STATE_TUNE_COARSE; + + /* Skip a few measurements to be safe */ + g_gpsdo.meas.skip = 3; + + /* Reset coarse tuning state */ + g_gpsdo.coarse.step = 0; + + /* Put the fine adjust back in the middle point */ + g_gpsdo.tune.coarse += ((int)g_gpsdo.tune.fine - 2048) >> 6; + g_gpsdo.tune.fine = 2048; + + pdm_set(PDM_CLK_HI, true, g_gpsdo.tune.coarse, false); + pdm_set(PDM_CLK_LO, true, g_gpsdo.tune.fine, false); +} + +static void +_gpsdo_fine_start(void) +{ + /* Set the state */ + g_gpsdo.state = STATE_TUNE_FINE; + + /* Reset the long term error tracking */ + g_gpsdo.fine.acc = 0; + g_gpsdo.fine.div = 0; +} + +static void +_gpsdo_coarse_tune(uint32_t tick_diff) +{ + int freq_diff = (int)tick_diff - TARGET; + + /* Is the measurement good enough to switch to fine ? */ + if ((freq_diff > -MAX_DEV_FINE) && (freq_diff < MAX_DEV_FINE)) { + _gpsdo_fine_start(); + return; + } + + /* Estimate correction and apply it */ + g_gpsdo.tune.coarse -= (freq_diff * g_gpsdo.coarse.vctxo_sensitivity) >> 8; + pdm_set(PDM_CLK_HI, true, g_gpsdo.tune.coarse, false); + + /* Skip next measurement */ + g_gpsdo.meas.skip = 1; + + /* Debug */ +#ifdef GPSDO_DEBUG + printf("[+] GPSDO Coarse: err=%d tune=%d\n", freq_diff, g_gpsdo.tune.coarse); +#endif +} + +static void +_gpsdo_fine_track(uint32_t tick_diff) +{ + int freq_diff = (int)tick_diff - TARGET; + uint16_t tune; + + /* Did we deviate too much ? */ + if ((freq_diff < -2*MAX_DEV_FINE) && (freq_diff > 2*MAX_DEV_FINE)) { + _gpsdo_coarse_start(); + return; + } + + /* Accumulate long term error */ + g_gpsdo.fine.acc += freq_diff; + + /* Update fine tuning value */ + if (((g_gpsdo.fine.acc >= 0) && (freq_diff > 0)) || + ((g_gpsdo.fine.acc <= 0) && (freq_diff < 0))) + { + g_gpsdo.tune.fine -= freq_diff; + } + + if (g_gpsdo.fine.acc) { + if (++g_gpsdo.fine.div > 10) { + g_gpsdo.fine.div = 0; + if (g_gpsdo.fine.acc > 0) + g_gpsdo.tune.fine--; + else if (g_gpsdo.fine.acc < 0) + g_gpsdo.tune.fine++; + } + } else { + g_gpsdo.fine.div = 0; + } + + /* Apply value with a bias from long term accumulator */ + tune = g_gpsdo.tune.fine - (g_gpsdo.fine.acc / 2); + pdm_set(PDM_CLK_LO, true, tune, false); + + /* Debug */ +#ifdef GPSDO_DEBUG + printf("[+] GPSDO Fine: err=%d acc=%d tune=%d\n", freq_diff, g_gpsdo.fine.acc, g_gpsdo.tune.fine); +#endif +} + + +void +gpsdo_poll(void) +{ + uint32_t tick_now, tick_diff; + bool valid; + + /* Get current tick and check if there was a PPS and estimate frequency */ + tick_now = time_pps_read(); + + if (tick_now == g_gpsdo.meas.tick_prev) + return; + + g_gpsdo.meas.last = tick_diff = tick_now - g_gpsdo.meas.tick_prev; + g_gpsdo.meas.tick_prev = tick_now; + + /* If we're currently discarding samples, skip it */ + if (g_gpsdo.meas.skip) { + g_gpsdo.meas.skip--; + return; + } + + /* If we're disabled, nothing else to do */ + if (g_gpsdo.state == STATE_DISABLED) + return; + + /* Check GPS state */ + if (!gps_has_valid_fix()) { + /* No GPS fix, go to hold-over */ + g_gpsdo.state = STATE_HOLD_OVER; + return; + } + + /* Check measurement plausibility */ + valid = (tick_diff > (TARGET - MAX_DEV_VALID)) && (tick_diff < (TARGET + MAX_DEV_VALID)); + + if (valid) { + /* If we're in hold-over, switch to active */ + if (g_gpsdo.state == STATE_HOLD_OVER) { + _gpsdo_coarse_start(); + return; + } + } else { + /* Count invalid measurements and if too many of + * them, we go back to hold-over */ + if (++g_gpsdo.meas.invalid >= MAX_INVALID) { + g_gpsdo.state = STATE_HOLD_OVER; + return; + } + } + + g_gpsdo.meas.invalid = 0; + + /* If we reach here, we have a valid fix, valid measurement and + * we're not in hold-over or disabled. Feed the correct loop */ + if (g_gpsdo.state == STATE_TUNE_COARSE) + _gpsdo_coarse_tune(tick_diff); + else if (g_gpsdo.state == STATE_TUNE_FINE) + _gpsdo_fine_track(tick_diff); +} + + +void +gpsdo_init(enum gpsdo_vctxo_model vctxo) +{ + /* State */ + memset(&g_gpsdo, 0x00, sizeof(g_gpsdo)); + + /* Default tune to middle range */ + g_gpsdo.tune.coarse = 2048; + g_gpsdo.tune.fine = 2048; + + pdm_set(PDM_CLK_HI, true, g_gpsdo.tune.coarse, false); + pdm_set(PDM_CLK_LO, true, g_gpsdo.tune.fine, false); + + /* Initial state and config */ + g_gpsdo.state = STATE_HOLD_OVER; + g_gpsdo.coarse.vctxo_sensitivity = vctxo_sensitivity[vctxo]; +} diff --git a/firmware/ice40-riscv/icE1usb/gpsdo.h b/firmware/ice40-riscv/icE1usb/gpsdo.h new file mode 100644 index 0000000..181e4b9 --- /dev/null +++ b/firmware/ice40-riscv/icE1usb/gpsdo.h @@ -0,0 +1,16 @@ +/* + * gpsdo.h + * + * Copyright (C) 2019-2022 Sylvain Munaut <tnt(a)246tNt.com> + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#pragma once + +enum gpsdo_vctxo_model { + VCTXO_TAITIEN_VT40 = 0, /* VTEUALJANF-30.720000 */ + VCTXO_SITIME_SIT3808_E = 1, /* SIT3808AI-D2-33EE-30.720000T */ +}; + +void gpsdo_poll(void); +void gpsdo_init(enum gpsdo_vctxo_model vctxo); -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/26915 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1-hardware Gerrit-Branch: master Gerrit-Change-Id: I5f9ce6621492be967d6a44d31f270e107f3ef686 Gerrit-Change-Number: 26915 Gerrit-PatchSet: 1 Gerrit-Owner: tnt <tnt(a)246tNt.com> Gerrit-MessageType: newchange
2 3
0 0
  • ← Newer
  • 1
  • ...
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • ...
  • 79
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.