aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2021-04-05simtrace2-cardem-pcsc: Make it work againlaforge/cardemHarald Welte1-23/+159
* support Interrupt STATUS notifications * use osmocom libusb abstraction * use asynchronous URBs for interrupt + bulk Change-Id: Ib04798572295f25477719124530b6584780c5b75
2021-04-05cardem: Use USART timeout for waiting timeHarald Welte6-24/+123
Instead of using the timer/counter peripheral to handle the waiting time and corresponding timeout, the USART peripheral internal timeout mechanism is used. This is particularly important for the SIMtrace board since there (contrary to other boards) the I/O signal is not wired to a TIO pin of the timer/counter block, and hence Rx/Tx data cannot reset that timer/counter. As a result of this migration, cardem is now supported not only on owhw + qmod, but also on the simtrace board. The guts of this change have been lifted out of Change-Id Ibcb2c8cace9137695adf5fb3de43566f7cfb93b5 by Kevin Redon, which was unfortunately touching various different topics at the same time and hence was split up. Some improvements are the introduction of the ENABLE_TX_TIMER_ONLY mode, which avoids the USART interrupt handler getting hammered with TXRDY between release of RST and start of the ATR. Change-Id: Ibcb2c8cace9137695adf5fb3de43566f7cfb93b5
2021-04-05card_emu: explicitly initialize PTS and TPDU statesHarald Welte1-0/+3
Those are already initialized at various transitions of the master 7816 FSM, but let's properly initialize them at start-up, too. Change-Id: I81b2a8ef3284559164700d94717e4ccf008f53df
2021-04-05card_emu: improve reset detection conditionsHarald Welte1-1/+2
* enter ISO_S_WAIT_RST when RST is asserted * enter ISO_S_WAIT_ATR only when we RST is released while in state ISO_S_WAIT_RST Change-Id: I620333aa8d45561a8028b948955a27f667b58406
2021-04-05iso7816_fidi: Add iso7816_3_ prefix to symbols; fix terminologyHarald Welte5-18/+19
Fi/Di are not the index into the table, but the contents of the table as resolved by Fi_index / Di_index. Let's clarify the terminology. Change-Id: If364e08e7c9a3a9707e6d54b9267c6a7c088e415
2021-04-05card_emu: Clarify and differentiate F/Fi/F_index/Fi_indexHarald Welte2-25/+45
The ISO7816 spec terms are well-defined, let's not abuse them. We used to consider "Fi" as the "index into the table of F values", while the spec actually considers Fi as the initial value for F. Let's make sure we use the terms quite clearly: * Fi and Di are the initial values for F and D * F*_index and D*_index are the indexes into the ISO7816-3 Tables Furthermore, let's track Fi separately from F, as e.g. the waiting time definition only considers Fi as indicated in the ATR, despite an actually different F value might have been negotiated via PTS meanwhile. Change-Id: Ieb2425e8380a81b79df7b2bd072902994e9c3ee7
2021-04-05card_emu.c: Rename fi to Fi and di to DiHarald Welte1-15/+14
As we will soon introduce the distinction between Fi and F, we should use uppercase letters, as lower-case 'f' is defined in ISO7816-3 as the frequency, which is different from the upper-case 'F'. Change-Id: Iaede621551520576e9b9af878fa46fbc88e59c2a
2021-04-05cardemu: different init for simtrace board which uses uart timersKévin Redon1-0/+13
Change-Id: I464f0ce1ec5e60be5f9377186b7d13a5e6dc637e
2021-04-05make sim switch board specificKévin Redon4-0/+152
the simtrace board uses a bus switch not used on qmod and owhw to switch the SIM between physical and virtual Change-Id: Ieaf2ed4761fc3e04f33f9aac5c04a768c9a6f71e
2021-04-05cardem: use edge-triggered VCC ADC logicKévin Redon1-2/+8
Before this patch, we used to st ci->vcc_active depending on the instantaneous ADC reading of VCC. Is it > .5v, we claim VCC is active, and if it's below, VCC is inactive. With this patch we move to an edge triggered approach: Only change ci->vcc_active if the previous reading was different from the current reading. FIXME: why? Change-Id: I71b703162219484e43638f1f2f692e9dd554ef55
2021-04-05card_emu: waiting_time is stored in etu, not clocks.Harald Welte1-1/+1
The comment didn't reflect the source. I checked all users and the code consistently stores the waiting time in units of 'etu'. Change-Id: I2bc4a7c19cee5fb487ad639ee48ecaea706f6172
2021-04-05Revert "add library providing ISO 7816-3 utilities"Harald Welte2-229/+0
This reverts commit 4a29f64cbe12ca9fbddd66ae10b614388fef5e9b. The code replicates to a large extent what is already present in iso7816_fidi.c and I have serious doubts about the correctness of the computation in its iso7816_3_calculate_wt() function.
2021-04-05Revert "add ISO 7816-3 library to remsim project"Harald Welte1-1/+1
This reverts commit 4a58c08d671adc928fea9dc12018c26818f24d4e. The code replicates to a large extent what is already present in iso7816_fidi.c and I have serious doubts about the correctness of the computation in its iso7816_3_calculate_wt() function.
2021-04-04minor add commentsKévin Redon1-8/+28
this is just to better understand the flow Change-Id: I045286836176da729cc8c863866d6f6aa3836592
2021-04-04rename PIN_PHONE_{CLK,IO} to PIN_USIM1_{CLK,IO}Kévin Redon1-3/+3
While this differs from tha naming in the schematics ({CLK,IO}_PHONE), this matches the naming scheme used for USIM2 and the naming on other boards. Change-Id: I486b14260faec897e8c8698c4b7987bf36492497
2021-04-04add ISO 7816-3 library to remsim projectKévin Redon1-1/+1
Change-Id: I99f3fecbc00d2379c3a6dc457b047c6fee41c292
2021-04-04add library providing ISO 7816-3 utilitiesKévin Redon2-0/+229
this will become part of libosmocore since it it common to smart card related projects (such as osmo-ccid-firmware) Change-Id: I3d4c65d137fc4555fcb256443feadd1c695de73d
2021-04-04cardem: currently simtrace does not support cardemKévin Redon1-1/+1
the SIMtrace board does not support the current card emulation application because this uses a timer counter to handle the timeouts, but on the SIMtrace board this is not connected to the CLK signal Change-Id: Idd09ea534179f0ede705573e1373dbd045c9828a
2021-04-04cardem: choose a more reasonable default ATREric Wild2-3/+38
PCSCd does not like invalid ATRs Change-Id: I1eebfdc06be55931c2e80e2b515ac3a559737c38
2021-04-04firmware: allow verbose buildsEric Wild1-6/+14
make V=1 can be used to echo all compilation commands, which is useful because it allows IDEs to parse the gcc output in oder to properly index the source files using the actual defines passed to the compiler. Change-Id: I25c41dff89302a73ddd2a4aaba7cb14912fac3b8
2021-04-04firmware: do not allow undefined symbolsEric Wild2-2/+7
For some reason undefined symbols were downgraded to warnings, which means building a firmware that calls missing functions (= address zero) was perfectly fine, which of course made development more exciting.... This applies to builtins, too, printf of one char gets downgraded to putchar, which we don't have, so disable builtins. Change-Id: I492f41ad4162b9d07b1881ae4aed019db2dff8b5
2021-04-04minor: use same LED pattern for cardem as other applicationsKévin Redon1-1/+2
Change-Id: I5608c3312b648c0d59f79338ef1f97b6fe08f5b9
2021-03-08contrib/prepare_upload.sh: fix cd problemsOliver Smith2-1/+3
Call the script from the proper directory, and cd into the topdir on top of the script. Fixes: /build/contrib/jenkins.sh: line 71: contrib/prepare_upload.sh: No such file or directory Related: OS#4413 Change-Id: Icbfaa5579aab887830ca90b24a2e322df8d98f4f
2021-03-05firmware: create duplicate files for upload onlyOliver Smith3-4/+15
Don't create copies of firmware files with version strings appended in the normal build. Only do this before uploading the firmware files. I have verified that "make" before this change and "make; contrib/prepare_upload.sh" after produce the same files. Close: OS#4413 Change-Id: I118a4ff397a178281c26a6b98112fa66b6f049ab
2021-03-05gitignore: add firmware/apps/*/usb_strings.txt.patchedOliver Smith1-0/+1
Change-Id: Ic99a5ae69ed755e6f74a1392678dcf71ab69e0d8
2021-03-05host: use git-version-gen/tarball-v. from topdirOliver Smith3-153/+2
Use .tarball-version from the topdir, because it only gets written there when generating the OBS package. Remove the duplicate git-version-gen script and use the one from the topdir to generate a version string if building from the git tree. Related: OS#4413 Change-Id: I4b197a218ab44632ff182ffbd72e15c2b20db341
2021-03-05firmware/Makefile: fix UNKNOWN in OBS packagesOliver Smith1-1/+1
Fix having the version set to UNKNOWN in all packages built by OBS. The osmo-ci.git scripts generating the source packages to be built by OBS generate a ".tarball-version" file with a version string like "0.7.0.70-657c", but it did not get used because the path was wrong. Related: OS#4413 Related: https://osmocom.org/projects/cellular-infrastructure/wiki/Git-version-gen Change-Id: Ic0b06011a604beec7c1c907c2c6e4ae927456e2e
2021-03-05d/source/format: new fileOliver Smith1-0/+1
Fixes: dpkg-source: warning: no source format specified in debian/source/format, see dpkg-source(1) Related: OS#4413 Change-Id: I4c474547233ebb87a1246b01fbd7ff8879921c21
2021-01-29dfu: let the device reset itselfEric2-4/+7
dfu flashing the ST12 was easy, but i was never able to get ST34 into dfu mode. Changing the firmware so it resets itself just like the octsim instead of starting a timer and waiting for a reset from the host made it work every time for me. Change-Id: Ida636ec925f40d6d56551f170150181350d03bbd
2020-10-27remove old pre-autoconf makefileHarald Welte1-28/+0
Change-Id: Icd519a69a5cb1950daa79df4d9864e8dea091289
2020-10-27Update READMEHarald Welte1-9/+8
it has been long out of date. Change-Id: I1137f33c5647f4d57a44224ee7259f3496edf1c4
2020-10-27rename simtrace2-remsim to simtrace2-cardem-pcscHarald Welte5-9/+9
This renaming is to avoid any confusion with the osmo-remsim project, living in its separate git repository. The simtrace2-cardem-pcsc doesn't feature any 'remote' part. Rather, it emulates the SIM card interface towards the device/phone/modem, and forwards it to a local PC/SC card reader. Change-Id: Ic15f0a89964a72fe3ab7a5145a073720f6207e24
2020-10-27remove usb2udpHarald Welte6-370/+43
The UDP based forwarding really only ever was a quick hack to demonstrate the capabilities. Meanwhile, we've had the proper osmo-remsim project implemented, which provides a much more reliable and comprehensive way of managing SIM card emulation devices (SIMtrace2, sysmoQMOD, ...) and collection of card readers (sysmoOCTSIM or any other PC/SC supported readers). Hence, remove the "UDP forwarding part. Change-Id: Ia4b9447b95872b6e0dda6dca644f1ed4a87355a0
2020-10-27remsim: adding cli argument to set the atrLeonard Hübner1-4/+20
Change-Id: I554b515e7954148f9ca5ba29417699da70b0945b
2020-10-18migrate from BSC_FD_* to OSMO_FD_*Harald Welte1-4/+4
Change-Id: I01c834537e18eacdd1658f88a4b4a6d4690d87a6
2020-08-16dfu: Save another 60 bytes by changing the way we print horizontal linesHarald Welte1-5/+16
Change-Id: I1660a04fb3e42200bc2fdd23aa114119620125a1
2020-08-16dfu: Shrink code by 144 bytes (by not calling PIO_InitializeInterrupts)Harald Welte1-2/+0
We are not using any PIO interrupts from DFU mode. It's only used in the main application firmware (verified by "git grep PIO_ConfigureIt") Change-Id: Id1447af519df3183061f3d3f156a8dd84789af16
2020-08-05firmware: fix builds with gcc stack smashing protection enabledHarald Welte2-1/+15
On Ubuntu 20.04 when builiding dpkg packages, even when cross-compiling firmware, gcc stack smashing protection is enabled. Let's provide what is minimally required in order to sucessfully complete builds on such platforms. Change-Id: Ic2f68f16b0730e7b5db17c30effc29a2909d1997 Closes: OS#4687
2020-05-25Introduce support for asynchronous USB transmissionHarald Welte3-15/+77
libosmo-simtrace2 traditionally had only supported blocking, synchronous I/O, while other osmocom programs such as remsim-client used asynchronous USB I/O. Using async USB I/O for IRQ + IN transfers while using blocking I/O for OUT transfers doesn't seem to work reliably, so we have to offer a way to perform the OUT transfers generated within libosmo-simtrace2 in async mode. Change-Id: Ib8939bdb7f533cd20a34a30a97f12b782b9816c2
2020-05-19contrib: integrate RPM specOliver Smith3-4/+3
Remove OpenSUSE bug report link, set version to 0.0.0, make it build with CentOS 8 etc. Related: OS#4550 Change-Id: I8595642bc07bf3044720942a0f1802448920cb50
2020-05-19contrib: import RPM specOliver Smith1-0/+103
Copy the RPM spec file from: https://build.opensuse.org/project/show/home:mnhauke:osmocom:nightly Related: OS#4550 Change-Id: I47ae01afb38fb18c462bf73501b49d6dc5d9f57f
2020-03-19simtrace2_siff: getopt_long() returns int, not charHarald Welte1-1/+1
This may be causing unwanted behavior while parsing the command line arguments, as reported by some Raspi users. Change-Id: I5b7db0795d16ab071e255c2c689e3b4872a933bb Related: OS#4223
2020-03-13pio_it.c: Permit repeated calls to PIO_ConfigureIt()Harald Welte2-7/+19
The original code assumes that calls to PIO_ConfigureIt() are only made once e.g. during board start-up. Hoewever, we call those at USB SetConfiguration time, when we know which particular hardware function we are supposed to perform. This means that after the host has issued SetConfiguration more than a given number of times, the code will assert() due to overflow of the static array. Let's check if we already have allocated an array slot for a given pin and reuse that allocated array bucket rather than allocating new ones for the same pin. Change-Id: I0c46d4b51eeebd58a8786d65e31e7a84e65b6a8e Related: OS#4454
2020-03-13USBD.c: Don't reset EP0 on SetConfiguration(0)Harald Welte1-1/+1
If we do this, the resulting USB code will fail on any of the USB-IF Chapter 9 tests. EP0 should not be reset. Change-Id: I070faf4cb7029d3ccfa6c63f8f04aa0f02657536
2020-03-03cosmetic: Add missing CR to LF in dispatch_received_usb_msg()Harald Welte1-1/+1
Change-Id: Ie1fc38ed4412b806e37688e0f9719573df06fd9f
2020-03-03extend osmo_st2_cardem_inst with fields required by osmo-remsimHarald Welte1-0/+4
Change-Id: Ib568e5212abfd1269a12c9e5672cdf23b4abff91
2020-03-01cardem: Fix infinite loop + watchdog reset on long OUT messageHarald Welte1-0/+1
In dispatch_received_usb_msg(), we ran into an infinite loop if a too long messages was received on the OUT EP. Let's break the loop. Change-Id: I5325ed15d3dd79a42f8dac34d618e86b9334c301 Closes: OS#4429
2020-03-01Disable interrupts during EEFC_ReadUniqueID()Harald Welte1-0/+7
Reading the Unique ID from flash is a rather tricky procedure: After the STUI command has been issued, we cannot read normal flash anymore. Rather, the unique ID is mapped at 0x00000000. This is unfortuantely also where the exception vector table is stored. EEFC_ReadUniqueID() is already linked to RAM, which is good. Hoewver, if an Interrupt happens between STUI and SPUI, then we try to access the vector table and code from flash, which is illegal. We run into a hardfault and stay there until the watchdog resets the processor. Change-Id: I3c4fad55b47e9013f6615a331983b3989ca805a7 Closes: OS#4428
2020-02-22simtrace2_api: Add osmo_st2_cardem_request_config()Harald Welte2-0/+16
In Change-Id I7cdd3f9171dbed45de0089defe29d2b59044bd84 we introduced firmware support for SIMTRACE_MSGT_BD_CEMU_CONFIG. The respective host part was so far only implemented in osmo-remsim-client-st2, but not in libosmo-simtrace2. Let's fix that. Change-Id: Ia4822d360a271d2ce9725f761cb95de58663ac3b
2020-01-30cardem: disable upload for simtrace2Eric Wild1-0/+2
cardem on the st2 has been broken forever and still does not work, so stop uploading cardem binaries Change-Id: I33828f799d41386afb3f8dcd9bb510902877e03f