0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef __LINUX_ST95HF_SPI_H
0010 #define __LINUX_ST95HF_SPI_H
0011
0012 #include <linux/spi/spi.h>
0013
0014
0015 #define ST95HF_COMMAND_SEND 0x0
0016 #define ST95HF_COMMAND_RESET 0x1
0017 #define ST95HF_COMMAND_RECEIVE 0x2
0018
0019 #define ST95HF_RESET_CMD_LEN 0x1
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 struct st95hf_spi_context {
0030 bool req_issync;
0031 struct spi_device *spidev;
0032 struct completion done;
0033 struct mutex spi_lock;
0034 };
0035
0036
0037 enum req_type {
0038 SYNC,
0039 ASYNC,
0040 };
0041
0042 int st95hf_spi_send(struct st95hf_spi_context *spicontext,
0043 unsigned char *buffertx,
0044 int datalen,
0045 enum req_type reqtype);
0046
0047 int st95hf_spi_recv_response(struct st95hf_spi_context *spicontext,
0048 unsigned char *receivebuff);
0049
0050 int st95hf_spi_recv_echo_res(struct st95hf_spi_context *spicontext,
0051 unsigned char *receivebuff);
0052
0053 #endif