1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief RTEMS Port of Linux I2C Device API |
---|
5 | * |
---|
6 | * @ingroup I2CLinux |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Copyright (c) 2014 embedded brains GmbH. All rights reserved. |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef _UAPI_LINUX_I2C_DEV_H |
---|
18 | #define _UAPI_LINUX_I2C_DEV_H |
---|
19 | |
---|
20 | #include <stdint.h> |
---|
21 | |
---|
22 | /** |
---|
23 | * @addtogroup I2CLinux |
---|
24 | * |
---|
25 | * @{ |
---|
26 | */ |
---|
27 | |
---|
28 | /** |
---|
29 | * @name I2C IO Control Commands |
---|
30 | * |
---|
31 | * @{ |
---|
32 | */ |
---|
33 | |
---|
34 | /** |
---|
35 | * @brief Sets the count of transfer retries in case a slave |
---|
36 | * device does not acknowledge a transaction. |
---|
37 | * |
---|
38 | * The argument type is unsigned long. |
---|
39 | */ |
---|
40 | #define I2C_RETRIES 0x701 |
---|
41 | |
---|
42 | /** |
---|
43 | * @brief Sets the transfer timeout in 10ms units. |
---|
44 | * |
---|
45 | * The argument type is unsigned long. |
---|
46 | */ |
---|
47 | #define I2C_TIMEOUT 0x702 |
---|
48 | |
---|
49 | /** |
---|
50 | * @brief Sets the slave address. |
---|
51 | * |
---|
52 | * It is an error to set a slave address already used by another slave device. |
---|
53 | * |
---|
54 | * The argument type is unsigned long. |
---|
55 | */ |
---|
56 | #define I2C_SLAVE 0x703 |
---|
57 | |
---|
58 | /** |
---|
59 | * @brief Forces setting the slave address. |
---|
60 | * |
---|
61 | * The argument type is unsigned long. |
---|
62 | */ |
---|
63 | #define I2C_SLAVE_FORCE 0x706 |
---|
64 | |
---|
65 | /** |
---|
66 | * @brief Enables 10-bit addresses if argument is non-zero, otherwise |
---|
67 | * disables 10-bit addresses. |
---|
68 | * |
---|
69 | * The argument type is unsigned long. |
---|
70 | */ |
---|
71 | #define I2C_TENBIT 0x704 |
---|
72 | |
---|
73 | /** |
---|
74 | * @brief Gets the I2C controller functionality information. |
---|
75 | * |
---|
76 | * The argument type is a pointer to an unsigned long. |
---|
77 | */ |
---|
78 | #define I2C_FUNCS 0x705 |
---|
79 | |
---|
80 | /** |
---|
81 | * @brief Performs a combined read/write transfer. |
---|
82 | * |
---|
83 | * Only one stop condition is signalled. |
---|
84 | * |
---|
85 | * The argument type is a pointer to struct i2c_rdwr_ioctl_data. |
---|
86 | */ |
---|
87 | #define I2C_RDWR 0x707 |
---|
88 | |
---|
89 | /** |
---|
90 | * @brief Enables System Management Bus (SMBus) Packet Error Checking (PEC) |
---|
91 | * if argument is non-zero, otherwise disables PEC. |
---|
92 | * |
---|
93 | * The argument type is unsigned long. |
---|
94 | */ |
---|
95 | #define I2C_PEC 0x708 |
---|
96 | |
---|
97 | /** |
---|
98 | * @brief Performs an SMBus transfer. |
---|
99 | * |
---|
100 | * The argument type is a pointer to struct i2c_smbus_ioctl_data. |
---|
101 | */ |
---|
102 | #define I2C_SMBUS 0x720 |
---|
103 | |
---|
104 | /** @} */ |
---|
105 | |
---|
106 | /** |
---|
107 | * @brief Argument type for I2C_SMBUS IO control call. |
---|
108 | */ |
---|
109 | struct i2c_smbus_ioctl_data { |
---|
110 | uint8_t read_write; |
---|
111 | uint8_t command; |
---|
112 | uint32_t size; |
---|
113 | union i2c_smbus_data *data; |
---|
114 | }; |
---|
115 | |
---|
116 | /** |
---|
117 | * @brief Argument type for I2C_RDWR IO control call. |
---|
118 | */ |
---|
119 | struct i2c_rdwr_ioctl_data { |
---|
120 | struct i2c_msg *msgs; |
---|
121 | uint32_t nmsgs; |
---|
122 | }; |
---|
123 | |
---|
124 | /** |
---|
125 | * @brief Maximum count of messages for one IO control call. |
---|
126 | */ |
---|
127 | #define I2C_RDRW_IOCTL_MAX_MSGS 42 |
---|
128 | |
---|
129 | /** @} */ |
---|
130 | |
---|
131 | #endif /* _UAPI_LINUX_I2C_DEV_H */ |
---|