Commit Graph

725 Commits

Author SHA1 Message Date
Kévin Redon
36be182ea2 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-03 16:10:04 +02:00
Kévin Redon
bdb0795e61 buffer: increase buffer size to 512 to cope with fast and long TPDUs
Change-Id: I194c90cf09306a982d80c5bf1222397af6e658a9
2018-07-03 16:03:17 +02:00
Kévin Redon
b65e4b6823 console: drop data to be send when buffer is already full
Change-Id: Ia625b09eb30bb7b43edd3989f697d8ef33200f28

don't wait for space to be available in the buffer since since would
prevent from processing non-console (e.g. debug) more important data
2018-07-03 15:59:57 +02:00
Kévin Redon
05cc8bd36a sniffer: display F and D values frim PPS
Change-Id: I3641dcb6c24695a6d3dd3a1ee4333f56a07c99f0
2018-07-03 15:57:03 +02:00
Kévin Redon
de6e3488a0 Merge branch 'kredon/simtrace' of ssh://gerrit.osmocom.org:29418/simtrace2 into kredon/simtrace
Change-Id: Id868520d6603f2bcb79a0aaaf6413dc83938524b
2018-07-01 19:02:40 +02:00
Kévin Redon
f6c2f4def3 host USB: add host application to receive and display USB sniffing messages sent by firmware
Change-Id: Idefbf21e0bbd2a1e3647fe9aebaf88d1b62dae2d
2018-07-01 18:33:28 +02:00
Kévin Redon
f9f1261c18 sniffer USB: implement USB communication and send parsed messages
Change-Id: Ice7817480705f2124b08c1ff9a8826558b6d8b2b
2018-07-01 18:33:28 +02:00
Kévin Redon
310ad81bad USB device: add USB message structure for sniffer communication
Change-Id: Id2c6f32ade2fec9b9ef91bd8c5e1fd195f2d7351
2018-07-01 18:33:28 +02:00
Kévin Redon
1c84e5e312 host USB: use central SIMtrace USB ID definition header
Change-Id: Id18e64fba0a2c308a8aef7d3865200bf0237cae9
2018-07-01 18:33:28 +02:00
Kévin Redon
c06b1d6f7c host usb_util fix: used provided class, sub-class, and interfave when finding matching interfaces
Change-Id: Ibc06e751e6ca0f9e9a40d82c4eeddfb975240f91
2018-07-01 18:33:28 +02:00
Kévin Redon
0c9079f1ae USB: add central file to define USB IDs, classes, and endpoints
Change-Id: Iba81f32a92c68a973e8e7adbc4c2a1064ba5290f
2018-07-01 18:33:28 +02:00
Kévin Redon
cb700ef087 reintroduce adc2uv used in boardver_adc.c and mode_cardemu.c
Change-Id: I52e3919adfd1d888eb130b5ec9298315c4e507c9
2018-07-01 18:33:28 +02:00
Kévin Redon
4635c71c06 minor: fix typos in comment
Change-Id: I01b49e047a586dff449d4e134751108e391a8822
2018-07-01 18:33:28 +02:00
Kévin Redon
6123460055 sniff: add WT timeout detection using USART timeout (TC is not required)
Change-Id: I4ec6e812e7e1eb91005027d2e864fc315550d79c
2018-07-01 18:33:28 +02:00
Kévin Redon
15a3384e9a sniff: add TPDU parsing (TPDUs become APDUs on the upper layer)
Change-Id: I09d050d95bd2ab140fe6b4926a37278eb08cc347
2018-07-01 18:33:28 +02:00
Kévin Redon
f40c10d2f2 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-01 18:33:28 +02:00
Kévin Redon
8fd88b8a59 LED: add short LED pulse blinking pattern
Change-Id: I0fdc2f902a3b92da6aa9b9c8500abae8a2f79447
2018-07-01 18:33:28 +02:00
Kévin Redon
10553e7f0c update_fidi: remove debug output since this function is called in time critical ISR
Change-Id: I08f407d407a18dae3f360ddc64769ddfaeb5b559
2018-07-01 18:33:28 +02:00
Kévin Redon
833a540efa DFU: switch green LED on to indicate DFU mode, and red LED to indicate flashing activity
Change-Id: I8e34fd869ed94ad122d6a17f5a432f5a09b820bb
2018-07-01 18:33:28 +02:00
Kévin Redon
23d7306ef0 board: fix LED pin definition
Change-Id: Ia6c80c0268dec708845e1dad281caaa42027f9db
2018-07-01 18:33:28 +02:00
Kévin Redon
4646e04d1f DFU: remove force bootloader button debug message since the console is output message is not initialized yet
Change-Id: Ibea0105929a8dc38b43dacd9d1e576d7b51d0c6a
2018-07-01 18:33:28 +02:00
Kévin Redon
216a2149e1 sniffer: use ISR to store sniffed data in buffer, add ATR and PPS parsing, and PPS related FiDi update 2018-07-01 18:33:28 +02:00
Kévin Redon
13f720b650 trace: increase watchdog for 500 to 2000 ms to provide more time handling buffered data 2018-07-01 18:33:28 +02:00
Kévin Redon
ae1ce57d4c ISO7816: change update_fidi to use provided USART, and disable write protection for USART register if required 2018-07-01 18:33:28 +02:00
Kévin Redon
5dce338c6b SIMtrace: enable interrupt on edge dection for SIM_RST pin to reset the sniffer ISO state 2018-07-01 18:33:28 +02:00
Kévin Redon
ad6e7eff00 SIMtrace: fix default SIM_RST pin state to allow phone controlled reset 2018-07-01 18:33:28 +02:00
Kévin Redon
5b63e437bc SIMtrace: only enable main sniffing mode on SIMtrace board 2018-07-01 18:33:28 +02:00
Kévin Redon
915f1636b0 sniffer: add state definitions, improve IRQ handling, update pins configuration 2018-07-01 18:33:28 +02:00
Kévin Redon
04a63b386e simtrace: add support for sniffing on both USART 2018-07-01 18:33:28 +02:00
Kévin Redon
b88c73bcfd board: comment USART definitions and add corresponding IRQ numbers 2018-07-01 18:33:28 +02:00
Kévin Redon
1225e41aad simtrace: add dedicated power pins configuration for sniffing 2018-07-01 18:33:28 +02:00
Kévin Redon
7ddf46ce1c 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.
2018-07-01 18:33:28 +02:00
Kévin Redon
5a7c848b43 SIMtrace board: comment and fix pin definition 2018-07-01 18:33:28 +02:00
Kévin Redon
aa70887ce0 sniff mode: handle USART 1 RX interrupt to show sniffer data 2018-07-01 18:33:28 +02:00
Kévin Redon
baff8d2c22 add more USB configuration checks and error messages 2018-07-01 18:33:28 +02:00
Kévin Redon
7bcbae3ad9 enable (empty) sniffer support for SIMtrace board 2018-07-01 18:33:28 +02:00
Kévin Redon
33d62aa17a copy working cardem app to trace
because the applications share the board capabilities defined in
libboard/*/include/board.h and USB configurations are enabled according
to the previously defined capabilities in libcommon/source.usb.c, all
applications actually offer the same functions.
thus creating the trace application is only mainly a cosmetic change, as the
sniffer function will also be present and enabled in the cardem application.
2018-07-01 18:33:28 +02:00
Kévin Redon
e4cd52c2e3 fix: remove unused code
adc2uv is not used in boardver_adc.c.
a FIXME comment says it should be shared with mode_cardemu.c.
the exact same code is already available in mode_cardemu.c
2018-07-01 18:33:28 +02:00
Harald Welte
cb6e20596e contrib/jenkins.sh: Also run firmware tests + build-test host software
Change-Id: Ie53857164d0a21daac334057c5bafbfd9912bf4b
2018-07-01 16:33:25 +02:00
Harald Welte
bb2eb19fb1 firmware/test: Add more include paths
Change-Id: I4287fbae6921ed0605265812df5d7243e8857864
2018-07-01 08:47:39 +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
Harald Welte
ebe8b2069c Makefile: fix automatic creation of obj directory
since we're using obj/$BOARD, we must use "-p" to create the directory
recursively
2018-06-29 21:44:12 +02:00
Harald Welte
105c1dce4f add contrib/jenkins.sh for build verification
The contrib/jenkins.sh script will build all supported apps for all
supported builds.  It will be used by jenkins/gerrit build testing.
2018-06-29 21:39:42 +02:00
Harald Welte
1cfc2614dd apps/dfu/main.c: Avoid variable declaration in for loop initial
This fixes the following compile error:

apps/dfu/main.c:73:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
   for (unsigned int i=0; i<len; i++) {
   ^
apps/dfu/main.c:73:3: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code

which was recently introduced in b73f0a00bc
2018-06-29 21:07:41 +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
eac1bec428 console: use buffer and interrupts instead of busy loops for UART debug output 2018-06-29 20:07:31 +02:00
Kévin Redon
51c128bc35 DFU: fix typo in USB strings 2018-06-29 20:07:31 +02:00
Kévin Redon
869dbfafe4 DFU: incread watchdog timeout and restart watchdog before writing in flash to prevent the watchdog to trigger while flashing 2018-06-29 20:07:31 +02:00
Kévin Redon
80303c135b DFU: only boot the application if it has a valid start 2018-06-29 20:07:31 +02:00
Kévin Redon
d86cab0080 DFU: uncomment print message when DFU is forced using the button 2018-06-29 20:07:31 +02:00