1
2
3
4
5
6
7
8
9 #ifndef __LINUX_ST95HF_SPI_H
10 #define __LINUX_ST95HF_SPI_H
11
12 #include <linux/spi/spi.h>
13
14
15 #define ST95HF_COMMAND_SEND 0x0
16 #define ST95HF_COMMAND_RESET 0x1
17 #define ST95HF_COMMAND_RECEIVE 0x2
18
19 #define ST95HF_RESET_CMD_LEN 0x1
20
21
22
23
24
25
26
27
28
29 struct st95hf_spi_context {
30 bool req_issync;
31 struct spi_device *spidev;
32 struct completion done;
33 struct mutex spi_lock;
34 };
35
36
37 enum req_type {
38 SYNC,
39 ASYNC,
40 };
41
42 int st95hf_spi_send(struct st95hf_spi_context *spicontext,
43 unsigned char *buffertx,
44 int datalen,
45 enum req_type reqtype);
46
47 int st95hf_spi_recv_response(struct st95hf_spi_context *spicontext,
48 unsigned char *receivebuff);
49
50 int st95hf_spi_recv_echo_res(struct st95hf_spi_context *spicontext,
51 unsigned char *receivebuff);
52
53 #endif