unsigned int tx_len,
unsigned char *rx_buf,
unsigned int *rx_len,
- unsigned int timeout,
+ u_int64_t timeout,
unsigned int flags);
struct {
int (*init)(struct rfid_asic_handle *h);
int
-rc632_wait_idle(struct rfid_asic_handle *handle, unsigned int time);
+rc632_wait_idle(struct rfid_asic_handle *handle, u_int64_t time);
int
rc632_transmit(struct rfid_asic_handle *handle,
const unsigned char *buf,
unsigned char len,
- unsigned int timeout);
+ u_int64_t timeout);
int
rc632_transcieve(struct rfid_asic_handle *handle,
int (*transcieve)(struct rfid_layer2_handle *h,
const unsigned char *tx_buf,
unsigned int tx_len, unsigned char *rx_buf,
- unsigned int *rx_len, unsigned int timeout,
+ unsigned int *rx_len, u_int64_t timeout,
unsigned int flags);
int (*close)(struct rfid_layer2_handle *h);
int (*fini)(struct rfid_layer2_handle *h);
int rfid_layer2_transcieve(struct rfid_layer2_handle *l2h,
const unsigned char *tx_buf, unsigned int tx_len,
unsigned char *rx_buf, unsigned int *rx_len,
- unsigned int timeout, unsigned int flags);
+ u_int64_t timeout, unsigned int flags);
int rfid_layer2_close(struct rfid_layer2_handle *l2h);
int rfid_layer2_fini(struct rfid_layer2_handle *l2h);
int (*transcieve)(struct rfid_reader_handle *h,
const unsigned char *tx_buf, unsigned int tx_len,
unsigned char *rx_buf, unsigned int *rx_len,
- unsigned int timeout, unsigned int flags);
+ u_int64_t timeout, unsigned int flags);
struct rfid_reader_handle * (*open)(void *data);
- int (*close)(void *data);
+ void (*close)(struct rfid_reader_handle *h);
struct rfid_14443a_reader {
int (*init)(struct rfid_reader_handle *h);
/* Stupid RC623 implementations don't evaluate interrupts but poll the
* command register for "status idle" */
int
-rc632_wait_idle(struct rfid_asic_handle *handle, unsigned int time)
+rc632_wait_idle(struct rfid_asic_handle *handle, u_int64_t timeout)
{
unsigned char cmd = 0xff;
int ret;
rc632_transmit(struct rfid_asic_handle *handle,
const unsigned char *buf,
unsigned char len,
- unsigned int timeout)
+ u_int64_t timeout)
{
int ret;
rc632_iso14443a_transcieve(struct rfid_asic_handle *handle,
const unsigned char *tx_buf, unsigned int tx_len,
unsigned char *rx_buf, unsigned int *rx_len,
- unsigned int timeout, unsigned int flags)
+ u_int64_t timeout, unsigned int flags)
{
int ret;
unsigned char rxl = *rx_len & 0xff;
rfid_layer2_transcieve(struct rfid_layer2_handle *ph,
const unsigned char *tx_buf, unsigned int len,
unsigned char *rx_buf, unsigned int *rx_len,
- unsigned int timeout, unsigned int flags)
+ u_int64_t timeout, unsigned int flags)
{
return ph->l2->fn.transcieve(ph, tx_buf, len, rx_buf, rx_len,
timeout, flags);
iso14443a_transcieve(struct rfid_layer2_handle *handle,
const unsigned char *tx_buf, unsigned int tx_len,
unsigned char *rx_buf, unsigned int *rx_len,
- unsigned int timeout, unsigned int flags)
+ u_int64_t timeout, unsigned int flags)
{
return handle->rh->reader->transcieve(handle->rh, tx_buf, tx_len,
rx_buf, rx_len, timeout, flags);
static inline int
fwi_to_fwt(struct rfid_layer2_handle *h, unsigned int *fwt, unsigned int fwi)
{
- unsigned int multiplier;
+ unsigned int multiplier, tmp;
/* 15 is RFU */
if (fwi > 14)
multiplier = 1 << fwi; /* 2 to the power of fwi */
- return (1000000 * 256 * 16 / h->rh->ah->asic->fc) * multiplier
+ tmp = (unsigned int) 1000000 * 256 * 16;
+
+ return (tmp / h->rh->ah->asic->fc) * multiplier;
}
static int
/* FIXME: send N-1 slot marker frames */
if (atqb_len != sizeof(atqb)) {
- DEBUGP("error: atqb_len = %u instead of %u\n",
+ DEBUGP("error: atqb_len = %u instead of %Zu\n",
atqb_len, sizeof(atqb));
continue;
}
{
unsigned char afi = 0; /* FIXME */
int ret;
- char buf[255];
+ unsigned char buf[255];
unsigned int buf_len = sizeof(buf);
ret = send_reqb(handle, afi, 0, 0);
iso14443b_transcieve(struct rfid_layer2_handle *handle,
const unsigned char *tx_buf, unsigned int tx_len,
unsigned char *rx_buf, unsigned int *rx_len,
- unsigned int timeout, unsigned int flags)
+ u_int64_t timeout, unsigned int flags)
{
return handle->rh->reader->transcieve(handle->rh, tx_buf, tx_len,
rx_buf, rx_len, timeout, flags);
iso14443a_transcieve(struct rfid_layer2_handle *handle,
const unsigned char *tx_buf, unsigned int tx_len,
unsigned char *rx_buf, unsigned int *rx_len,
- unsigned int timeout, unsigned int flags)
+ u_int64_t, unsigned int flags)
{
return handle->rh->reader->transcieve(handle->rh, tx_buf, tx_len,
rx_buf, rx_len, timeout, flags);
unsigned char sfgi)
{
unsigned int multiplier;
+ unsigned int tmp;
if (sfgi > 14)
sfgi = 14;
/* ISO 14443-4:2000(E) Section 5.2.5:
* (256 * 16 / h->l2h->rh->ah->fc) * (2 ^ sfgi) */
+ tmp = (unsigned int) 1000000 * 256 * 16;
- return (1000000 * 256*16 / h->l2h->rh->ah->fc) * multiplier;
+ return (tmp / h->l2h->rh->ah->fc) * multiplier;
}
static unsigned int fwi_to_fwt(struct rfid_protocol_handle *h,
unsigned char fwi)
{
- unsigned int multiplier;
+ unsigned int multiplier, tmp;
if (fwi > 14)
fwi = 14;
/* ISO 14443-4:2000(E) Section 7.2.:
* (256*16 / h->l2h->rh->ah->fc) * (2 ^ fwi) */
- return (1000000 * 256*16 / h->l2h->rh->ah->fc) * multiplier;
+ tmp = (unsigned int) 1000000 * 256 * 16;
+
+ return (tmp / h->l2h->rh->ah->fc) * multiplier;
}
-#define activation_fwt(x) (65536 / x->l2h->rh->ah->fc)
+/* 4.9seconds as microseconds (4.9 billion seconds) exceeds 2^32 */
+#define activation_fwt(x) (((u_int64_t)1000000 * 65536 / x->l2h->rh->ah->fc))
#define deactivation_fwt(x) activation_fwt(x)
static int
rfid_reader_transcieve(struct rfid_reader_handle *rh,
const unsigned char *tx_buf, unsigned int len,
unsigned char *rx_buf, unsigned int *rx_len,
- unsigned int timeout, unsigned int flags)
+ u_int64_t timeout, unsigned int flags)
{
return rh->reader->transcieve(rh, tx_buf, len, rx_buf, rx_len,
timeout, flags);
static int cm5121_transcieve(struct rfid_reader_handle *rh,
const unsigned char *tx_data, unsigned int tx_len,
unsigned char *rx_data, unsigned int *rx_len,
- unsigned int timeout, unsigned int flags)
+ u_int64_t timeout, unsigned int flags)
{
return rh->ah->asic->priv.rc632.fn.transcieve(rh->ah, tx_data,
tx_len, rx_data,
.init = &cm5121_14443a_init,
.transcieve_sf = &cm5121_transcieve_sf,
.transcieve_acf = &cm5121_transcieve_acf,
+ .speed = RFID_READER_SPEED_106K | RFID_READER_SPEED_212K |
+ RFID_READER_SPEED_424K | RFID_READER_SPEED_848K,
},
.iso14443b = {
.init = &cm5121_14443b_init,