diff options
author | Harald Welte <laforge@gnumonks.org> | 2019-05-16 17:24:29 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2019-05-16 17:41:00 +0200 |
commit | 005b09d02442d283df9303441cb05a7bb71a052a (patch) | |
tree | 3c96743a78fac92eaa4728f8b3cfd634f64856a1 | |
parent | a74fe0c99956d55f2b3674664ec0b46934a687ea (diff) |
ccid_device: Export functions for generating async responses
The 'slot' implementation will need to be able to transmit certain
CCID messages by itself.
Change-Id: I16646dc89dc5b6c33f94bbb4eedc65acc8bbd6e2
-rw-r--r-- | ccid/ccid_device.c | 14 | ||||
-rw-r--r-- | ccid/ccid_device.h | 9 |
2 files changed, 16 insertions, 7 deletions
diff --git a/ccid/ccid_device.c b/ccid/ccid_device.c index d9e59b0..ff523d3 100644 --- a/ccid/ccid_device.c +++ b/ccid/ccid_device.c @@ -171,7 +171,7 @@ static int ccid_send(struct ccid_instance *ci, struct msgb *msg) } /* Send given CCID message for given slot; patch bSlot into message */ -static int ccid_slot_send(struct ccid_slot *cs, struct msgb *msg) +int ccid_slot_send(struct ccid_slot *cs, struct msgb *msg) { struct ccid_header *ch = (struct ccid_header *) msgb_ccid_in(msg); @@ -181,7 +181,7 @@ static int ccid_slot_send(struct ccid_slot *cs, struct msgb *msg) } /* Send given CCID message and mark slot as un-busy */ -static int ccid_slot_send_unbusy(struct ccid_slot *cs, struct msgb *msg) +int ccid_slot_send_unbusy(struct ccid_slot *cs, struct msgb *msg) { cs->cmd_busy = false; return ccid_slot_send(cs, msg); @@ -202,9 +202,9 @@ static struct msgb *ccid_gen_data_block_nr(uint8_t slot_nr, uint8_t icc_status, memcpy(db->abData, data, data_len); return msg; } -static struct msgb *ccid_gen_data_block(struct ccid_slot *cs, uint8_t seq, uint8_t cmd_sts, - enum ccid_error_code err, const uint8_t *data, - uint32_t data_len) +struct msgb *ccid_gen_data_block(struct ccid_slot *cs, uint8_t seq, uint8_t cmd_sts, + enum ccid_error_code err, const uint8_t *data, + uint32_t data_len) { return ccid_gen_data_block_nr(cs->slot_nr, get_icc_status(cs), seq, cmd_sts, err, data, data_len); } @@ -222,8 +222,8 @@ static struct msgb *ccid_gen_slot_status_nr(uint8_t slot_nr, uint8_t icc_status, SET_HDR_IN(ss, RDR_to_PC_SlotStatus, slot_nr, seq, sts, err); return msg; } -static struct msgb *ccid_gen_slot_status(struct ccid_slot *cs, uint8_t seq, uint8_t cmd_sts, - enum ccid_error_code err) +struct msgb *ccid_gen_slot_status(struct ccid_slot *cs, uint8_t seq, uint8_t cmd_sts, + enum ccid_error_code err) { return ccid_gen_slot_status_nr(cs->slot_nr, get_icc_status(cs), seq, cmd_sts, err); } diff --git a/ccid/ccid_device.h b/ccid/ccid_device.h index e7bb557..5b3a5bc 100644 --- a/ccid/ccid_device.h +++ b/ccid/ccid_device.h @@ -97,6 +97,15 @@ struct ccid_instance { void *priv; }; +int ccid_slot_send(struct ccid_slot *cs, struct msgb *msg); +int ccid_slot_send_unbusy(struct ccid_slot *cs, struct msgb *msg); +struct msgb *ccid_gen_slot_status(struct ccid_slot *cs, uint8_t seq, uint8_t cmd_sts, + enum ccid_error_code err); + +struct msgb *ccid_gen_data_block(struct ccid_slot *cs, uint8_t seq, uint8_t cmd_sts, + enum ccid_error_code err, const uint8_t *data, + uint32_t data_len); + void ccid_instance_init(struct ccid_instance *ci, const struct ccid_ops *ops, const struct ccid_slot_ops *slot_ops, const char *name, void *priv); int ccid_handle_out(struct ccid_instance *ci, struct msgb *msg); |