VirtualBox

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

Last change on this file since 77938 was 32163, checked in by vboxsync, 14 years ago

Additions/x11/x11include: additional headers for building drivers for X.Org Server 1.9

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