Lines Matching +full:0 +full:ms
34 tx_pkt(fido_dev_t *d, const void *pkt, size_t len, int *ms)
39 if (fido_time_now(&ts) != 0)
44 if (fido_time_delta(&ts, ms) != 0)
51 tx_empty(fido_dev_t *d, uint8_t cmd, int *ms) in tx_empty() argument
58 memset(&pkt, 0, sizeof(pkt)); in tx_empty()
63 if (len > sizeof(pkt) || (n = tx_pkt(d, pkt, len, ms)) < 0 || in tx_empty()
67 return (0); in tx_empty()
71 tx_preamble(fido_dev_t *d, uint8_t cmd, const void *buf, size_t count, int *ms) in tx_preamble() argument
79 return (0); in tx_preamble()
81 memset(&pkt, 0, sizeof(pkt)); in tx_preamble()
85 fp->body.init.bcnth = (count >> 8) & 0xff; in tx_preamble()
86 fp->body.init.bcntl = count & 0xff; in tx_preamble()
90 if (len > sizeof(pkt) || (n = tx_pkt(d, pkt, len, ms)) < 0 || in tx_preamble()
92 return (0); in tx_preamble()
98 tx_frame(fido_dev_t *d, uint8_t seq, const void *buf, size_t count, int *ms) in tx_frame() argument
106 return (0); in tx_frame()
108 memset(&pkt, 0, sizeof(pkt)); in tx_frame()
115 if (len > sizeof(pkt) || (n = tx_pkt(d, pkt, len, ms)) < 0 || in tx_frame()
117 return (0); in tx_frame()
123 tx(fido_dev_t *d, uint8_t cmd, const unsigned char *buf, size_t count, int *ms) in tx() argument
127 if ((sent = tx_preamble(d, cmd, buf, count, ms)) == 0) { in tx()
132 for (uint8_t seq = 0; sent < count; sent += n) { in tx()
133 if (seq & 0x80) { in tx()
134 fido_log_debug("%s: seq & 0x80", __func__); in tx()
138 ms)) == 0) { in tx()
144 return (0); in tx()
148 transport_tx(fido_dev_t *d, uint8_t cmd, const void *buf, size_t count, int *ms) in transport_tx() argument
153 if (fido_time_now(&ts) != 0) in transport_tx()
158 if (fido_time_delta(&ts, ms) != 0) in transport_tx()
165 fido_tx(fido_dev_t *d, uint8_t cmd, const void *buf, size_t count, int *ms) in fido_tx() argument
167 fido_log_debug("%s: dev=%p, cmd=0x%02x", __func__, (void *)d, cmd); in fido_tx()
171 return (transport_tx(d, cmd, buf, count, ms)); in fido_tx()
177 return (count == 0 ? tx_empty(d, cmd, ms) : tx(d, cmd, buf, count, ms)); in fido_tx()
181 rx_frame(fido_dev_t *d, struct frame *fp, int *ms) in rx_frame() argument
186 memset(fp, 0, sizeof(*fp)); in rx_frame()
188 if (fido_time_now(&ts) != 0) in rx_frame()
192 (unsigned char *)fp, d->rx_len, *ms)) < 0 || (size_t)n != d->rx_len) in rx_frame()
195 return (fido_time_delta(&ts, ms)); in rx_frame()
199 rx_preamble(fido_dev_t *d, uint8_t cmd, struct frame *fp, int *ms) in rx_preamble() argument
202 if (rx_frame(d, fp, ms) < 0) in rx_preamble()
219 fido_log_debug("%s: cid (0x%x, 0x%x), cmd (0x%02x, 0x%02x)", in rx_preamble()
224 return (0); in rx_preamble()
228 rx(fido_dev_t *d, uint8_t cmd, unsigned char *buf, size_t count, int *ms) in rx() argument
244 if (rx_preamble(d, cmd, &f, ms) < 0) { in rx()
265 for (int seq = 0; r < payload_len; seq++) { in rx()
266 if (rx_frame(d, &f, ms) < 0) { in rx()
278 fido_log_debug("%s: cid (0x%x, 0x%x), seq (%d, %d)", in rx()
296 transport_rx(fido_dev_t *d, uint8_t cmd, void *buf, size_t count, int *ms) in transport_rx() argument
301 if (fido_time_now(&ts) != 0) in transport_rx()
304 n = d->transport.rx(d, cmd, buf, count, *ms); in transport_rx()
306 if (fido_time_delta(&ts, ms) != 0) in transport_rx()
313 fido_rx(fido_dev_t *d, uint8_t cmd, void *buf, size_t count, int *ms) in fido_rx() argument
317 fido_log_debug("%s: dev=%p, cmd=0x%02x, ms=%d", __func__, (void *)d, in fido_rx()
318 cmd, *ms); in fido_rx()
321 return (transport_rx(d, cmd, buf, count, ms)); in fido_rx()
326 if ((n = rx(d, cmd, buf, count, ms)) >= 0) in fido_rx()
333 fido_rx_cbor_status(fido_dev_t *d, int *ms) in fido_rx_cbor_status() argument
344 if ((msglen = fido_rx(d, CTAP_CMD_CBOR, msg, FIDO_MAXMSG, ms)) < 0 || in fido_rx_cbor_status()
351 r = msg[0]; in fido_rx_cbor_status()