VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.15.0/xf86i2c.h@ 87454

Last change on this file since 87454 was 50218, checked in by vboxsync, 11 years ago

Additions/x11: added headers for X.Org Server 1.15.

  • Property svn:eol-style set to native
File size: 4.1 KB
Line 
1/*
2 * Copyright (C) 1998 Itai Nahshon, Michael Schimek
3 */
4
5#ifndef _XF86I2C_H
6#define _XF86I2C_H
7
8#include "regionstr.h"
9#include "xf86.h"
10
11typedef unsigned char I2CByte;
12typedef unsigned short I2CSlaveAddr;
13
14typedef struct _I2CBusRec *I2CBusPtr;
15typedef struct _I2CDevRec *I2CDevPtr;
16
17/* I2C masters have to register themselves */
18
19typedef struct _I2CBusRec {
20 char *BusName;
21 int scrnIndex;
22 ScrnInfoPtr pScrn;
23
24 void (*I2CUDelay) (I2CBusPtr b, int usec);
25
26 void (*I2CPutBits) (I2CBusPtr b, int scl, int sda);
27 void (*I2CGetBits) (I2CBusPtr b, int *scl, int *sda);
28
29 /* Look at the generic routines to see how these functions should behave. */
30
31 Bool (*I2CStart) (I2CBusPtr b, int timeout);
32 Bool (*I2CAddress) (I2CDevPtr d, I2CSlaveAddr);
33 void (*I2CStop) (I2CDevPtr d);
34 Bool (*I2CPutByte) (I2CDevPtr d, I2CByte data);
35 Bool (*I2CGetByte) (I2CDevPtr d, I2CByte * data, Bool);
36
37 DevUnion DriverPrivate;
38
39 int HoldTime; /* 1 / bus clock frequency, 5 or 2 usec */
40
41 int BitTimeout; /* usec */
42 int ByteTimeout; /* usec */
43 int AcknTimeout; /* usec */
44 int StartTimeout; /* usec */
45 int RiseFallTime; /* usec */
46
47 I2CDevPtr FirstDev;
48 I2CBusPtr NextBus;
49 Bool (*I2CWriteRead) (I2CDevPtr d, I2CByte * WriteBuffer, int nWrite,
50 I2CByte * ReadBuffer, int nRead);
51} I2CBusRec;
52
53#define CreateI2CBusRec xf86CreateI2CBusRec
54extern _X_EXPORT I2CBusPtr xf86CreateI2CBusRec(void);
55
56#define DestroyI2CBusRec xf86DestroyI2CBusRec
57extern _X_EXPORT void xf86DestroyI2CBusRec(I2CBusPtr pI2CBus, Bool unalloc,
58 Bool devs_too);
59#define I2CBusInit xf86I2CBusInit
60extern _X_EXPORT Bool xf86I2CBusInit(I2CBusPtr pI2CBus);
61
62extern _X_EXPORT I2CBusPtr xf86I2CFindBus(int scrnIndex, char *name);
63extern _X_EXPORT int xf86I2CGetScreenBuses(int scrnIndex,
64 I2CBusPtr ** pppI2CBus);
65
66/* I2C slave devices */
67
68typedef struct _I2CDevRec {
69 char *DevName;
70
71 int BitTimeout; /* usec */
72 int ByteTimeout; /* usec */
73 int AcknTimeout; /* usec */
74 int StartTimeout; /* usec */
75
76 I2CSlaveAddr SlaveAddr;
77 I2CBusPtr pI2CBus;
78 I2CDevPtr NextDev;
79 DevUnion DriverPrivate;
80} I2CDevRec;
81
82#define CreateI2CDevRec xf86CreateI2CDevRec
83extern _X_EXPORT I2CDevPtr xf86CreateI2CDevRec(void);
84extern _X_EXPORT void xf86DestroyI2CDevRec(I2CDevPtr pI2CDev, Bool unalloc);
85
86#define I2CDevInit xf86I2CDevInit
87extern _X_EXPORT Bool xf86I2CDevInit(I2CDevPtr pI2CDev);
88extern _X_EXPORT I2CDevPtr xf86I2CFindDev(I2CBusPtr, I2CSlaveAddr);
89
90/* See descriptions of these functions in xf86i2c.c */
91
92#define I2CProbeAddress xf86I2CProbeAddress
93extern _X_EXPORT Bool xf86I2CProbeAddress(I2CBusPtr pI2CBus, I2CSlaveAddr);
94
95#define I2C_WriteRead xf86I2CWriteRead
96extern _X_EXPORT Bool xf86I2CWriteRead(I2CDevPtr d, I2CByte * WriteBuffer,
97 int nWrite, I2CByte * ReadBuffer,
98 int nRead);
99#define xf86I2CRead(d, rb, nr) xf86I2CWriteRead(d, NULL, 0, rb, nr)
100
101extern _X_EXPORT Bool xf86I2CReadStatus(I2CDevPtr d, I2CByte * pbyte);
102extern _X_EXPORT Bool xf86I2CReadByte(I2CDevPtr d, I2CByte subaddr,
103 I2CByte * pbyte);
104extern _X_EXPORT Bool xf86I2CReadBytes(I2CDevPtr d, I2CByte subaddr,
105 I2CByte * pbyte, int n);
106extern _X_EXPORT Bool xf86I2CReadWord(I2CDevPtr d, I2CByte subaddr,
107 unsigned short *pword);
108#define xf86I2CWrite(d, wb, nw) xf86I2CWriteRead(d, wb, nw, NULL, 0)
109extern _X_EXPORT Bool xf86I2CWriteByte(I2CDevPtr d, I2CByte subaddr,
110 I2CByte byte);
111extern _X_EXPORT Bool xf86I2CWriteBytes(I2CDevPtr d, I2CByte subaddr,
112 I2CByte * WriteBuffer, int nWrite);
113extern _X_EXPORT Bool xf86I2CWriteWord(I2CDevPtr d, I2CByte subaddr,
114 unsigned short word);
115extern _X_EXPORT Bool xf86I2CWriteVec(I2CDevPtr d, I2CByte * vec, int nValues);
116
117#endif /*_XF86I2C_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette