Lines Matching defs:packet

33  * command message, immediately reading a short status packet, and then, upon
37 * write exchange is indicated in the encapsulating packet's flags field.
39 * A single message may be too large to fit in a single packet (which has a
322 * struct spi_packet - a complete spi packet; always 256 bytes. This carries
333 * @offset: specifies the offset of this packet's data in the complete
334 * message; i.e. > 0 indicates this is a continuation packet (in
335 * the second packet for a message split over multiple packets
336 * this would then be the same as the @length in the first packet)
338 * the first packet of a message split over two packets this would
339 * then be the same as the @length in the second packet)
340 * @length: length of the valid data in the @data in this packet
343 * covers just this packet, even on multi-packet messages (in
767 struct spi_packet *packet = (struct spi_packet *)applespi->tx_buffer;
768 struct message *message = (struct message *)packet->data;
788 /* set up packet */
789 memset(packet, 0, APPLESPI_PACKET_SIZE);
857 /* finalize packet */
858 packet->flags = PACKET_TYPE_WRITE;
859 packet->device = device;
860 packet->length = cpu_to_le16(MSG_HEADER_SIZE + msg_len);
868 crc = crc16(0, (u8 *)message, le16_to_cpu(packet->length) - 2);
871 crc = crc16(0, (u8 *)packet, sizeof(*packet) - 2);
872 packet->crc16 = cpu_to_le16(crc);
1355 struct spi_packet *packet,
1358 if (packet->device == PACKET_DEV_INFO &&
1376 if (packet->device == PACKET_DEV_TPAD &&
1390 "Received corrupted packet (crc mismatch)\n");
1400 struct spi_packet *packet)
1404 if (packet->flags == PACKET_TYPE_READ &&
1405 packet->device == PACKET_DEV_KEYB)
1407 else if (packet->flags == PACKET_TYPE_READ &&
1408 packet->device == PACKET_DEV_TPAD)
1410 else if (packet->flags == PACKET_TYPE_WRITE)
1421 struct spi_packet *packet;
1428 /* process packet header */
1447 packet = (struct spi_packet *)applespi->rx_buffer;
1449 applespi_debug_print_read_packet(applespi, packet);
1451 off = le16_to_cpu(packet->offset);
1452 rem = le16_to_cpu(packet->remaining);
1453 len = le16_to_cpu(packet->length);
1455 if (len > sizeof(packet->data)) {
1457 "Received corrupted packet (invalid packet length %u)\n",
1462 /* handle multi-packet messages */
1485 memcpy(applespi->msg_buf + off, &packet->data, len);
1494 message = (struct message *)&packet->data;
1504 "Received corrupted packet (invalid message length %u - expected %u)\n",
1511 if (packet->flags == PACKET_TYPE_READ &&
1512 packet->device == PACKET_DEV_KEYB) {
1515 } else if (packet->flags == PACKET_TYPE_READ &&
1516 packet->device == PACKET_DEV_TPAD) {
1525 "Received corrupted packet (invalid message length %u - num-fingers %u, tp-len %zu)\n",
1541 } else if (packet->flags == PACKET_TYPE_WRITE) {
1542 applespi_handle_cmd_response(applespi, packet, message);
1548 applespi_msg_complete(applespi, packet->flags == PACKET_TYPE_WRITE,