/usr/lib/gcc/arm-none-eabi/11.3.1/../../../arm-none-eabi/bin/ld: cuart_driver_asf4_usart_async.o:/space/home/laforge/projects/git/osmo-ccid-firmware/sysmoOCTSIM/gcc/../atmel_start.h:15: multiple definition of `dma_m2m_complete_flag'; atmel_start.o:/space/home/laforge/projects/git/osmo-ccid-firmware/sysmoOCTSIM/gcc/../atmel_start.h:15: first defined here
/usr/lib/gcc/arm-none-eabi/11.3.1/../../../arm-none-eabi/bin/ld: command.o:/space/home/laforge/projects/git/osmo-ccid-firmware/sysmoOCTSIM/gcc/../atmel_start.h:15: multiple definition of `dma_m2m_complete_flag'; atmel_start.o:/space/home/laforge/projects/git/osmo-ccid-firmware/sysmoOCTSIM/gcc/../atmel_start.h:15: first defined here
/usr/lib/gcc/arm-none-eabi/11.3.1/../../../arm-none-eabi/bin/ld: main.o:/space/home/laforge/projects/git/osmo-ccid-firmware/sysmoOCTSIM/gcc/../atmel_start.h:15: multiple definition of `dma_m2m_complete_flag'; atmel_start.o:/space/home/laforge/projects/git/osmo-ccid-firmware/sysmoOCTSIM/gcc/../atmel_start.h:15: first defined here
/usr/lib/gcc/arm-none-eabi/11.3.1/../../../arm-none-eabi/bin/ld: stdio_start.o:/space/home/laforge/projects/git/osmo-ccid-firmware/sysmoOCTSIM/gcc/../atmel_start.h:15: multiple definition of `dma_m2m_complete_flag'; atmel_start.o:/space/home/laforge/projects/git/osmo-ccid-firmware/sysmoOCTSIM/gcc/../atmel_start.h:15: first defined here
/usr/lib/gcc/arm-none-eabi/11.3.1/../../../arm-none-eabi/bin/ld: usb_start.o:/space/home/laforge/projects/git/osmo-ccid-firmware/sysmoOCTSIM/gcc/../atmel_start.h:15: multiple definition of `dma_m2m_complete_flag'; atmel_start.o:/space/home/laforge/projects/git/osmo-ccid-firmware/sysmoOCTSIM/gcc/../atmel_start.h:15: first defined here
Change-Id: I9a72dc0101de84ce39530c1503b32620b4777b4a
The contrib/jenkins.sh script gets triggered daily. Do not upload new
files unless a new commit was added (then the filename changes).
Otherwise the binary and timestamp change on the server each day, which
is confusing and potentially makes catching regressions harder.
I've also considered disabling the daily trigger for this repository,
but I think it's better to keep it so we notice without much delay if
changes in libosmocore or the toolchain cause a build failure.
Change-Id: I3f70d6149b29ec2ff7f185dfae8bc8d4a1953dc2
This secretly disables the PPS exchange to set a different baud rate and
ensures proper multislot operation at the default rate @ 2.5Mhz.
Change-Id: I72bd2bbabe55c00e771626d2e473f6f8e88793d2
This should be fine, the slow clock for the uarts is not used for the
modes we're interested in, and the usb clock is derived from the usb sof
anyway, so it's not used as a reference there either.
This will most likely drift, but so did the external one, and a
free-running rtc without any external input was going to drift anyway,
considering the octsim is supposed to just run without being powered
down for a very long time.
Change-Id: I257b8854e1860ed698c4007efeb5d16e842b519a
hal/documentation/usb_device_async.rst has a few things to say about the
SOF clock recovery mode currently used for usb, so honor those settings.
Additionally Footnote 1 in chapter 54.14 of the SAM D5x/E5x Family Data
Sheet restricts the fine step value.
Change-Id: I5d573859517eab6febda0bac836c4461c0f21bf0
This led to a weird failed transfer _after_ poweroff of the slot upon
card removal, which is.... not what should happen, at least in case the
ccid side does not ignore it.
Change-Id: Ibabcc938d64a057ff60a2337a1320d0afb94032b
We should use service-aliases and not the primary host name, as
that makes migration between machines hard.
Change-Id: I63bac9d6767b21cb738be789f7efce2108804bdf
Libosmocore has a new dependency that doesn't make sense in a 'bare
iron' embedded environment, so let's disable it.
Change-Id: Icfff52601af80d73e61f5c5c3ed89b2d7185ed81
Uart errors will now lead to a (temporary) deactivation of the uart as well as
the deactivatin of the card + a a proper ccid response to notify the
host if the slot was busy.
Change-Id: Ia0efef03829b68d2b4f25899bb933b14fb9e0bd1
This does not currently work with "pcsc-lite version 1.8.26." because
the inverse conditon cards I know do not support the PPS exchange, which
according to spec leads to card deactivation, so the slots needs to be
powered up again, which does not happen.
osmo-sim-test works after manually disabling the pps exchange code in
the firmware.
Change-Id: I892e1d883825111cc1e4ea09589c4fdd256da03c
This requires a bit of inline explanation because it was not entirely straightforward,
and there were some unused states that can now be removed to make it more concise.
Change-Id: Id138a600dbe2dd1b8d153b764f73d65e2fd444dd
Error handling was difficult due to the need to pass msgb pointers
attached to the sub fsms back to the cb that is polled from the main
loop to be able free them, while ensuring they never get lost, because
memory leakage is deadly.
This is now fixed by using static pseudo-msgbs for the fsms that are
never deallocated. This only adds one tpdu tx copy, the ccid response
msgbs were already being copied anyway, so memory usage has not changed
except for the "unused slots" case that is not really important since
the octsim was designed around concurrent slot operation anway.
All of this allows convenient error handling in the allstate function
instead of having to spread it all over the sub fsms - in practice
handling errors mostly consists of card deactivation + returning a
proper failure message that matches the ccid command anyway.
Change-Id: I65e77c376aca9ed50e234a0b58a7450a8bbd4fe0
The calculation was still expecting timeouts measured in GT instead of
WT, so the actual wait time for empty sim trays (or unresponsive cards)
was 58 seconds instead of ~ 1.5s - a bit longer than necessary.
Total timeout if the atr reception has started is still approximately
45s as per spec (9600 ETU x 32).
Closes: OS#4815
Change-Id: I9f0ae104fac690127ab039ee7d9005e8d3896a1c
ETU calculation is 1 etu = fi/di * 1/f as per chapter 7.1.
wtime/WWT is usually mentioned as being 9600 etu in iso 7816-3 - but
it's actually specified for t=0 as WT=WI*960*Fi/f in chapter 10.2 - no
di involved here, so the rightmost fraction is not ETU!
-> as soon as di is not 1 after a pps exchange the timeout value was off
by a factor of di if it was just used as a multiplier for ETU.
Change-Id: Icd4fa83e1177873e90200529331d3a1fce8be1c6
This could have led to hangs when trying T=1 data blobs where the length
field is not the T=0 length field and is therefore misinterpreted.
Closes: OS#4805
Change-Id: Iacdf60e4401f8e287f60ea148b0944d0a3de491d
It seems some cards / transactions take longer than we expect, see
https://osmocom.org/issues/4742
With sysmoUSIM-SJS1 a timeout of 12.5ms is sufficient. But let's better
be tolerant here.
Change-Id: I85a7a0ae6195856fad17f249f0903f144a9aec85
Related: OS#4742
The timeouts had a minor off by a million problem because WT (in ETU) =
WI * 960 as per 7816-3 10.2, but WI was used as WT without the factor of
960 after the pps exchange, so WT (in ETU) was accidentally set to 10
instead of 9600 for the default WI=10.
Additionally that time was only added once, even though the wait time is
the time between the leading character edge of one character and the
next one, irrespective of direction, so the total wait time is this
multiplied with the number of expected bytes.
In practice this had no real effect due to to a reasonable minimum
timeout value and cards that were much faster than this.
Closes: OS#4742
Change-Id: I9ea0b6b51c8cc6f08a36b48e516c64b5e2bbaf9b
Usb init order is desc read -> reset-> set addr -> use device.
DADD.ADDEN is automatically cleared upon receiving a reset from the
host, at least according to the SAMD51 manual, but DADD.DADD is zero as
well (?) so it can't be used to check if usb was previously running and
the cable was pulled out and plugged in again while the device was
externally powered.
This works around this and ensures a device reset from the host leads to
a proper device restart and reinitialization in this case, there is no
state we want to keep in this case anyway.
Change-Id: I692de3dd98cfc30a010b457be87331e482632fb7
Closes: SYS#4908
This fixes the crash with external power if usb is disconected and
plugged in again, upon ep reset the completion cbs are called, but we
can obviously not interact with those EPs at that time and resubmit
buffers.
Change-Id: Icff17673b4d1d1616ee733580bdd6b5203b87139
Closes: SYS#4908
We used 0x2342 just for internal testing. Let's use a proper
unique allocation even for the FunctionFS version of the code.
Change-Id: Idbaf173b0ec1fd80885f26b3df24a4412913c100
When logging is enabled, we get a lot of LOGL_ERROR events
about RX_SINGLE events not being permitted. This is not very
useful in debugging, so suppress those error messages.
Change-Id: I7aec5fb2eaa76076e1bd0c6b8e8d09dc840c3630
If P3=0 and we only receive a status word directly, we were
returning a very long mostly zero-initialized buffer instead
of the status word. Reason: We used msgb_put() instaed of
msgb_put_u8(), so the SW1 determined the size of the message.
Change-Id: I01e688db020b3b8a8735d615e653cc816caa7a13
Closes: OS#4744
If we expect only a single byte in response to the TPDU header,
the cuart driver sends us RX_SINGLE events, not RX_COMPLETE events.
Change-Id: I3f025bc88b9aacc07ae87307328cec56efbac2ab
Closes: OS#4741