Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include/linux
File: i2c.h
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
[0] Fix | Delete
/* ------------------------------------------------------------------------- */
[1] Fix | Delete
/* */
[2] Fix | Delete
/* i2c.h - definitions for the i2c-bus interface */
[3] Fix | Delete
/* */
[4] Fix | Delete
/* ------------------------------------------------------------------------- */
[5] Fix | Delete
/* Copyright (C) 1995-2000 Simon G. Vogl
[6] Fix | Delete
[7] Fix | Delete
This program is free software; you can redistribute it and/or modify
[8] Fix | Delete
it under the terms of the GNU General Public License as published by
[9] Fix | Delete
the Free Software Foundation; either version 2 of the License, or
[10] Fix | Delete
(at your option) any later version.
[11] Fix | Delete
[12] Fix | Delete
This program is distributed in the hope that it will be useful,
[13] Fix | Delete
but WITHOUT ANY WARRANTY; without even the implied warranty of
[14] Fix | Delete
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
[15] Fix | Delete
GNU General Public License for more details.
[16] Fix | Delete
[17] Fix | Delete
You should have received a copy of the GNU General Public License
[18] Fix | Delete
along with this program; if not, write to the Free Software
[19] Fix | Delete
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
[20] Fix | Delete
MA 02110-1301 USA. */
[21] Fix | Delete
/* ------------------------------------------------------------------------- */
[22] Fix | Delete
[23] Fix | Delete
/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
[24] Fix | Delete
Frodo Looijaard <frodol@dds.nl> */
[25] Fix | Delete
[26] Fix | Delete
#ifndef _LINUX_I2C_H
[27] Fix | Delete
#define _LINUX_I2C_H
[28] Fix | Delete
[29] Fix | Delete
#include <linux/types.h>
[30] Fix | Delete
[31] Fix | Delete
/**
[32] Fix | Delete
* struct i2c_msg - an I2C transaction segment beginning with START
[33] Fix | Delete
* @addr: Slave address, either seven or ten bits. When this is a ten
[34] Fix | Delete
* bit address, I2C_M_TEN must be set in @flags and the adapter
[35] Fix | Delete
* must support I2C_FUNC_10BIT_ADDR.
[36] Fix | Delete
* @flags: I2C_M_RD is handled by all adapters. No other flags may be
[37] Fix | Delete
* provided unless the adapter exported the relevant I2C_FUNC_*
[38] Fix | Delete
* flags through i2c_check_functionality().
[39] Fix | Delete
* @len: Number of data bytes in @buf being read from or written to the
[40] Fix | Delete
* I2C slave address. For read transactions where I2C_M_RECV_LEN
[41] Fix | Delete
* is set, the caller guarantees that this buffer can hold up to
[42] Fix | Delete
* 32 bytes in addition to the initial length byte sent by the
[43] Fix | Delete
* slave (plus, if used, the SMBus PEC); and this value will be
[44] Fix | Delete
* incremented by the number of block data bytes received.
[45] Fix | Delete
* @buf: The buffer into which data is read, or from which it's written.
[46] Fix | Delete
*
[47] Fix | Delete
* An i2c_msg is the low level representation of one segment of an I2C
[48] Fix | Delete
* transaction. It is visible to drivers in the @i2c_transfer() procedure,
[49] Fix | Delete
* to userspace from i2c-dev, and to I2C adapter drivers through the
[50] Fix | Delete
* @i2c_adapter.@master_xfer() method.
[51] Fix | Delete
*
[52] Fix | Delete
* Except when I2C "protocol mangling" is used, all I2C adapters implement
[53] Fix | Delete
* the standard rules for I2C transactions. Each transaction begins with a
[54] Fix | Delete
* START. That is followed by the slave address, and a bit encoding read
[55] Fix | Delete
* versus write. Then follow all the data bytes, possibly including a byte
[56] Fix | Delete
* with SMBus PEC. The transfer terminates with a NAK, or when all those
[57] Fix | Delete
* bytes have been transferred and ACKed. If this is the last message in a
[58] Fix | Delete
* group, it is followed by a STOP. Otherwise it is followed by the next
[59] Fix | Delete
* @i2c_msg transaction segment, beginning with a (repeated) START.
[60] Fix | Delete
*
[61] Fix | Delete
* Alternatively, when the adapter supports I2C_FUNC_PROTOCOL_MANGLING then
[62] Fix | Delete
* passing certain @flags may have changed those standard protocol behaviors.
[63] Fix | Delete
* Those flags are only for use with broken/nonconforming slaves, and with
[64] Fix | Delete
* adapters which are known to support the specific mangling options they
[65] Fix | Delete
* need (one or more of IGNORE_NAK, NO_RD_ACK, NOSTART, and REV_DIR_ADDR).
[66] Fix | Delete
*/
[67] Fix | Delete
struct i2c_msg {
[68] Fix | Delete
__u16 addr; /* slave address */
[69] Fix | Delete
__u16 flags;
[70] Fix | Delete
#define I2C_M_RD 0x0001 /* read data, from slave to master */
[71] Fix | Delete
/* I2C_M_RD is guaranteed to be 0x0001! */
[72] Fix | Delete
#define I2C_M_TEN 0x0010 /* this is a ten bit chip address */
[73] Fix | Delete
#define I2C_M_DMA_SAFE 0x0200 /* the buffer of this message is DMA safe */
[74] Fix | Delete
/* makes only sense in kernelspace */
[75] Fix | Delete
/* userspace buffers are copied anyway */
[76] Fix | Delete
#define I2C_M_RECV_LEN 0x0400 /* length will be first received byte */
[77] Fix | Delete
#define I2C_M_NO_RD_ACK 0x0800 /* if I2C_FUNC_PROTOCOL_MANGLING */
[78] Fix | Delete
#define I2C_M_IGNORE_NAK 0x1000 /* if I2C_FUNC_PROTOCOL_MANGLING */
[79] Fix | Delete
#define I2C_M_REV_DIR_ADDR 0x2000 /* if I2C_FUNC_PROTOCOL_MANGLING */
[80] Fix | Delete
#define I2C_M_NOSTART 0x4000 /* if I2C_FUNC_NOSTART */
[81] Fix | Delete
#define I2C_M_STOP 0x8000 /* if I2C_FUNC_PROTOCOL_MANGLING */
[82] Fix | Delete
__u16 len; /* msg length */
[83] Fix | Delete
__u8 *buf; /* pointer to msg data */
[84] Fix | Delete
};
[85] Fix | Delete
[86] Fix | Delete
/* To determine what functionality is present */
[87] Fix | Delete
[88] Fix | Delete
#define I2C_FUNC_I2C 0x00000001
[89] Fix | Delete
#define I2C_FUNC_10BIT_ADDR 0x00000002
[90] Fix | Delete
#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_IGNORE_NAK etc. */
[91] Fix | Delete
#define I2C_FUNC_SMBUS_PEC 0x00000008
[92] Fix | Delete
#define I2C_FUNC_NOSTART 0x00000010 /* I2C_M_NOSTART */
[93] Fix | Delete
#define I2C_FUNC_SLAVE 0x00000020
[94] Fix | Delete
#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */
[95] Fix | Delete
#define I2C_FUNC_SMBUS_QUICK 0x00010000
[96] Fix | Delete
#define I2C_FUNC_SMBUS_READ_BYTE 0x00020000
[97] Fix | Delete
#define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000
[98] Fix | Delete
#define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000
[99] Fix | Delete
#define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000
[100] Fix | Delete
#define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000
[101] Fix | Delete
#define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000
[102] Fix | Delete
#define I2C_FUNC_SMBUS_PROC_CALL 0x00800000
[103] Fix | Delete
#define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000
[104] Fix | Delete
#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000
[105] Fix | Delete
#define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */
[106] Fix | Delete
#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */
[107] Fix | Delete
#define I2C_FUNC_SMBUS_HOST_NOTIFY 0x10000000
[108] Fix | Delete
[109] Fix | Delete
#define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \
[110] Fix | Delete
I2C_FUNC_SMBUS_WRITE_BYTE)
[111] Fix | Delete
#define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | \
[112] Fix | Delete
I2C_FUNC_SMBUS_WRITE_BYTE_DATA)
[113] Fix | Delete
#define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | \
[114] Fix | Delete
I2C_FUNC_SMBUS_WRITE_WORD_DATA)
[115] Fix | Delete
#define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | \
[116] Fix | Delete
I2C_FUNC_SMBUS_WRITE_BLOCK_DATA)
[117] Fix | Delete
#define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | \
[118] Fix | Delete
I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)
[119] Fix | Delete
[120] Fix | Delete
#define I2C_FUNC_SMBUS_EMUL (I2C_FUNC_SMBUS_QUICK | \
[121] Fix | Delete
I2C_FUNC_SMBUS_BYTE | \
[122] Fix | Delete
I2C_FUNC_SMBUS_BYTE_DATA | \
[123] Fix | Delete
I2C_FUNC_SMBUS_WORD_DATA | \
[124] Fix | Delete
I2C_FUNC_SMBUS_PROC_CALL | \
[125] Fix | Delete
I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \
[126] Fix | Delete
I2C_FUNC_SMBUS_I2C_BLOCK | \
[127] Fix | Delete
I2C_FUNC_SMBUS_PEC)
[128] Fix | Delete
[129] Fix | Delete
/*
[130] Fix | Delete
* Data for SMBus Messages
[131] Fix | Delete
*/
[132] Fix | Delete
#define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */
[133] Fix | Delete
union i2c_smbus_data {
[134] Fix | Delete
__u8 byte;
[135] Fix | Delete
__u16 word;
[136] Fix | Delete
__u8 block[I2C_SMBUS_BLOCK_MAX + 2]; /* block[0] is used for length */
[137] Fix | Delete
/* and one more for user-space compatibility */
[138] Fix | Delete
};
[139] Fix | Delete
[140] Fix | Delete
/* i2c_smbus_xfer read or write markers */
[141] Fix | Delete
#define I2C_SMBUS_READ 1
[142] Fix | Delete
#define I2C_SMBUS_WRITE 0
[143] Fix | Delete
[144] Fix | Delete
/* SMBus transaction types (size parameter in the above functions)
[145] Fix | Delete
Note: these no longer correspond to the (arbitrary) PIIX4 internal codes! */
[146] Fix | Delete
#define I2C_SMBUS_QUICK 0
[147] Fix | Delete
#define I2C_SMBUS_BYTE 1
[148] Fix | Delete
#define I2C_SMBUS_BYTE_DATA 2
[149] Fix | Delete
#define I2C_SMBUS_WORD_DATA 3
[150] Fix | Delete
#define I2C_SMBUS_PROC_CALL 4
[151] Fix | Delete
#define I2C_SMBUS_BLOCK_DATA 5
[152] Fix | Delete
#define I2C_SMBUS_I2C_BLOCK_BROKEN 6
[153] Fix | Delete
#define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */
[154] Fix | Delete
#define I2C_SMBUS_I2C_BLOCK_DATA 8
[155] Fix | Delete
[156] Fix | Delete
#endif /* _LINUX_I2C_H */
[157] Fix | Delete
[158] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function