Commit Graph

307 Commits

Author SHA1 Message Date
Sylvain Munaut 6fd04b52ba icE1usb fw: Add AIS error flag and fill it along with LOS from linemon
Now that we monitor low level line status, we can fill in a proper
LOS signal along with the newly introduced AIS flag

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ied28b6b3da74f6a63a007fae889b571cc2c1e835
2024-04-30 12:54:37 +02:00
Sylvain Munaut 89217dbdba icE1usb fw: Implement E1 line monitor task
The results are not used yet, just collected ...

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Id310b65b7cd83c3bbae90ecd4a82b09a3989d91f
2024-04-30 12:54:37 +02:00
Sylvain Munaut 6a0af5e1f6 icE1usb fw: Use NUM_E1_PORTS in e1.c
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Id69b4429a67ccb8834fee26b83839539a5ad8b31
2024-04-30 12:54:37 +02:00
Sylvain Munaut 10ff2a1190 icE1usb fw: Fix some formatting (tab vs space)
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Id47025320e65a27fc46e9204e050c57d108dab56
2024-04-30 12:54:37 +02:00
Sylvain Munaut 10f00a6fff icE1usb fw: Always define NUM_E1_PORTS in Makefile
So that it's available without having to include the USB include ...

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I0b434cef7a662c19e5f48072285c013e8c02e254
2024-04-30 12:54:37 +02:00
Sylvain Munaut 4f6c775e3f fw: Update the helpers in misc.{c,h} for the new tick measurement hw
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ia881fead7a40f773969a016db05bea0a1fa1604f
2024-04-30 12:54:37 +02:00
Sylvain Munaut 40ccb4e3a3 gateware: Rework the low-level line state monitoring ticks
The 'tick' system was meant to allow the firmware to monitor the
low level state of the line, beyong just "not aligned", but it was
never really useful in the present state.

Now we have more tick source available (but only one can be measured
at the same time). More specifically, the firmware can monitor the
presence/absence of raw pulses (LOS condition), it can also monitor
the number of '1' pulses to detect an AIS signals, or simply the rate
of RX pulses (to tune the local oscillator to incoming signal rate).

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I31fa8a717a26643f1b6ca5644bee1d8c41a2512e
2024-04-30 12:54:34 +02:00
Sylvain Munaut 74c2d1a28e icE1usb fw: Fix OIS -> AIS typo
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I23f242c31483533adb9cb60b4aac9b95a7b807e8
2024-04-30 12:53:52 +02:00
Sylvain Munaut bbc4351361 gateware/cores: Update no2e1
This pulls in the support for non-crc4 framing modes and
also setting the Sa bits (for osmo-v5)

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ica1bbaa052988f5b7e71c7fa51f87eb0bfea6f67
2024-04-30 12:53:35 +02:00
Sylvain Munaut ded31a7a86 icE1usb fw: Avoid casting random pointer to struct in set_{rx,tx}_mode
There is really no need here, we can use `memcpy` just as well.

Not sure if this was a problem here but newer gcc are annoying
with aliasing rules and such so better safe than sorry.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I110ee4c014e8cfe058f7fc357decb7ab99e0be64
2024-04-28 09:44:22 +02:00
Sylvain Munaut b936e3af89 icE1usb fw: Ensure alignement of the structure for the usb_data_write
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Id80468ef95bb908cf34b6eeca04c83f1285fd2f5
2024-03-07 08:51:54 +01:00
Sylvain Munaut 1f29c0fece icE1usb fw: Use proper length for struct usb_cdc_notif_serial_state
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I30d451e76ebd192f037653179b6485b2b43b6dbc
2024-03-07 08:51:54 +01:00
Sylvain Munaut ff9916bb0c gateware/cores: Update no2usb
Mostly to get firmware code fixes

