Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
adis16220.h
Go to the documentation of this file.
1 #ifndef SPI_ADIS16220_H_
2 #define SPI_ADIS16220_H_
3 
4 #define ADIS16220_STARTUP_DELAY 220 /* ms */
5 
6 #define ADIS16220_READ_REG(a) a
7 #define ADIS16220_WRITE_REG(a) ((a) | 0x80)
8 
9 /* Flash memory write count */
10 #define ADIS16220_FLASH_CNT 0x00
11 /* Control, acceleration offset adjustment control */
12 #define ADIS16220_ACCL_NULL 0x02
13 /* Control, AIN1 offset adjustment control */
14 #define ADIS16220_AIN1_NULL 0x04
15 /* Control, AIN2 offset adjustment control */
16 #define ADIS16220_AIN2_NULL 0x06
17 /* Output, power supply during capture */
18 #define ADIS16220_CAPT_SUPPLY 0x0A
19 /* Output, temperature during capture */
20 #define ADIS16220_CAPT_TEMP 0x0C
21 /* Output, peak acceleration during capture */
22 #define ADIS16220_CAPT_PEAKA 0x0E
23 /* Output, peak AIN1 level during capture */
24 #define ADIS16220_CAPT_PEAK1 0x10
25 /* Output, peak AIN2 level during capture */
26 #define ADIS16220_CAPT_PEAK2 0x12
27 /* Output, capture buffer for acceleration */
28 #define ADIS16220_CAPT_BUFA 0x14
29 /* Output, capture buffer for AIN1 */
30 #define ADIS16220_CAPT_BUF1 0x16
31 /* Output, capture buffer for AIN2 */
32 #define ADIS16220_CAPT_BUF2 0x18
33 /* Control, capture buffer address pointer */
34 #define ADIS16220_CAPT_PNTR 0x1A
35 /* Control, capture control register */
36 #define ADIS16220_CAPT_CTRL 0x1C
37 /* Control, capture period (automatic mode) */
38 #define ADIS16220_CAPT_PRD 0x1E
39 /* Control, Alarm A, acceleration peak threshold */
40 #define ADIS16220_ALM_MAGA 0x20
41 /* Control, Alarm 1, AIN1 peak threshold */
42 #define ADIS16220_ALM_MAG1 0x22
43 /* Control, Alarm 2, AIN2 peak threshold */
44 #define ADIS16220_ALM_MAG2 0x24
45 /* Control, Alarm S, peak threshold */
46 #define ADIS16220_ALM_MAGS 0x26
47 /* Control, alarm configuration register */
48 #define ADIS16220_ALM_CTRL 0x28
49 /* Control, general I/O configuration */
50 #define ADIS16220_GPIO_CTRL 0x32
51 /* Control, self-test control, AIN configuration */
52 #define ADIS16220_MSC_CTRL 0x34
53 /* Control, digital I/O configuration */
54 #define ADIS16220_DIO_CTRL 0x36
55 /* Control, filter configuration */
56 #define ADIS16220_AVG_CNT 0x38
57 /* Status, system status */
58 #define ADIS16220_DIAG_STAT 0x3C
59 /* Control, system commands */
60 #define ADIS16220_GLOB_CMD 0x3E
61 /* Status, self-test response */
62 #define ADIS16220_ST_DELTA 0x40
63 /* Lot Identification Code 1 */
64 #define ADIS16220_LOT_ID1 0x52
65 /* Lot Identification Code 2 */
66 #define ADIS16220_LOT_ID2 0x54
67 /* Product identifier; convert to decimal = 16220 */
68 #define ADIS16220_PROD_ID 0x56
69 /* Serial number */
70 #define ADIS16220_SERIAL_NUM 0x58
71 
72 #define ADIS16220_CAPTURE_SIZE 2048
73 
74 /* MSC_CTRL */
75 #define ADIS16220_MSC_CTRL_SELF_TEST_EN (1 << 8)
76 #define ADIS16220_MSC_CTRL_POWER_SUP_COM_AIN1 (1 << 1)
77 #define ADIS16220_MSC_CTRL_POWER_SUP_COM_AIN2 (1 << 0)
78 
79 /* DIO_CTRL */
80 #define ADIS16220_MSC_CTRL_DIO2_BUSY_IND (3<<4)
81 #define ADIS16220_MSC_CTRL_DIO1_BUSY_IND (3<<2)
82 #define ADIS16220_MSC_CTRL_DIO2_ACT_HIGH (1<<1)
83 #define ADIS16220_MSC_CTRL_DIO1_ACT_HIGH (1<<0)
84 
85 /* DIAG_STAT */
86 /* AIN2 sample > ALM_MAG2 */
87 #define ADIS16220_DIAG_STAT_ALM_MAG2 (1<<14)
88 /* AIN1 sample > ALM_MAG1 */
89 #define ADIS16220_DIAG_STAT_ALM_MAG1 (1<<13)
90 /* Acceleration sample > ALM_MAGA */
91 #define ADIS16220_DIAG_STAT_ALM_MAGA (1<<12)
92 /* Error condition programmed into ALM_MAGS[11:0] and ALM_CTRL[5:4] is true */
93 #define ADIS16220_DIAG_STAT_ALM_MAGS (1<<11)
94 /* |Peak value in AIN2 data capture| > ALM_MAG2 */
95 #define ADIS16220_DIAG_STAT_PEAK_AIN2 (1<<10)
96 /* |Peak value in AIN1 data capture| > ALM_MAG1 */
97 #define ADIS16220_DIAG_STAT_PEAK_AIN1 (1<<9)
98 /* |Peak value in acceleration data capture| > ALM_MAGA */
99 #define ADIS16220_DIAG_STAT_PEAK_ACCEL (1<<8)
100 /* Data ready, capture complete */
101 #define ADIS16220_DIAG_STAT_DATA_RDY (1<<7)
102 #define ADIS16220_DIAG_STAT_FLASH_CHK (1<<6)
103 #define ADIS16220_DIAG_STAT_SELF_TEST (1<<5)
104 /* Capture period violation/interruption */
105 #define ADIS16220_DIAG_STAT_VIOLATION (1<<4)
106 /* SPI communications failure */
107 #define ADIS16220_DIAG_STAT_SPI_FAIL (1<<3)
108 /* Flash update failure */
109 #define ADIS16220_DIAG_STAT_FLASH_UPT (1<<2)
110 /* Power supply above 3.625 V */
111 #define ADIS16220_DIAG_STAT_POWER_HIGH (1<<1)
112 /* Power supply below 3.15 V */
113 #define ADIS16220_DIAG_STAT_POWER_LOW (1<<0)
114 
115 /* GLOB_CMD */
116 #define ADIS16220_GLOB_CMD_SW_RESET (1<<7)
117 #define ADIS16220_GLOB_CMD_SELF_TEST (1<<2)
118 #define ADIS16220_GLOB_CMD_PWR_DOWN (1<<1)
119 
120 #define ADIS16220_MAX_TX 2048
121 #define ADIS16220_MAX_RX 2048
122 
123 #define ADIS16220_SPI_BURST (u32)(1000 * 1000)
124 #define ADIS16220_SPI_FAST (u32)(2000 * 1000)
125 
134  struct spi_device *us;
135  struct mutex buf_lock;
138 };
139 
140 #endif /* SPI_ADIS16220_H_ */