Commit Graph

996 Commits

Author SHA1 Message Date
Harald Welte 651050922a simtrace2-tool: Initialize logging to avoid error on first log output
This avoids
 ERROR: osmo_log_info == NULL! You must call log_init() before using logging in log_check_level()

Change-Id: Id355ef33e10164f8e8eb40c2fd0b606bc8e9b6f7
2021-10-06 21:10:44 +02:00
Harald Welte 5b7a608277 simtrace2-cardem-pcsc: Remove double libusb initialization
This code already calls osmo_libusb_init further above in the top
of the main() function, so there's no use of calling libusb_init()
directly in the same function lines below.

Change-Id: I2e0c7446aaa644c5aae1059ce91ff9f729903cbc
2021-10-06 21:06:21 +02:00
Harald Welte e304015b3c Use osmo_libusb_{init,exit}() instead of libusb_{init,exit}()
We use other osmo_libusb_* functions later in the code, so it is best
to initialize the library via libosmousb, and not directly.

Change-Id: I2fd981935e1420e529f5dd8a98edd347c317284c
2021-10-06 21:06:06 +02:00
Harald Welte 19ccc209c1 jenkins.sh: Build 'trace' firmware for ngff_cardem
Let's create and publish binary builds for 'trace' on BOARD=ngff_carde.

According to SYS#5525 this is verified working since two months ago, so
there's no reason to withhold the binary builds for it.

Change-Id: I8a98002ef5aa58e5a3d49627323fe11505508bc8
Related: SYS#5525
2021-10-06 21:01:14 +02:00
Eric Wild 5e82a2a1c6 Revert "firmware: data sections"
This reverts commit e6a76c7bf4.

Might or might not cause weird issues depending on gcc and binutils
versions, let's see if this helps.

Change-Id: I2f593fd5e0f1494aae6b9fcfb2160a6c9168f5b8
2021-10-04 18:05:45 +02:00
Eric Wild 301aec51f7 contrib/jenkins.sh: lower trace to make bl fit
We keep running out of rom space, so reduce tracing to nothing for alle
dfu targets, and let's hope newer gcc versions stop producing more
code...

Change-Id: I7d2947c84097035bed00ad489a175d614b4c388e
2021-10-04 15:07:44 +00:00
Eric Wild 1f75e3881c contrib: allow manually forcing bulk simtrace dissection
Change-Id: I5fcfe3c221b87b02e21c857ac51d0392c3b4de3c
2021-08-09 15:18:59 +02:00
Eric Wild 5beffa5d91 contrib/jenkins.sh: build ngff_Cardem dfu bootloader
It does fit with some compiler versions, while others overflow the bl region,
so just reduce the trace level a bit to make it fits all the time.

Change-Id: I168a847da8dfc585aaeef0030f95fc225a713147
2021-08-09 12:45:13 +02:00
Harald Welte 3092721729 contrib/jenkins.sh: Build APP=cardem for BOARD=ngff_cardem
This makes sure downloads.osmocom.org will get cardem images
for the new ngff_cardem board.

The dfu loader was not enabled as it currently overflows the ROM
region by 200 bytes, see OS#5210.

Change-Id: Id2b7925c823fb19f880e06a205764d2b19de4ad4
Related: OS#5210
2021-08-08 21:31:03 +02:00
Eric Wild 7ca68359f3 cardem: fix spurious NULL bytes during transfers
The "wait time extension timer" was apparently not being reset during
normal tx operations, which led to occasional NULL (0x60) bytes getting
injected into transfers, which in turn led to more tx bytes than what
the reader side expects...

The odd thing is that this was only noticeable with high baud rates,
probably due to the very long default WT of 9600 ETU, and even then only
because it led to weird ngff modem resets after benign transfers.

Change-Id: I15b0b83b7d93b8e5589f3640bd6eb2fc82f93394
Related: SYS#5553
2021-08-08 04:14:38 +02:00
Harald Welte a951c4ae02 simtrace2.spec: Add simtrace2-tool binary to package
This fixes RPM build issues reported as

[   59s] error: Installed (but unpackaged) file(s) found:
[   59s]    /usr/bin/simtrace2-tool

