1 #ifndef SPI_ADIS16240_H_
2 #define SPI_ADIS16240_H_
4 #define ADIS16240_STARTUP_DELAY 220
6 #define ADIS16240_READ_REG(a) a
7 #define ADIS16240_WRITE_REG(a) ((a) | 0x80)
10 #define ADIS16240_FLASH_CNT 0x00
12 #define ADIS16240_SUPPLY_OUT 0x02
14 #define ADIS16240_XACCL_OUT 0x04
16 #define ADIS16240_YACCL_OUT 0x06
18 #define ADIS16240_ZACCL_OUT 0x08
20 #define ADIS16240_AUX_ADC 0x0A
22 #define ADIS16240_TEMP_OUT 0x0C
24 #define ADIS16240_XPEAK_OUT 0x0E
26 #define ADIS16240_YPEAK_OUT 0x10
28 #define ADIS16240_ZPEAK_OUT 0x12
30 #define ADIS16240_XYZPEAK_OUT 0x14
32 #define ADIS16240_CAPT_BUF1 0x16
34 #define ADIS16240_CAPT_BUF2 0x18
36 #define ADIS16240_DIAG_STAT 0x1A
38 #define ADIS16240_EVNT_CNTR 0x1C
40 #define ADIS16240_CHK_SUM 0x1E
42 #define ADIS16240_XACCL_OFF 0x20
44 #define ADIS16240_YACCL_OFF 0x22
46 #define ADIS16240_ZACCL_OFF 0x24
48 #define ADIS16240_CLK_TIME 0x2E
50 #define ADIS16240_CLK_DATE 0x30
52 #define ADIS16240_CLK_YEAR 0x32
54 #define ADIS16240_WAKE_TIME 0x34
56 #define ADIS16240_WAKE_DATE 0x36
58 #define ADIS16240_ALM_MAG1 0x38
60 #define ADIS16240_ALM_MAG2 0x3A
62 #define ADIS16240_ALM_CTRL 0x3C
64 #define ADIS16240_XTRIG_CTRL 0x3E
66 #define ADIS16240_CAPT_PNTR 0x40
68 #define ADIS16240_CAPT_CTRL 0x42
70 #define ADIS16240_GPIO_CTRL 0x44
72 #define ADIS16240_MSC_CTRL 0x46
74 #define ADIS16240_SMPL_PRD 0x48
76 #define ADIS16240_GLOB_CMD 0x4A
78 #define ADIS16240_OUTPUTS 6
82 #define ADIS16240_MSC_CTRL_XYZPEAK_OUT_EN (1 << 15)
84 #define ADIS16240_MSC_CTRL_X_Y_ZPEAK_OUT_EN (1 << 14)
86 #define ADIS16240_MSC_CTRL_SELF_TEST_EN (1 << 8)
88 #define ADIS16240_MSC_CTRL_DATA_RDY_EN (1 << 2)
90 #define ADIS16240_MSC_CTRL_ACTIVE_HIGH (1 << 1)
92 #define ADIS16240_MSC_CTRL_DATA_RDY_DIO2 (1 << 0)
96 #define ADIS16240_DIAG_STAT_ALARM2 (1<<9)
98 #define ADIS16240_DIAG_STAT_ALARM1 (1<<8)
100 #define ADIS16240_DIAG_STAT_CPT_BUF_FUL (1<<7)
102 #define ADIS16240_DIAG_STAT_CHKSUM (1<<6)
104 #define ADIS16240_DIAG_STAT_PWRON_FAIL (1<<5)
106 #define ADIS16240_DIAG_STAT_PWRON_BUSY (1<<4)
108 #define ADIS16240_DIAG_STAT_SPI_FAIL (1<<3)
110 #define ADIS16240_DIAG_STAT_FLASH_UPT (1<<2)
112 #define ADIS16240_DIAG_STAT_POWER_HIGH (1<<1)
114 #define ADIS16240_DIAG_STAT_POWER_LOW (1<<0)
117 #define ADIS16240_GLOB_CMD_RESUME (1<<8)
118 #define ADIS16240_GLOB_CMD_SW_RESET (1<<7)
119 #define ADIS16240_GLOB_CMD_STANDBY (1<<2)
121 #define ADIS16240_ERROR_ACTIVE (1<<14)
123 #define ADIS16240_MAX_TX 24
124 #define ADIS16240_MAX_RX 24
148 #define ADIS16240_SCAN_SUPPLY 0
149 #define ADIS16240_SCAN_ACC_X 1
150 #define ADIS16240_SCAN_ACC_Y 2
151 #define ADIS16240_SCAN_ACC_Z 3
152 #define ADIS16240_SCAN_AUX_ADC 4
153 #define ADIS16240_SCAN_TEMP 5
155 #ifdef CONFIG_IIO_BUFFER
179 adis16240_read_data_from_ring(
struct device *
dev,