libnx  v4.7.0
i2c.h
Go to the documentation of this file.
1 /**
2  * @file i2c.h
3  * @brief I2C service IPC wrapper.
4  * @author SciresM
5  * @copyright libnx Authors
6  */
7 #pragma once
8 #include "../types.h"
9 #include "../sf/service.h"
10 
11 typedef enum {
12  I2cDevice_DebugPad = 0,
13  I2cDevice_TouchPanel = 1,
14  I2cDevice_Tmp451 = 2,
15  I2cDevice_Nct72 = 3,
16  I2cDevice_Alc5639 = 4,
17  I2cDevice_Max77620Rtc = 5,
18  I2cDevice_Max77620Pmic = 6,
19  I2cDevice_Max77621Cpu = 7,
20  I2cDevice_Max77621Gpu = 8,
21  I2cDevice_Bq24193 = 9,
22  I2cDevice_Max17050 = 10,
23  I2cDevice_Bm92t30mwv = 11,
24  I2cDevice_Ina226Vdd15v0Hb = 12,
25  I2cDevice_Ina226VsysCpuDs = 13,
26  I2cDevice_Ina226VsysGpuDs = 14,
27  I2cDevice_Ina226VsysDdrDs = 15,
28  I2cDevice_Ina226VsysAp = 16,
29  I2cDevice_Ina226VsysBlDs = 17,
30  I2cDevice_Bh1730 = 18,
31  I2cDevice_Ina226VsysCore = 19,
32  I2cDevice_Ina226Soc1V8 = 20,
33  I2cDevice_Ina226Lpddr1V8 = 21,
34  I2cDevice_Ina226Reg1V32 = 22,
35  I2cDevice_Ina226Vdd3V3Sys = 23,
36  I2cDevice_HdmiDdc = 24,
37  I2cDevice_HdmiScdc = 25,
38  I2cDevice_HdmiHdcp = 26,
39  I2cDevice_Fan53528 = 27,
40  I2cDevice_Max77812_3 = 28,
41  I2cDevice_Max77812_2 = 29,
42  I2cDevice_Ina226VddDdr0V6 = 30,
43 
44  I2cDevice_Count,
45 } I2cDevice;
46 
47 typedef struct {
48  Service s;
49 } I2cSession;
50 
51 typedef enum {
52  I2cTransactionOption_Start = (1 << 0),
53  I2cTransactionOption_Stop = (1 << 1),
54 
55  I2cTransactionOption_All = I2cTransactionOption_Start | I2cTransactionOption_Stop,
56 } I2cTransactionOption;
57 
58 /// Initialize i2c.
60 
61 /// Exit i2c.
62 void i2cExit(void);
63 
64 /// Gets the Service object for the actual i2c service session.
66 
67 Result i2cOpenSession(I2cSession *out, I2cDevice dev);
68 
69 Result i2csessionSendAuto(I2cSession *s, const void *buf, size_t size, I2cTransactionOption option);
70 Result i2csessionReceiveAuto(I2cSession *s, void *buf, size_t size, I2cTransactionOption option);
71 Result i2csessionExecuteCommandList(I2cSession *s, void *dst, size_t dst_size, const void *cmd_list, size_t cmd_list_size);
72 void i2csessionClose(I2cSession *s);
Result i2cInitialize(void)
Initialize i2c.
Service * i2cGetServiceSession(void)
Gets the Service object for the actual i2c service session.
void i2cExit(void)
Exit i2c.
Definition: i2c.h:47
Service object structure.
Definition: service.h:14
u32 Result
Function error code result type.
Definition: types.h:44