1
#ifndef SPI_ADIS16080_H_
2
#define SPI_ADIS16080_H_
4
#define ADIS16080_DIN_CODE 4 /* Output data format setting. 0: Twos complement. 1: Offset binary. */
5
#define ADIS16080_DIN_GYRO (0 << 10) /* Gyroscope output */
6
#define ADIS16080_DIN_TEMP (1 << 10) /* Temperature output */
7
#define ADIS16080_DIN_AIN1 (2 << 10)
8
#define ADIS16080_DIN_AIN2 (3 << 10)
9
#define ADIS16080_DIN_WRITE (1 << 15) /* 1: Write contents on DIN to control register.
10
* 0: No changes to control register.
13
#define ADIS16080_MAX_TX 2
14
#define ADIS16080_MAX_RX 2
17
* struct adis16080_state - device instance specific data
18
* @us: actual spi_device to write data
19
* @work_trigger_to_ring: bh for triggered event handling
20
* @inter: used to check if new interrupt has been triggered
21
* @last_timestamp: passing timestamp from th to bh of interrupt handler
22
* @indio_dev: industrial I/O device structure
23
* @trig: data ready trigger registered with iio
24
* @tx: transmit buffer
26
* @buf_lock: mutex to protect tx and rx
28
struct adis16080_state {
29
struct spi_device *us;
30
struct work_struct work_trigger_to_ring;
32
struct iio_dev *indio_dev;
33
struct iio_trigger *trig;
36
struct mutex buf_lock;
39
#if defined(CONFIG_IIO_RING_BUFFER) && defined(THIS_HAS_RING_BUFFER_SUPPORT)
40
/* At the moment triggers are only used for ring buffer
41
* filling. This may change!
51
void adis16080_remove_trigger(struct iio_dev *indio_dev);
52
int adis16080_probe_trigger(struct iio_dev *indio_dev);
54
ssize_t adis16080_read_data_from_ring(struct device *dev,
55
struct device_attribute *attr,
59
int adis16080_configure_ring(struct iio_dev *indio_dev);
60
void adis16080_unconfigure_ring(struct iio_dev *indio_dev);
62
int adis16080_initialize_ring(struct iio_ring_buffer *ring);
63
void adis16080_uninitialize_ring(struct iio_ring_buffer *ring);
64
#else /* CONFIG_IIO_RING_BUFFER */
66
static inline void adis16080_remove_trigger(struct iio_dev *indio_dev)
70
static inline int adis16080_probe_trigger(struct iio_dev *indio_dev)
76
adis16080_read_data_from_ring(struct device *dev,
77
struct device_attribute *attr,
83
static int adis16080_configure_ring(struct iio_dev *indio_dev)
88
static inline void adis16080_unconfigure_ring(struct iio_dev *indio_dev)
92
static inline int adis16080_initialize_ring(struct iio_ring_buffer *ring)
97
static inline void adis16080_uninitialize_ring(struct iio_ring_buffer *ring)
101
#endif /* CONFIG_IIO_RING_BUFFER */
102
#endif /* SPI_ADIS16080_H_ */