Change-Id: I1fd5980a686652afb47cd1c30e12919de626aec7
2021-08-03 09:02:34 +02:00
Eric Wild d1d504bfa5 firmware: trace for ngff
Change-Id: Iee1eedd93d72c02880fd59fb8588abe14d05e77b
2021-08-02 15:10:21 +00:00
Eric Wild 23a9771467 contrib: more cardem dissection
Change-Id: Ia74d3674f854b390c9745a1cb8d5756bd5d39540
2021-08-02 09:23:19 +00:00
Eric Wild a755b53768 simtrace2-cardem: use local sim on exit
There is no obvious reason why the st should be stuck in cardem mode
without a working running util on the host side since there is no state
that is being kept, so switch back to using the local sim upon reset.

Change-Id: Ib622af0027d40b4e8afbb0fa0d3689f0dbfcac92
2021-08-02 09:23:19 +00:00
Eric Wild 1ad205e682 firmware: make the ngff beakout blink
..but only if the cardem sim is active

Change-Id: I65f1fbeb06690a143ef4c792728c9cb917a4ffde
2021-08-02 09:22:46 +00:00
Eric Wild 34317c1f32 firmware: proper makefile deps
Single threaded evaluation is (assumed to be!) left to right, depth
first - but with concurrent make using -j this breaks, because the
actual usb string header is generated after the attempt to concurrently
compile the code that needs it, since there is no explicit order among
the all: dependencies.

This is fixed by properly adding a dependency on that header.

Change-Id: I0bdf915deabeda861f6398e654764918e58a64c2
2021-08-02 09:22:46 +00:00
Eric Wild e6a76c7bf4 firmware: data sections
Might or might not be compiler default, but why guess?

Change-Id: Id3da816611afea0858466949dcc47db5e5d5493a
2021-08-02 09:22:46 +00:00
Harald Welte 4fe93be725 introduce support for new ngff_cardem board
This adds support for the new ngff_cardem board, a board that
basically combines a ngff breakout board with a built-in SIMtrace2.

Cardem works, but depending on the modem it might need a adjusted ATR to
ensure a lower baud  rate is used by the modem, high rates might lead
to weird power cycling of the card after a few transfers.

Trace was also tested and appears to work as expected.

Change-Id: Ia96124fbe8a752c98e7fd4096d542a3b2b9bc255
2021-08-02 09:22:46 +00:00
Harald Welte 51d87fbb66 Introduce simtrace2-tool
The simtrace-tool is a command line tool which can be used to e.g.
manually request a modem reset.

Change-Id: I3a8896ac2b3caef7590b51118359e5caed820a40
2021-08-02 09:22:46 +00:00
Oliver Smith c7490b46cd gitreview: new file
Change-Id: I650fe7c930392d24042e65295fa49400478ffab9
2021-07-30 10:32:35 +02:00
Harald Welte c85f39078c contrib/flash.py: Add OCTSIMTEST support
Change-Id: Id906d955f45a204ac0b00f56d8f5149c64c62f32
2021-07-09 11:46:16 +00:00
Harald Welte 06fe3b8295 99-simtrace2.rules: Add OCTSIMTEST
Change-Id: I226ee21e0937f851428578578f81075fa703dd54
2021-07-09 11:46:11 +00:00
Harald Welte d0c420055d board_gpio.gnumeric: Add ngff-cardem pin-out
Change-Id: Ie1a7be85200e331232ad52aa0468c748ff053142
2021-07-01 23:28:52 +02:00
Harald Welte 3ef40d1ca6 simtrace2-list: Use osmo_st2_compatible_dev_ids[]
we shouldn't use a local copy of the device id list, which is already
outdated now that OCTSIMTEST support has been added to libosmo-st2

Change-Id: I2231006b94c33fe3b28ce37b0d54c67206751058
2021-06-30 08:17:58 +00:00
Harald Welte dcfea28a4f don't printf() directly from library code, go via libosmocore logging
This allows us to use different log levels, and permits the user to use
other log targets.