Need some code adaptation in icE1usb firmware to
remove local usb_cdc_notif_serial_state struct
sine tt's included in no2usb cdc proto header now.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I13e186627077c57329e4a83da11acc01ca5dce35
2024-03-07 08:51:08 +01:00
Sylvain Munaut a53f23ad30 icE1usb fw: Workaround some apparent GCC aliasing bug ...
If the code is built either :
 * without -flto
 * with -fno-strict-aliasing
 * with that struct as 'static' (so it's not on the stack)

Then all works fine. But in the current situation (without the
patch), GCC seems to think there is some aliasing and just plain
removed the `notif.bits = 1` bit of code in that functions
(no warnings printed ...).

Putting the struct as 'static' is the least awful workaround.

I didn't bother reporting bug upstream, because I can't reproduce
on a small test case and I'm sure I'd just get yelled at and that
the compiler is right for some reason ...

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ie0a2ce337ce4a9c08c3d27acc4d922a3e5892840
2024-03-06 11:20:40 +01:00
Sylvain Munaut 71a9bcfd64 icE1usb fw: fix usb cdc notification struct attributes
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I7323c335c7cefe30446fb560b9381a3519b65f12
2024-03-06 11:16:34 +01:00
Oliver Smith f1e228d334 doc/manuals: set OSMO_REPOSITORY
Fix uploading manuals to the wrong directory.

Related: OS#5902
Change-Id: I9a84ac72180eeaaad64d923b29541f6ed9828b4e
2023-03-07 14:10:56 +01:00
Sylvain Munaut 0036b1fa9f icE1usb fw: Add device request to read/write I2C device registers
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I55a72762d535827a51e5ea1775e9abbd116bc8a8
2022-11-09 11:14:49 +01:00
Sylvain Munaut 652c732ec4 icE1usb fw: Import I2C peripheral driver
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ib729bb5f4e94eec25c86517042cdfdcb6847ba25
2022-11-09 11:14:49 +01:00
Sylvain Munaut b722de7a2a icE1usb fw: Process read/write device requests separately
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I9a8fb3d6712c83f59e5e4cba8e0bcbd4d4f95eee
2022-11-09 11:02:51 +01:00
Sylvain Munaut 321b1c8694 icE1usb fw: Minor doc string update
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: If0b37021698b2d17b8412a1c05a9c7101b06a506
2022-11-09 11:02:51 +01:00
Sylvain Munaut 1714abcf03 icE1usb fw: Fix typo in SPDX header
Those files barely even qualify for a license anyway but for
consistency's sake ...

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I9585f7f01d2dc8393828aa264ae353e2a53a37dd
2022-11-09 11:02:51 +01:00
Sylvain Munaut 166d49d785 icE1usb fw/gpsdo: Only force HOLD_OVER when no PPS if not DISABLED
Bug introduced in da395cc922
but since we never had anyway to use manual mode before,
didn't get noticed ...

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I6e2b6cf5c7c0c9deaf429be000770316ec88b9d4
2022-11-09 11:02:51 +01:00
Sylvain Munaut ac4392d0e1 hardware/icE1usb: Add production files snapshot for r1.1
Was produced directly off the kicad files AFAIK.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Iea648b099b761dcd4e0a085f4836598383b01d43
2022-11-09 11:02:39 +01:00
Sylvain Munaut 26b3e60dcc hardware/icE1usb: Update ECN with r1.1 production
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ie5edafb617a7f0e7e07474763571806758388b90
2022-11-09 11:02:38 +01:00
Sylvain Munaut 1bcc9a5549 hardware/icE1usb: Kicad file minor updates
* Renumber schematic pages
* Update the info cards with new data and r1.1

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ie5f3aa59e97fe46be9c857cf91ac4ff4ef72384e
2022-11-09 11:02:38 +01:00
Sylvain Munaut 9d1bd2cabc hardware/icE1usb: Add new version of the GPS module doc
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I410cf9761510d0fae0db649676c7ac7115a28e04
2022-11-09 11:02:38 +01:00
Harald Welte 5523be4594 contrib/jenkins.sh: Build e1-tracer host software
Run the different job types based on a new environment variable, as the
software has to be built with a different docker image. The related
osmo-ci patch adjusts the jenkins jobs accordingly.

Co-developed-by: Oliver Smith <osmith@sysmocom.de>
Related: osmo-ci I90fbe72c722e491f41b9607d1a6389964d7e43b4
Change-Id: I26e839de419c6eb86bf2a6250a1adf06b761d1fa
2022-11-04 11:18:57 +00:00
Oliver Smith da46ef882f gitreview: new file
Change-Id: I7a69f2d530aedb72cdeb4f21bdc7d5761285b9e1
2022-11-03 09:59:33 +00:00
Harald Welte 1d12caa521 doc/e1-tracer: Add an initial e1-tracer user manual
Change-Id: I9413195d69325ba74b3993e6ec7a1fc7628b5dd1
2022-11-02 22:06:13 +01:00
Harald Welte 6fc0ad3c7e fw/e1-tracer: Fix bNumInterfaces in new configuration
This fixes the following Linux kernel error message on the host:
usb 1-1: config 2 has 2 interfaces, different from the descriptor's value: 3

Change-Id: Ideb816169a1e995907901c018e7bd2f963c1a831
2022-11-02 22:06:05 +01:00
Harald Welte 6cb6e6ec15 fw/e1-tracer: Initialize IDT82V2081 from within firmware in e1d mode
Initially it was a good choice to keep the LIU driver in the host
software (easier debugging/changes).  However, we never really needed it
to do anything but initialization of the LIU.

So in order to avoid having to teach osmo-e1d or other software the
details about the LIU initialization, let's do this from the firmware
*if* the e1d compatible USB configuration is used.

Closes: OS#5733
Change-Id: Id2217ff4573c4eebd816318128f256e85fb3c3bd
2022-11-01 22:01:38 +01:00
Harald Welte f9280b0de1 fw/e1-tracer: Additional USB configuration for "osmo-e1d compatible mode"
This adds a second USB configuration to the e1-tracer firmware.  This
configuration is closer to the USB configuration of an icE1usb and hence
paves the way for using osmo-e1d with the tracer.

The main conceptual difference between the existing "legacy"
configuration and this new "e1d compatible" configuration is to have two
USB interfaces, one for each direction of the traced E1 interface.  Each
interface has its own separate two altsettings, one for the disabled
and one for the enabled state.

Unmodified osmo-e1d will not work straight away with this, as it expects
ISO OUT and ISU Feedback endpoints, which a pure rx-only tracing device
of course doesn't have.

Related: OS#5733
Change-Id: I97062b9f12317b1b9b3855409c2380108cb921ff
2022-11-01 22:01:38 +01:00
Harald Welte 326a08fe63 fw/e1-tracer: e1_start/e1_stop of individual channel
Let's split the starting and stopping between the two channels.

This is a preparation for a future e1d-compatible mode where each
channel (direction) has its own USB interface and hence must be
individually started/stopped.

Related: OS#5733
Change-Id: I7492325352222269bf0ba1346511c7dfa99c4f64
2022-11-01 21:55:51 +01:00
Harald Welte 3722b186e0 doc: Prepare for more than one user manual
Move icE1usb specific chapters to chapters/icE1usb/ to prepare for
the upcoming e1-tracer user manual.

Change-Id: I4c6cdd4036051469640b86860ea19736aa04364a
2022-11-01 09:37:29 +01:00
Harald Welte 5aa50f4832 doc/icE1usb: Fix typo
Change-Id: I78fa7a69eed2d0112628396156174a83195f0238
2022-11-01 09:37:29 +01:00
Harald Welte 921f39c672 doc/icE1usb: gateware is stored in flash and can be upgraded
Change-Id: I319ff4e75ba76543e562822b6b6d5968bccef237
2022-11-01 09:37:29 +01:00
Harald Welte 7d72b86946 doc/icE1usb: Add link to older firmware builds
Change-Id: I8b97efbe4a644e5b9bbdec0bc764d55f7b59d2d2
2022-11-01 09:37:29 +01:00
Harald Welte 90c842f8dc doc/icE1usb: fix warning about two list items '1'
asciidoc: WARNING: firmware.adoc: line 25: list item index: expected 2 got 1
Change-Id: I7312538c6aa723e25176a6a5288ccab6c03e5f08
2022-11-01 09:37:29 +01:00
Harald Welte e08adb0dff fw/e1-tracer: restrict dfu programming to e1-tracer devices
Let's explicitly specify the VID/PID of the e1-tracer in the dfu-util
invocation 'make dfuprog' to avoid accidentially programming other
attached dfu capable devices.

Change-Id: I6a17f01a621cd4af6827167427fafd2f9f277755
2022-11-01 09:37:29 +01:00
Harald Welte a0df047214 major update of README
* make sure all projects and relevant links are mentioned
* indicate which sub-directories relate to which project
* use markdown syntax

Change-Id: If126790c5652a6228e8a8ad1986e3b08adf46fae
2022-10-31 09:06:35 +01:00
Harald Welte 6e2150ee0c sw/e1tracer: Rename 'main' to 'e1-tracer-record'
Change-Id: If70429e6a0504c657f44f9d0301a128d69ce7c18
2022-10-31 08:38:04 +01:00
Harald Welte 1d062b82c5 sw/e1-tracer: split recorder + analysis tools in sub-directories
this way it's easier to see which part of the code is used where

Change-Id: I7d727263383ec1d6d61dd31fcfebf4a4b1a04765
2022-10-31 08:37:26 +01:00
Harald Welte f5e7264a27 import latest e1-tracer host software
This was originally in https://github.com/smunaut/ice40-playground
but has meanwhile been removed, only a fork at
https://github.com/laf0rge/ice40-playground remained.

Let's import the code here.  The history is not all that exciting
so I'm saving myself the effort of git filter-branch or the like
to import the actual old commits.

The commit log is here for reference:

commit bd36d40cc30acbae68978df79eff03f0539a9a21
Author: Harald Welte <laforge@osmocom.org>
Date:   Fri Sep 4 10:21:51 2020 +0200

    e1-recorder main.c: Don't exist just because one ISO transfer failed

    I get LIBUSB_TRANSFER_ERROR every so often (once every few hours) on my
    laptop.  Sure, it likely means there was some data lost, but the trace
    can continue juts fine after this error.  So make it non-fatal and
    continue running.

commit 9b02b3e87400ba3d27bff05e2632fbd5a0698e8c
Author: Harald Welte <laforge@osmocom.org>
Date:   Mon Aug 31 10:01:20 2020 +0200

    Add 'replay' to re-play 2Mbps stream with realistic speed (to stdout)

commit 23103d3a8f9cc8b3f0ba602dbb4240040b2d008a
Author: Harald Welte <laforge@osmocom.org>
Date:   Sun Aug 30 15:41:12 2020 +0200

    dump: Use osmo_e1f to decode; send HLDC over GSMTAP

commit 7acd063a1245a34835d4488be3caad592f3c19d5
Author: Harald Welte <laforge@osmocom.org>
Date:   Thu Aug 20 16:48:15 2020 +0200

    dump.c: Add error plotting support

commit 90b90d04fff494b70ad220bd82ac48d43f3096c9
Author: Harald Welte <laforge@osmocom.org>
Date:   Mon Jan 13 18:20:39 2020 +0100

    dump: Add support for writing LAPD PCAP of E1 superchannel

commit f3a0cc34f0901c2cf257367351dddfddc6f7301e
Author: Harald Welte <laforge@osmocom.org>
Date:   Mon Jan 13 16:37:23 2020 +0100

    dump.c: Move handling of frames to separate function

commit 8deffb5907979e43e3a4236ea7bb8d54513513ac
Author: Harald Welte <laforge@osmocom.org>
Date:   Mon Jan 13 16:34:39 2020 +0100

    dump.c: remove local hexdump.[ch] and use libosmocore proper

commit 80d81e78737237ba3b6bae1deb7d5107d7f613b6
Author: Harald Welte <laforge@osmocom.org>
Date:   Tue Sep 1 13:52:52 2020 +0200

    tracer: use 0x6151 as PID

    See 5e68831b26

commit b219af27b34bbd6deb2419aa38852d8d227b9fc0
Author: Harald Welte <laforge@osmocom.org>
Date:   Mon Jan 6 13:47:28 2020 +0100

    e1-recorder: Don't silently ignore write failures

    The disk may be full, for example. We should report that to the user
    and terminate the program.

commit ead99fdfae6f1db54c79a91ef407a86c67352d87
Author: Harald Welte <laforge@osmocom.org>
Date:   Mon Jan 6 12:41:23 2020 +0100

    e1-recorder: Exit process on transfer + resubmit failure

    This is particularly importnat in case the USB device for some reason
    gets disconnected and re-connects.  We want the process to fail fast
    and have systemd respawn us.

commit a521e026c76056a60531c490fa2ef84e8e633c9a
Author: Harald Welte <laforge@osmocom.org>
Date:   Mon Jan 6 12:35:20 2020 +0100

    e1-recorder: use libusb_strerror() to decode error messages

commit 43a8fbdfdc35f5ba7564cfe5c92f43b124abf710
Author: Harald Welte <laforge@osmocom.org>
Date:   Sun Jan 5 19:49:58 2020 +0100

    e1-recorder: Acytually make '-r' (SCHED_RR) work

commit 84e28225d9ba1de9fb09660a96bd3b0b798c88d9
Author: Harald Welte <laforge@osmocom.org>
Date:   Sun Jan 5 17:53:11 2020 +0100

    e1-recorder: Add small 'dump' program

    This program will print one line for each E1 frame, where each line
    consists of 32 hex bytes: one for each timeslot

commit 0c697b40620b5d18480e626991dc639daadf58a6
Author: Sylvain Munaut <tnt@246tNt.com>
Date:   Sun Dec 29 13:13:17 2019 +0100

    projects/riscv_usb: Host software for the dual channel sniffer

    Signed-off-by: Sylvain Munaut <tnt@246tNt.com>

Closes: OS#5673
Change-Id: I9319c1eb8f822830307c1a181d357c58ce43efba
2022-10-31 08:28:43 +01:00
Sylvain Munaut c756644205 gateware: no_rw_check fixes to cope with new yosys BRAM inferrence
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ic27dc22112f6603982126d447689dbe2202039c4
2022-10-04 21:34:56 +02:00
Sylvain Munaut 9b3f2c4a6b icE1usb fw: Limit dfuprog to proper USB IDs
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Iaf96565b4068c2d6aa46d8bedac1fad618130a26
2022-10-04 16:16:20 +02:00
Sylvain Munaut db0b81065c icE1usb fw: Add support for building 1 channel version
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I147bb90fca3cead8db776ecfd60c23b4b8bafe2d
2022-10-04 16:16:20 +02:00
Sylvain Munaut dc1d741797 icE1usb fw: Add Notify PPS on Carrier Detect option
This is disabled by default because turns out the kernel doesn't
actually support PPS on CD for USB-CDC devices :(

And this also increase the interrupt traffic ...

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ie5d163434323a23912228003add9870fafefedf9
2022-10-04 16:16:20 +02:00
Sylvain Munaut da395cc922 icE1usb fw/gpsdo: If no PPS present for >= 3s, go to hold over mode
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ia85a8bb0e146cb117ea6e2704c6a4dedf215c75a
2022-10-04 14:58:18 +02:00
Sylvain Munaut b8fc8a6a64 icE1usb fw/gpsdo: Use PID loop instead of ad-hoc algo
The original algo is just somehting I originally came up with
on the spot and worked and I never got the time to revisit.

Now after some testing, I implemented a PID loop that seems to
present faster lock time and at least as good stability.

Parameters were not thorougly optimized just some 'hand' tuning
trying to simulate the behavior.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ie3ea7243aa4234585f1ace222632bb5580caca75
2022-10-04 14:54:36 +02:00
Sylvain Munaut ad0fc21d61 icE1usb fw/gpsdo: Use a struct for VCTXO dependent params
Not that useful for now, but prep for PID loop

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Iffea8992130eccd98a2952b08277e3d0d2568a1f
2022-10-04 14:43:56 +02:00