~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/staging/iio/gyro/adis16080.h

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef SPI_ADIS16080_H_
2
 
#define SPI_ADIS16080_H_
3
 
 
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.
11
 
                                        */
12
 
 
13
 
#define ADIS16080_MAX_TX     2
14
 
#define ADIS16080_MAX_RX     2
15
 
 
16
 
/**
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
25
 
 * @rx:                 recieve buffer
26
 
 * @buf_lock:           mutex to protect tx and rx
27
 
 **/
28
 
struct adis16080_state {
29
 
        struct spi_device               *us;
30
 
        struct work_struct              work_trigger_to_ring;
31
 
        s64                             last_timestamp;
32
 
        struct iio_dev                  *indio_dev;
33
 
        struct iio_trigger              *trig;
34
 
        u8                              *tx;
35
 
        u8                              *rx;
36
 
        struct mutex                    buf_lock;
37
 
};
38
 
 
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!
42
 
 */
43
 
 
44
 
enum adis16080_scan {
45
 
        ADIS16080_SCAN_GYRO,
46
 
        ADIS16080_SCAN_TEMP,
47
 
        ADIS16080_SCAN_ADC_1,
48
 
        ADIS16080_SCAN_ADC_2,
49
 
};
50
 
 
51
 
void adis16080_remove_trigger(struct iio_dev *indio_dev);
52
 
int adis16080_probe_trigger(struct iio_dev *indio_dev);
53
 
 
54
 
ssize_t adis16080_read_data_from_ring(struct device *dev,
55
 
                                      struct device_attribute *attr,
56
 
                                      char *buf);
57
 
 
58
 
 
59
 
int adis16080_configure_ring(struct iio_dev *indio_dev);
60
 
void adis16080_unconfigure_ring(struct iio_dev *indio_dev);
61
 
 
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 */
65
 
 
66
 
static inline void adis16080_remove_trigger(struct iio_dev *indio_dev)
67
 
{
68
 
}
69
 
 
70
 
static inline int adis16080_probe_trigger(struct iio_dev *indio_dev)
71
 
{
72
 
        return 0;
73
 
}
74
 
 
75
 
static inline ssize_t
76
 
adis16080_read_data_from_ring(struct device *dev,
77
 
                              struct device_attribute *attr,
78
 
                              char *buf)
79
 
{
80
 
        return 0;
81
 
}
82
 
 
83
 
static int adis16080_configure_ring(struct iio_dev *indio_dev)
84
 
{
85
 
        return 0;
86
 
}
87
 
 
88
 
static inline void adis16080_unconfigure_ring(struct iio_dev *indio_dev)
89
 
{
90
 
}
91
 
 
92
 
static inline int adis16080_initialize_ring(struct iio_ring_buffer *ring)
93
 
{
94
 
        return 0;
95
 
}
96
 
 
97
 
static inline void adis16080_uninitialize_ring(struct iio_ring_buffer *ring)
98
 
{
99
 
}
100
 
 
101
 
#endif /* CONFIG_IIO_RING_BUFFER */
102
 
#endif /* SPI_ADIS16080_H_ */