Commit Graph

17 Commits

Author SHA1 Message Date
Eric Wild e84a571c04 fix the host/emulation build
Going for __ARM__ to distinguish host and firmware builds is not
sufficient here, since we might be building on a ARM host, so there is
now a OCTSIMFWBUILD define.

Change-Id: Ib07a58b6102b1709f295d08a764c6f118a2d0b9e
2019-12-02 08:47:45 +00:00
Harald Welte 89b1e06803 Check for osmo_fsm_register() error return value
Change-Id: Id2556cf01341b67735fff2685d2f7532f50a4850
2019-12-01 13:30:14 +01:00
Eric Wild 2f5cdd1c46 first attempt at rx timeout handling
The general idea is to provide hints to cuart so it can calculate
a reasonable timeout value when receiving multiple bytes instead of
having per-byte timeouts

Change-Id: Ia6ad2d83cea48a8661ed2e4eb50f9bcb85218454
2019-11-28 13:42:16 +01:00
Eric Wild 759a646a05 fsm completion event handling from main loop
The main loop will now poll for finished/failed transactions and handle
them, this was previously handled during the last rx interrupt of a
transaction, which was bad for timing. This does also fix malloc/free
while handling interrupts.

Change-Id: I055110720089e20e65db592eccc3ce4d618e8c63
2019-11-28 13:42:16 +01:00
Eric Wild 9155231ef4 better ccid error handling, fix buffer leaks
Change-Id: Ib8b8524809e12608a7ade79ce7d7c3ced16eeb57
2019-11-28 13:42:16 +01:00
Eric Wild fd0baceb95 add a "no rx or tx" state
Change-Id: I27def4feff5a01b751fd48c5aa844ffdbb087f63
2019-11-28 13:42:16 +01:00
Eric Wild 9a2279cf63 debug code to measure uart timing using the CAN header
Change-Id: I5f2c174076b5599dcb56f887330de27f470aeffc
2019-11-28 13:42:16 +01:00
Eric Wild 9e622dc4b7 attempt at handling card insertion/removal
Change-Id: I88130de7f889811425c0a2ca4063ea8822c83f66
2019-11-28 13:42:16 +01:00
Eric Wild ad1edce363 ccid setparameters/PPS support
Change-Id: I280969ec9fe681dedae14ae8e6806f69eed3ff5a
2019-11-28 13:42:16 +01:00
Eric Wild 70d212d727 don't wait for TCK if card only supports T0
See 7816-3 8.2.5, T0 only (maybe implicitly) and no T15 = no TCK.
This could be handled by a timeout instead, but timeouts don't work yet.

Change-Id: Ice7bc4e603bbbbef88258af41f61e14a06727add
2019-11-28 13:09:56 +01:00
Harald Welte be86f852bc iso7816_fsm: Disable UART receiver when entering WAIT_TPDU state
Change-Id: Iab58c2ffba935152450f965338599cbaabb4662b
2019-10-09 22:30:31 +02:00
Harald Welte 1ac9ef9661 iso7816_fsm: Handle WTIME expiry during ATR reception
There are some cards that state a wrong length of the historical
bytes in their ATR header, resulting in WTIME expiry.  Let's dispatch
ISO7816_E_WTIME_EXP into the ATR FSM and treat it as normal ATR_DONE if
it happens during rx of historical bytes or TCK.

Also introdcue an ISO7816_E_ATR_ERR_IND for those situations where
waiting time expiration occurs during reception of TS/T0/TA/TB/TC/TD
bytes.

Change-Id: I62d47cb5e06b480941c67122f3c7d7a462ea2099
2019-10-09 22:30:31 +02:00
Harald Welte 704d99a247 iso7816_fsm: Allow ATR FSM to always return back to initial state (RESET)
Change-Id: I71adefadc43bc8f5db7ce043393f9143cd45684f
2019-10-09 22:30:31 +02:00
Harald Welte 6603d95119 card_uart_tx: Allow caller to specify if Rx should be active after Tx
This reverts commit 02dd911163.

Change-Id: Ibe02d283701dbfff5ab47e1b8195369c134cde03
2019-10-09 22:30:30 +02:00
Harald Welte 650878353f iso7816_fsm: Implement single-byte RX/TX
Change-Id: I31fb127e1cb2fda0856658a6511089c3d9e31c2a
2019-10-09 18:09:57 +02:00
Harald Welte 02dd911163 card_uart_tx: Remove last argument (we always have the receiver active)
Change-Id: I8f82e9108d0eae86bbe4535403ccc680b7379a0e
2019-10-09 18:09:57 +02:00
Harald Welte 06348367fa ISO7816-3 FSMs as osmo_fsm
This implements ISO 7816-3 T=0 as three finite state machines using
osmo_fsm.

Change-Id: I0145b77e6165d36d33f18ef3a452f2c37913bd73
2019-10-09 17:58:15 +02:00