Commit Graph

5 Commits

Author SHA1 Message Date
Harald Welte
d79dc4f6f2 card_emu: Implement get_byte_pts() 2015-11-14 13:33:10 +01:00
Harald Welte
4c473dad30 card_emu: Fail with assert in case next_tpdu_state from wrong state 2015-11-14 13:32:05 +01:00
Harald Welte
612d65ad62 card_emu: Make update_fidi() void 2015-11-14 13:30:43 +01:00
Harald Welte
16cf408a49 card_emu.c: More comments about data structures 2015-11-11 19:02:48 +01:00
Harald Welte
9d3e38242c initial commit of more code towards card emulation
I couldn't help but to spend my sunday on working towards card
emulation, including
* various state machines in the target about ISO7816 states
* tc_etu timer import from simtrace1
* req_ctx import from simtrace1 (needs renaming and simplifiation)
* USB protocol description as cardemu_prot.h
* some host-based testing code to test the state machines

The code seems to work fine throughout card reset, sending ATR and
receiving the TPDU header of the first APDU, up to the point where it
marks the TPDU header as to-be-transmitted over th bulk-in endpoint.

Sending the ATR must be done inside the firmware for timing
requirements.

From that point onwards, the host needs to respond at the very least
with a procedure byte, and some indication whether or not the card
emulator should continue to transmit data (card->reader), or receive
data (reader->card).

The code is intentionally not hooked up yet with the USB logic nor with
the UART.  I want host-based testing completed before doing that.
2015-11-09 00:50:54 +01:00