This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/14058 Change subject: Add ccid_device.h file for ccid_device.c ...................................................................... Add ccid_device.h file for ccid_device.c Change-Id: I1b171ede38deebfa525a0ee10865da2dc5ec7e4e --- M ccid/ccid_device.c A ccid/ccid_device.h 2 files changed, 71 insertions(+), 48 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/58/14058/1 diff --git a/ccid/ccid_device.c b/ccid/ccid_device.c index 02d1599..b7077df 100644 --- a/ccid/ccid_device.c +++ b/ccid/ccid_device.c @@ -8,40 +8,7 @@ #include <osmocom/core/utils.h> #include "ccid_proto.h" - -#define NR_SLOTS 8 - -struct ccid_pars_decoded { - /* global for T0/T1 */ - uint8_t fi; - uint8_t di; - enum ccid_clock_stop clock_stop; - bool inverse_convention; - - struct { - uint8_t guard_time_etu; - uint8_t waiting_integer; - } t0; - - struct { - enum ccid_t1_csum_type csum_type; - uint8_t guard_time_t1; - uint8_t bwi; - uint8_t cwi; - uint8_t ifsc; - uint8_t nad; - } t1; -}; - -struct ccid_slot { - struct ccid_instance *ci; - uint8_t slot_nr; - bool icc_present; - bool icc_powered; - bool icc_in_reset; - bool cmd_busy; - struct ccid_pars_decoded pars; -}; +#include "ccid_device.h" /* decode on-the-wire T0 parameters into their parsed form */ static int decode_ccid_pars_t0(struct ccid_pars_decoded *out, const struct ccid_proto_data_t0 *in) @@ -134,23 +101,9 @@ out->bNadValue = in->t1.nad; } -struct ccid_ops { - int (*send_in)(struct ccid_instance *ci, struct msgb *msg); -}; - -struct ccid_instance { - struct ccid_slot slot[NR_SLOTS]; - struct ccid_ops ops; - const char *name; -}; - #define msgb_ccid_out(x) (union ccid_pc_to_rdr *)msgb_data(x) #define msgb_ccid_in(x) (union ccid_rdr_to_pc *)msgb_data(x) -#define LOGPCI(ci, lvl, fmt, args ...) LOGP(DCCID, lvl, "%s: " fmt, (ci)->name, ## args) -#define LOGPCS(cs, lvl, fmt, args ...) \ - LOGP(DCCID, lvl, "%s(%u): " fmt, (cc)->ci->name, (cc)->slot_nr, ## args) - static struct ccid_slot *get_ccid_slot(struct ccid_instance *ci, uint8_t slot_nr) { if (slot_nr >= sizeof(ci->slot)) diff --git a/ccid/ccid_device.h b/ccid/ccid_device.h new file mode 100644 index 0000000..c7cef47 --- /dev/null +++ b/ccid/ccid_device.h @@ -0,0 +1,70 @@ +#pragma once +#include <stdbool.h> +#include <stdint.h> + + +#define NR_SLOTS 8 + +#define LOGPCI(ci, lvl, fmt, args ...) LOGP(DCCID, lvl, "%s: " fmt, (ci)->name, ## args) +#define LOGPCS(cs, lvl, fmt, args ...) \ + LOGP(DCCID, lvl, "%s(%u): " fmt, (cc)->ci->name, (cc)->slot_nr, ## args) + +struct msgb; + +struct ccid_pars_decoded { + /* global for T0/T1 */ + uint8_t fi; + uint8_t di; + enum ccid_clock_stop clock_stop; + bool inverse_convention; + + struct { + uint8_t guard_time_etu; + uint8_t waiting_integer; + } t0; + + struct { + enum ccid_t1_csum_type csum_type; + uint8_t guard_time_t1; + uint8_t bwi; + uint8_t cwi; + uint8_t ifsc; + uint8_t nad; + } t1; +}; + +struct ccid_slot { + /* back-pointer to the ccid_instance */ + struct ccid_instance *ci; + /* number of this slot (0 = first) */ + uint8_t slot_nr; + /* is there an ICC physically present (card detect)? */ + bool icc_present; + /* was there an ICC present during the last NotifSlotStatus? + * should be set to zero every USB resume and setConfig != 0 */ + bool icc_present_last; + /* is the ICC physically powered? */ + bool icc_powered; + /* is the ICC currently in reset? */ + bool icc_in_reset; + /* is this slot currently busy with processing a CCID command? */ + bool cmd_busy; + /* decided CCID parameters */ + struct ccid_pars_decoded pars; +}; + +/* CCID operations */ +struct ccid_ops { + int (*send_in)(struct ccid_instance *ci, struct msgb *msg); +}; + +/* An instance of CCID (i.e. a card reader device) */ +struct ccid_instance { + /* slots within the reader */ + struct ccid_slot slot[NR_SLOTS]; + /* set of function pointers implementing specific operations */ + const struct ccid_ops ops; + const char *name; +}; + +int ccid_handle_out(struct ccid_instance *ci, struct msgb *msg); -- To view, visit https://gerrit.osmocom.org/14058 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ccid-firmware Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I1b171ede38deebfa525a0ee10865da2dc5ec7e4e Gerrit-Change-Number: 14058 Gerrit-PatchSet: 1 Gerrit-Owner: Harald Welte <laforge at gnumonks.org> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190515/b493d7ad/attachment.htm>