1STRUCT SPI_MESSAGE(9) Serial Peripheral Interface (S STRUCT SPI_MESSAGE(9)
2
3
4
6 struct_spi_message - one multi-segment SPI transaction
7
9 struct spi_message {
10 struct list_head transfers;
11 struct spi_device * spi;
12 unsigned is_dma_mapped:1;
13 void (* complete) (void *context);
14 void * context;
15 unsigned actual_length;
16 int status;
17 struct list_head queue;
18 void * state;
19 };
20
22 transfers
23 list of transfer segments in this transaction
24
25 spi
26 SPI device to which the transaction is queued
27
28 is_dma_mapped
29 if true, the caller provided both dma and cpu virtual addresses for
30 each transfer buffer
31
32 complete
33 called to report transaction completions
34
35 context
36 the argument to complete when it's called
37
38 actual_length
39 the total number of bytes that were transferred in all successful
40 segments
41
42 status
43 zero for success, else negative errno
44
45 queue
46 for use by whichever driver currently owns the message
47
48 state
49 for use by whichever driver currently owns the message
50
52 A spi_message is used to execute an atomic sequence of data transfers,
53 each represented by a struct spi_transfer. The sequence is “atomic” in
54 the sense that no other spi_message may use that SPI bus until that
55 sequence completes. On some systems, many such sequences can execute as
56 as single programmed DMA transfer. On all systems, these messages are
57 queued, and might complete after transactions to other devices.
58 Messages sent to a given spi_device are alway executed in FIFO order.
59
60 The code that submits an spi_message (and its spi_transfers) to the
61 lower layers is responsible for managing its memory. Zero-initialize
62 every field you don't set up explicitly, to insulate against future API
63 updates. After you submit a message and its transfers, ignore them
64 until its completion callback.
65
67Kernel Hackers Manual 2.6. November 2011 STRUCT SPI_MESSAGE(9)