struct pn532_uart_phy { struct serdev_device *serdev; struct sk_buff *recv_skb; struct pn533 *priv; /* * send_wakeup variable is used to control if we need to send a wakeup * request to the pn532 chip prior to our actual command. There is a * little propability of a race condition. We decided to not mutex the * variable as the worst that could happen is, that we send a wakeup * to the chip that is already awake. This does not hurt. It is a * no-op to the chip.
*/ enum send_wakeup send_wakeup; struct timer_list cmd_timeout; struct sk_buff *cur_out_buf;
};
/* * scans the buffer if it contains a pn532 frame. It is not checked if the * frame is really valid. This is later done with pn533_rx_frame_is_valid. * This is useful for malformed or errornous transmitted frames. Adjusts the * bufferposition where the frame starts, since pn533_recv_frame expects a * well formed frame.
*/ staticint pn532_uart_rx_is_frame(struct sk_buff *skb)
{ struct pn533_std_frame *std; struct pn533_ext_frame *ext;
u16 frame_len; int i;
for (i = 0; i + PN533_STD_FRAME_ACK_SIZE <= skb->len; i++) {
std = (struct pn533_std_frame *)&skb->data[i]; /* search start code */ if (std->start_frame != cpu_to_be16(PN533_STD_FRAME_SOF)) continue;
/* frame type */ switch (std->datalen) { case PN533_FRAME_DATALEN_ACK: if (std->datalen_checksum == 0xff) {
skb_pull(skb, i); return 1;
}
break; case PN533_FRAME_DATALEN_ERROR: if ((std->datalen_checksum == 0xff) &&
(skb->len >=
PN533_STD_ERROR_FRAME_SIZE)) {
skb_pull(skb, i); return 1;
}
timer_delete(&dev->cmd_timeout); for (i = 0; i < count; i++) {
skb_put_u8(dev->recv_skb, *data++); if (!pn532_uart_rx_is_frame(dev->recv_skb)) continue;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.