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
313 * struct spi_packet - a complete spi packet; always 256 bytes. This carries
324 * @offset: specifies the offset of this packet's data in the complete
325 * message; i.e. > 0 indicates this is a continuation packet (in
326 * the second packet for a message split over multiple packets
327 * this would then be the same as the @length in the first packet)
329 * the first packet of a message split over two packets this would
330 * then be the same as the @length in the second packet)
331 * @length: length of the valid data in the @data in this packet
334 * covers just this packet, even on multi-packet messages (in
752 struct spi_packet *packet = (struct spi_packet *)applespi->tx_buffer;
753 struct message *message = (struct message *)packet->data;
773 /* set up packet */
774 memset(packet, 0, APPLESPI_PACKET_SIZE);
842 /* finalize packet */
843 packet->flags = PACKET_TYPE_WRITE;
844 packet->device = device;
845 packet->length = cpu_to_le16(MSG_HEADER_SIZE + msg_len);
853 crc = crc16(0, (u8 *)message, le16_to_cpu(packet->length) - 2);
856 crc = crc16(0, (u8 *)packet, sizeof(*packet) - 2);
857 packet->crc16 = cpu_to_le16(crc);
1340 struct spi_packet *packet,
1343 if (packet->device == PACKET_DEV_INFO &&
1361 if (packet->device == PACKET_DEV_TPAD &&
1375 "Received corrupted packet (crc mismatch)\n");
1385 struct spi_packet *packet)
1389 if (packet->flags == PACKET_TYPE_READ &&
1390 packet->device == PACKET_DEV_KEYB)
1392 else if (packet->flags == PACKET_TYPE_READ &&
1393 packet->device == PACKET_DEV_TPAD)
1395 else if (packet->flags == PACKET_TYPE_WRITE)
1406 struct spi_packet *packet;
1413 /* process packet header */
1432 packet = (struct spi_packet *)applespi->rx_buffer;
1434 applespi_debug_print_read_packet(applespi, packet);
1436 off = le16_to_cpu(packet->offset);
1437 rem = le16_to_cpu(packet->remaining);
1438 len = le16_to_cpu(packet->length);
1440 if (len > sizeof(packet->data)) {
1442 "Received corrupted packet (invalid packet length %u)\n",
1447 /* handle multi-packet messages */
1470 memcpy(applespi->msg_buf + off, &packet->data, len);
1479 message = (struct message *)&packet->data;
1489 "Received corrupted packet (invalid message length %u - expected %u)\n",
1496 if (packet->flags == PACKET_TYPE_READ &&
1497 packet->device == PACKET_DEV_KEYB) {
1500 } else if (packet->flags == PACKET_TYPE_READ &&
1501 packet->device == PACKET_DEV_TPAD) {
1510 "Received corrupted packet (invalid message length %u - num-fingers %u, tp-len %zu)\n",
1526 } else if (packet->flags == PACKET_TYPE_WRITE) {
1527 applespi_handle_cmd_response(applespi, packet, message);
1533 applespi_msg_complete(applespi, packet->flags == PACKET_TYPE_WRITE,