Change-Id: I08ef7cfa5d8734882746a11ccd5f059d757401ae
2021-06-30 08:17:58 +00:00
Eric Wild 264f615b65 cardemu: support 1v8 for the tester
The tester has shifters, while the original simtrace relies upon the
reader restarting the powerup attempt with > 1v8 after not respondig due
to a lack of shifters and therefore 1v8 support.

Change-Id: I520aa26c6e0fb34568a4f632943efa59a0da831c
2021-06-26 02:54:20 +02:00
Eric Wild 017e10e9ef cardem: free the buf
This leak was probably hard to notice since config commands are usually
rarely sent.

Change-Id: I21411ef78a32a5258a7008272774cdb83119b413
2021-06-21 23:46:38 +02:00
Eric Wild f0653533cc contrib: add a basic simtrace lua dissector for wireshark
See Help->About Wireshark->Folders tab,the usual place this should go is
~/.local/lib/wireshark/plugins
Hot reload possible after editing using Analyze->Reload Lua Plugins

Change-Id: I360ab522dabc3a378969df36efd3b48fc4cade3c
2021-06-21 17:38:53 +02:00
Harald Welte f2e924c4aa firmware: octsimtest: ensure all card_insert GPIO are 0 after reset
Change-Id: I3c3744673ba53750cb66aa5023c8228edb006bfc
2021-06-06 11:46:49 +02:00
Harald Welte efb47b3fae firmware: octsimtest: Add i/I command for setting card-insert via I2C GPIO
Change-Id: Ie1483ccf8465df0d640d55e50421fda910dced4a
2021-06-06 11:46:49 +02:00
Harald Welte 2b1d1e6d92 firmware: octsimtest: Fix disabling the card_insert signal
Back in I8c9b0c3d862a967832134b24252577739182da62 we added support
for enabling the card_insert signal, but not for explicit disable
of it.  Let's fix that.

Change-Id: I6f32bde60674119c9912e51059a53b5ee74d074a
2021-06-03 15:06:58 +02:00
Harald Welte e2971dee2a firmware: octsimtest: use TRACE_* macros instead of direct printf
Change-Id: I41864bc2f64905a4f2ccb50769b1840e8a490c76
2021-06-03 14:37:45 +02:00
Harald Welte 731e199fc4 firmware: octsimtest: Support SIMTRACE_MSGT_DT_CEMU_CARDINSERT
The octsimtest board can control the card-insert contact of the OCTSIM
under test via an external I2C gpio multiplexer; let's add support for
that.

Change-Id: I8c9b0c3d862a967832134b24252577739182da62
2021-06-03 14:37:45 +02:00
Harald Welte f69a60f255 firmware: cardem: re-factor CARDINSERT command processing
move it out of the general command dispatch switch statement
and into a separate function.

Change-Id: Ia40c3d9999be68248da0dcc69d298450ca6e4869
2021-06-03 14:37:45 +02:00
Harald Welte dd5794c975 firmware: octsimtest: mcp23017 initializaiton
* driver should not have hard-coded understanding about I/O directions
* board code should pass the I/O direction to driver
* board code should use the correct I/O directions (A0..7, B0: output)

Change-Id: Id4a8e012a33cee01bb489e612e17920760b9be59
2021-06-03 14:37:45 +02:00
Harald Welte d46f6bae2c firmware: octsimtest: Make slot mux configurable via USB
Change-Id: I4cdb250d2e1dbc5b8b0169f8b7c21e288b492e1d
2021-06-03 14:37:43 +02:00
Harald Welte 3561fc4c8b firmware: octsimtest: Fix IO_DIR pin definition
Change-Id: I776c9106bcd4ceb24a5d50ea05c6025dedb73822
2021-06-03 14:32:36 +02:00
Harald Welte b69f5a85b3 contrib/jenkins.sh: Build 'cardem' app for 'octsimtest' board
Change-Id: Ia38bbb85c2828ab7307ffe688e50d7cdf70d6d39
2021-06-03 09:36:10 +02:00
Harald Welte 4996d7d634 octsimtest: Adjust VCC voltage thresholds (resistive VCC divider)
octsimtest has a resistive voltage divider in front of the VCC ADC
in order to also detect 5V.  We must make the thresholds board-specific
and adjust them for octsimtest.

