RTEMS
6.3
Toggle main menu visibility
Loading...
Searching...
No Matches
cpukit
include
linux
i2c.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: BSD-2-Clause */
2
10
11
/*
12
* Copyright (c) 2014 embedded brains GmbH & Co. KG
13
*
14
* Redistribution and use in source and binary forms, with or without
15
* modification, are permitted provided that the following conditions
16
* are met:
17
* 1. Redistributions of source code must retain the above copyright
18
* notice, this list of conditions and the following disclaimer.
19
* 2. Redistributions in binary form must reproduce the above copyright
20
* notice, this list of conditions and the following disclaimer in the
21
* documentation and/or other materials provided with the distribution.
22
*
23
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33
* POSSIBILITY OF SUCH DAMAGE.
34
*/
35
36
#ifndef _UAPI_LINUX_I2C_H
37
#define _UAPI_LINUX_I2C_H
38
39
#include <stdint.h>
40
57
63
72
#define I2C_M_TEN 0x0010
73
79
#define I2C_M_RD 0x0001
80
90
#define I2C_M_STOP 0x8000
91
100
#define I2C_M_NOSTART 0x4000
101
110
#define I2C_M_REV_DIR_ADDR 0x2000
111
120
#define I2C_M_IGNORE_NAK 0x1000
121
131
#define I2C_M_NO_RD_ACK 0x0800
132
144
#define I2C_M_RECV_LEN 0x0400
145
147
151
struct
i2c_msg
{
158
uint16_t
addr
;
159
173
uint16_t
flags
;
174
178
uint16_t
len
;
179
183
uint8_t *
buf
;
184
};
185
191
192
#define I2C_FUNC_I2C 0x00000001
193
#define I2C_FUNC_10BIT_ADDR 0x00000002
194
#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004
195
#define I2C_FUNC_SMBUS_PEC 0x00000008
196
#define I2C_FUNC_NOSTART 0x00000010
197
#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000
198
#define I2C_FUNC_SMBUS_QUICK 0x00010000
199
#define I2C_FUNC_SMBUS_READ_BYTE 0x00020000
200
#define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000
201
#define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000
202
#define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000
203
#define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000
204
#define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000
205
#define I2C_FUNC_SMBUS_PROC_CALL 0x00800000
206
#define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000
207
#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000
208
#define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000
209
#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000
210
211
#define I2C_FUNC_SMBUS_BYTE \
212
(I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE)
213
214
#define I2C_FUNC_SMBUS_BYTE_DATA \
215
(I2C_FUNC_SMBUS_READ_BYTE_DATA | I2C_FUNC_SMBUS_WRITE_BYTE_DATA)
216
217
#define I2C_FUNC_SMBUS_WORD_DATA \
218
(I2C_FUNC_SMBUS_READ_WORD_DATA | I2C_FUNC_SMBUS_WRITE_WORD_DATA)
219
220
#define I2C_FUNC_SMBUS_BLOCK_DATA \
221
(I2C_FUNC_SMBUS_READ_BLOCK_DATA | I2C_FUNC_SMBUS_WRITE_BLOCK_DATA)
222
223
#define I2C_FUNC_SMBUS_I2C_BLOCK \
224
(I2C_FUNC_SMBUS_READ_I2C_BLOCK | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)
225
226
#define I2C_FUNC_SMBUS_EMUL \
227
(I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | I2C_FUNC_SMBUS_BYTE_DATA \
228
| I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_PROC_CALL \
229
| I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | I2C_FUNC_SMBUS_I2C_BLOCK \
230
| I2C_FUNC_SMBUS_PEC)
231
233
237
#define I2C_SMBUS_BLOCK_MAX 32
238
242
union
i2c_smbus_data
{
243
uint8_t byte;
244
uint16_t word;
245
uint8_t block[
I2C_SMBUS_BLOCK_MAX
+ 2];
246
};
247
253
254
#define I2C_SMBUS_READ 1
255
256
#define I2C_SMBUS_WRITE 0
257
259
265
266
#define I2C_SMBUS_QUICK 0
267
268
#define I2C_SMBUS_BYTE 1
269
270
#define I2C_SMBUS_BYTE_DATA 2
271
272
#define I2C_SMBUS_WORD_DATA 3
273
274
#define I2C_SMBUS_PROC_CALL 4
275
276
#define I2C_SMBUS_BLOCK_DATA 5
277
278
#define I2C_SMBUS_I2C_BLOCK_BROKEN 6
279
280
#define I2C_SMBUS_BLOCK_PROC_CALL 7
281
282
#define I2C_SMBUS_I2C_BLOCK_DATA 8
283
285
287
288
#endif
/* _UAPI_LINUX_I2C_H */
I2C_SMBUS_BLOCK_MAX
#define I2C_SMBUS_BLOCK_MAX
Maximum SMBus data block count.
Definition
i2c.h:237
i2c_msg
I2C transfer message.
Definition
i2c.h:151
i2c_msg::len
uint16_t len
The message data length in bytes.
Definition
i2c.h:178
i2c_msg::flags
uint16_t flags
The message flags.
Definition
i2c.h:173
i2c_msg::buf
uint8_t * buf
Pointer to the message data.
Definition
i2c.h:183
i2c_msg::addr
uint16_t addr
The slave address.
Definition
i2c.h:158
i2c_smbus_data
SMBus data.
Definition
i2c.h:242
Generated by
1.18.0