mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-24 09:18:33 +03:00
card_emu: Factor out card_handle_reset() from card_emu_init()
Let's move all initialization of state that may change at runtime to a separate function: card_handle_reset(). This has the advantage that the related function may also be called at later/other instances, not just during initialization of card_emu. Change-Id: I0954d192d001a3af5592010cc84a3a22aaf4b030 Related: OS#4251
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/* ISO7816-3 state machine for the card side
|
/* ISO7816-3 state machine for the card side
|
||||||
*
|
*
|
||||||
* (C) 2010-2017 by Harald Welte <laforge@gnumonks.org>
|
* (C) 2010-2019 by Harald Welte <laforge@gnumonks.org>
|
||||||
* (C) 2018 by sysmocom -s.f.m.c. GmbH, Author: Kevin Redon <kredon@sysmocom.de>
|
* (C) 2018 by sysmocom -s.f.m.c. GmbH, Author: Kevin Redon <kredon@sysmocom.de>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -233,6 +233,13 @@ struct card_handle {
|
|||||||
} stats;
|
} stats;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* reset all the 'dynamic' state of the card handle to the initial/default values */
|
||||||
|
static void card_handle_reset(struct card_handle *ch)
|
||||||
|
{
|
||||||
|
ch->pts.state = PTS_S_WAIT_REQ_PTSS;
|
||||||
|
ch->tpdu.state = TPDU_S_WAIT_CLA;
|
||||||
|
}
|
||||||
|
|
||||||
struct llist_head *card_emu_get_uart_tx_queue(struct card_handle *ch)
|
struct llist_head *card_emu_get_uart_tx_queue(struct card_handle *ch)
|
||||||
{
|
{
|
||||||
return &ch->uart_tx_queue;
|
return &ch->uart_tx_queue;
|
||||||
@@ -1189,8 +1196,7 @@ struct card_handle *card_emu_init(uint8_t slot_num, uint8_t tc_chan, uint8_t uar
|
|||||||
ch->atr.len = sizeof(default_atr);
|
ch->atr.len = sizeof(default_atr);
|
||||||
memcpy(ch->atr.atr, default_atr, ch->atr.len);
|
memcpy(ch->atr.atr, default_atr, ch->atr.len);
|
||||||
|
|
||||||
ch->pts.state = PTS_S_WAIT_REQ_PTSS;
|
card_handle_reset(ch);
|
||||||
ch->tpdu.state = TPDU_S_WAIT_CLA;
|
|
||||||
|
|
||||||
tc_etu_init(ch->tc_chan, ch);
|
tc_etu_init(ch->tc_chan, ch);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user