Kévin Redon
fe763b7698
sniffing: decrease USB IRQ prioprity to prevent USART overrun
...
Handling the USB message queue is done in an ISR and take quite some time.
This can cause a USART/SIM sniffing buffer overrun, resulting in data loss.
By setting the USB IRQ lower than the USART IRQ, the USB ISR can be
interrupted (for short) and no data gets lost.
Change-Id: I870a0aa8e251bbb53249c54bfcaa45de5b5a9486
2018-07-04 17:55:20 +02:00
Kévin Redon
c9bd715289
sniffing: fix procedure byte handling and make TPDU parsing more strict
...
Change-Id: If991152f11c4b864ab1386f21dc13c335e6b281f
2018-07-04 17:55:20 +02:00
Kévin Redon
35e8bdf879
sniffer: also send incomplete (e.g. timeout) data (PPS/ATR/TPDU)
...
Change-Id: Ib070aca181042b477f1ffec48d63dc56c1e4609a
2018-07-04 17:55:20 +02:00
Kévin Redon
709a431ab9
sniffing: move conversion convertion and flag processing from ISR to main loop to keep ISR fast and focus on data capture
...
Change-Id: Ieefa8a5f81dbcc12c1ad3059660dbffa0c1a4961
2018-07-04 17:55:20 +02:00
Kévin Redon
7406337a7f
sniffer: display F and D values frim PPS
...
Change-Id: I3641dcb6c24695a6d3dd3a1ee4333f56a07c99f0
2018-07-04 17:10:08 +02:00
Kévin Redon
de97fd25bd
sniffer USB: implement USB communication and send parsed messages
...
Change-Id: Ice7817480705f2124b08c1ff9a8826558b6d8b2b
2018-07-04 17:10:08 +02:00
Kévin Redon
012940f48e
USB device: add USB message structure for sniffer communication
...
Change-Id: Id2c6f32ade2fec9b9ef91bd8c5e1fd195f2d7351
2018-07-04 17:10:08 +02:00
Kévin Redon
a1012b170a
USB: add central file to define USB IDs, classes, and endpoints
...
Change-Id: Iba81f32a92c68a973e8e7adbc4c2a1064ba5290f
2018-07-04 17:10:06 +02:00
Kévin Redon
42bd026416
minor: fix typos in comment
...
Change-Id: I01b49e047a586dff449d4e134751108e391a8822
2018-07-04 16:33:00 +02:00
Kévin Redon
638cec820f
sniff: add WT timeout detection using USART timeout (TC is not required)
...
Change-Id: I4ec6e812e7e1eb91005027d2e864fc315550d79c
2018-07-04 16:33:00 +02:00
Kévin Redon
00ec89d73f
sniff: add TPDU parsing (TPDUs become APDUs on the upper layer)
...
Change-Id: I09d050d95bd2ab140fe6b4926a37278eb08cc347
2018-07-04 16:33:00 +02:00
Kévin Redon
cf59919494
sniff: print parsed ATR and PPS; use red LED to show main application is running; use green LED to indicate activity (message parsed)
...
Change-Id: I8e906bdbf2c91e608757ae442dfb241f981b8f1e
2018-07-04 16:33:00 +02:00
Kévin Redon
3113e3d2e5
update_fidi: remove debug output since this function is called in time critical ISR
...
Change-Id: I08f407d407a18dae3f360ddc64769ddfaeb5b559
2018-07-04 14:29:28 +02:00
Kévin Redon
8fa6ff5979
sniffer: use ISR to store sniffed data in buffer, add ATR and PPS parsing, and PPS related FiDi update
...
Change-Id: I4b38ce1d80e370fda6aa181e959ba3f1286bb922
2018-07-04 14:29:28 +02:00
Kévin Redon
4fe99fad59
ISO7816: change update_fidi to use provided USART
...
Also disables write protection for USART register if required
Change-Id: I716f4bc3a22800cbce402b146f14ef8b2aab2a98
2018-07-04 14:29:28 +02:00
Kévin Redon
d7a6de57d2
sniffer: add state definitions, improve IRQ handling, update pins configuration
...
Change-Id: I6b5dfd6d573ac122a60585a24c8a620642805ad5
2018-07-04 14:29:27 +02:00
Kévin Redon
353351ddf4
simtrace: add support for sniffing on both USART
...
Change-Id: I69eb458e7cb186c990e5d6fbc780f37fdd0cd884
2018-07-04 14:28:19 +02:00
Kévin Redon
ee62a9da56
simtrace: add dedicated power pins configuration for sniffing
...
Change-Id: Ie37edbae6ea42d2b0c2a30eb5590afd0be797d39
2018-07-04 14:28:17 +02:00
Kévin Redon
45ad62d8d4
sniff: use USART 0 instead of USART 1
...
Use USART 0 connected to the SIM card side to sniff the communication.
The card side can also measure ETU times.
Do proper pin initialization.
This code can already capture the ATR communication between phone and card.
Change-Id: I0597ec723cb2225540c89c3821b91d8a45adfcd6
2018-07-04 11:24:13 +00:00
Kévin Redon
7b73462442
sniff mode: handle USART 1 RX interrupt to show sniffer data
...
Change-Id: I5504369aed39844b7cf21e5b3ccb542daa6b946e
2018-07-04 11:24:13 +00:00
Kévin Redon
36abece0b1
enable (empty) sniffer support for SIMtrace board
...
Change-Id: I51619135fd6f5423542f261e7d76bab1a5713e2b
2018-07-04 11:24:13 +00:00
Harald Welte
05cc7f6531
ringbuffer: Don't print/TRAC from ringbuffer
...
In commit eac1bec428 we start to use the
ringbuffer inside the console printing code. As a result, we must not
use TRACE_*() or printf() from within ringbuffer.c code to avoid
infinite recursion.
Instead, let rbuf_write() return a negative return value in case the
ring buffer overflows. This way, the callers (outside the
console/stdout code) can print an error message themselves.
Change-Id: Ib009f013be119dbad22fa2b7d60ec8dee59baee5
2018-07-04 04:42:22 +02:00
Harald Welte
9d90d284ed
Use system include <foo.h> notation for libosmocore headers
...
the curent local copies of libosmocore headers + source is a temporary
hack anyway. We should instead rely on a system-wide install of
libosmocore cross-compiled for arm-none-eabi. But leave that as a
second (later) step beyond this patch.
Change-Id: Ia63fd842d45a2b404233b4326050e7eda0604cf0
2018-06-29 22:26:57 +02:00
Kévin Redon
a9bca48914
ring buffer: increase buffer size from 128 to 256 to cope with large debug output
2018-06-29 20:07:31 +02:00
Kévin Redon
f5869d4a59
USB: implement USB reset by setting the on-board pull-up on D+ low
2018-06-29 20:07:31 +02:00
Kévin Redon
a93f7273b3
fix: remove duplicate volatile declaration
2018-05-21 17:17:20 +02:00
Harald Welte
af616ec4e2
CCID driver: Use USBD_GetDriver() instead of non-initialized state variable
2017-11-29 00:45:23 +01:00
Harald Welte
6051e126da
CCID: re-enable control request handler for CCID class requests
2017-11-29 00:26:34 +01:00
Harald Welte
75cf93e04d
rename ccid.c to mode_ccid.c to align with mode_cardemu.c
2017-11-28 23:00:40 +01:00
Harald Welte
0633b25974
iso7816_4: Re-trigger watchdog while waiting for character
2017-11-28 22:47:09 +01:00
Harald Welte
ed75c62acf
{ccid,sniffer}.c: Add comments on USB callbacks
2017-11-28 21:23:12 +01:00
Harald Welte
5c081911a9
remove dead code (source/phone.c), superseded by card_emu.c/mode_cardemu.c
2017-11-28 21:21:50 +01:00
Harald Welte
5e6e8dcbde
Make build of CCID code succeed again on BOARD=simtrace
2017-11-28 20:58:06 +01:00
Harald Welte
ba2ad563cc
fix build of APP=cardem on BOARD=simtrace
2017-11-28 19:49:41 +01:00
Harald Welte
fc87c24326
mode_cardem: Build on platforms without WWAN_PERST suppotrt
2017-11-28 19:17:27 +01:00
Harald Welte
f231541601
Fix typos in usb.c, llist_irqsafe.h and dfu.h
2017-11-28 19:16:57 +01:00
Harald Welte
119624f46f
WIP: use local_irq_{save,restore}()
2017-11-04 12:28:30 +01:00
Harald Welte
7b36306113
[firmware] WIP: make talloc irq-safe
2017-11-04 12:17:09 +01:00
Harald Welte
965d5c918a
[firmware] cardemu: Skip CARD_INSERT if board doesn't support it
2017-11-03 20:48:11 +01:00
Harald Welte
c47fc5febf
set local slot LED according to remote/local state.
...
The LED is illuminated as long as the slot is in local (physical SIM
card) mode.
2017-05-20 14:46:57 +01:00
Harald Welte
3b646955b9
Fix swapped manufacturer/product strings
...
the */usb_strings.txt files always assumed that the first line is the
manufacturer string, followed by the product string in the second line.
However, the enum strDescNum had it the other way around. Let's fix it
by adjusting the enum to reality.
Fixes: SYS#3591
2017-05-14 23:15:11 +02:00
Harald Welte
23c00b6ad3
cardemu: Fix interpretation of MSGC_MODEM messages
...
msg->l2h should always point at the first byte of the header after the
generic simtrace header. For some reason this doesn't work if used
globally, but it is required for the MSGC_MODEM messages to be
interpreted correctly.
2017-05-11 01:11:43 +02:00
Harald Welte
b91f6ad848
firmware: fix various compiler warnings
2017-05-10 23:20:50 +02:00
Harald Welte
5c583d3535
Generalize SIM switching code and allow local/remote switching via USB
2017-05-09 13:24:28 +02:00
Harald Welte
2e9254ac3f
cardem: Implement WWAN Modem reset via USB
...
Using the SIMTRACE_MSGT_DT_MODEM_RESET message
2017-05-09 13:24:28 +02:00
Harald Welte
25a9a80ff5
Convert to new generalized SIMTRACE2 USB protocol
...
The current protocol was card-emulation specific. The new protocol is
generic/flexible enough to accommodate both tracing and card emulation,
as well as modem control and other future extensions.
2017-05-09 13:24:23 +02:00
Harald Welte
8e7fca3255
migrate from req_ctx to msgb
...
We now generalize the USB communiction and abandon the 'req_ctx'
structure inherited from openpcd. Instead we use the libosmocore 'msgb'
structure to handle incoming and outgoing USB tranfers. We also use
linuxlist-based msgb-queues for each endpoint.
2017-05-07 23:09:56 +02:00
Harald Welte
eb81d23a56
import libosmocore msgb handling (and dependencies)
...
This is supposed to be replaced with upstream libosmocore, as soon as
that has a proper maintained embedded build (again).
2017-05-07 13:18:36 +02:00
Harald Welte
9ac794c770
Add llist_add_irqsafe() similar to llist_add_tail_irqsafe()
2017-05-07 11:19:45 +02:00
Harald Welte
6d1128e9d1
QMOD: Add code to determine SIM Card presence
2017-05-05 23:17:27 +02:00