Change-Id: I9e4adb4f349d2d838ea4100eb49271f3a0e7a2a5
2021-06-03 09:36:10 +02:00
Harald Welte 054d7ca499 cardem-pcsc: initialize libosmocore logging
Change-Id: I815d39190e944d9512ffc8e5f581515d7be9834f
2021-06-02 22:57:10 +02:00
Harald Welte 5b825beb41 octsimtest: Switch direction of I/O level shifter depending on uart tx / rx
Contrary to other hardware designs, octsimtest has a level-shifter in
the I/O line to support testing with 1.8, 3 and 5V.  This level shifter
is bi-directional, but the direction needs to be explicitly specified
via the SIM_IO_DIR signal attached to PA26.

Change-Id: I44171363b5bd69d6049b12c86f8143be83557cb2
2021-06-02 22:57:10 +02:00
Harald Welte 31d103b9f6 octsimtest: most code for support of this new board
* code for controlling the Card slot + frequencyt divider muxes
* put everything in place to build cardem application for it

Change-Id: I7e03e0c0f2999a1ce2dad966d98e22033fa58465
2021-06-02 22:56:12 +02:00
Harald Welte 73466e2b89 octsimtest: remove lots of unused #defines
The octsimtest board only supports cardem mode, not 'ccid'
nor 'sniffer'.  Remove related GPIO pin #defines from board.h

Change-Id: I43e8631d945ba183a1e5b1e37dd4565adb377154
2021-06-02 22:56:04 +02:00
Harald Welte 913c86b95d Add usb product ID of sysmoOCTSIMTEST
This is a custom board for production testing of the sysmoOCTSIM,
an 8-slot smart card reader.

Change-Id: I65839be50ac896c76f34755fb2800f836f6cdae4
2021-06-02 10:09:40 +02:00
Harald Welte 0516464620 assert: Use printf_sync() to ensure printing of assert / panic
Change-Id: Icc202e60445d9be1cdcd61176db5ed1704d583e7
2021-06-02 09:12:35 +02:00
Harald Welte c1033c8611 simtrace2-cardem-pcsc: Reset the real card if reader resets cardem
When the cardem detects a reset from the phone/modem, pass this on
to the actual card via the PC/SC reader.  This is important to
reset the card state whenever requested by the stack/driver on the
phone/modem.

Change-Id: I7056476c5f81e8aa8f550afb86bf2380d1497ebb
Depends: libosmocore 20199da02d37a6d284915a27ec12641e79b8781c
2021-06-01 21:09:05 +02:00
Harald Welte 644c2131ca simtrace2-cardem-pcsc: Decode STATUS flags to strings
SIMtrace IRQ STATUS: flags=0x13, fi=9, di=6, wi=10 wtime=9600 (RESET VCC  CLK )

is more understandable than

SIMtrace IRQ STATUS: flags=0x13, fi=9, di=6, wi=10 wtime=9600

Change-Id: I5bbfa1d99ebee4b297d894a5f444dbe743c7ab70
2021-06-01 21:09:05 +02:00
Harald Welte 796501293d Revert "cardem: disable upload for simtrace2"
This reverts commit baa62777c8 which
deleted simtrace-cardem builds to prevent them from being published.

Change-Id: I63fd4bea2985fcc87f202d8b69a4f24661858185
2021-06-01 18:47:37 +02:00
Harald Welte e33c2907bc jenkins.sh: build 'cardem' firmware also for simtrace board
Now that it is supported, we should also build + publish the related
binaries.

Change-Id: I9231503b865adc863959d74d98e7f24f83c293e9
2021-06-01 18:38:25 +02:00
Harald Welte 0f75d6ef1e simtrace board.h: Enable HAVE_CARDEM if we build the cardem firmware
likewise, enable HAVE_SNIFFER currently only if we build the sniffer
firmware.

It's been many years too long to finally get those all merged in one
firmware :(

Change-Id: Ib433f180746f75458a44f4988643465bd846b04b
2021-06-01 18:38:21 +02:00