VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/1.3/xorg/xf86i2c.h@ 11550

Last change on this file since 11550 was 11550, checked in by vboxsync, 16 years ago

eol-style

  • Property svn:eol-style set to native
File size: 3.1 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
52I2CBusPtr xf86CreateI2CBusRec(void);
53void xf86DestroyI2CBusRec(I2CBusPtr pI2CBus, Bool unalloc, Bool devs_too);
54Bool xf86I2CBusInit(I2CBusPtr pI2CBus);
55I2CBusPtr xf86I2CFindBus(int scrnIndex, char *name);
56int xf86I2CGetScreenBuses(int scrnIndex, I2CBusPtr **pppI2CBus);
57
58
59/* I2C slave devices */
60
61typedef struct _I2CDevRec {
62 char * DevName;
63
64 int BitTimeout; /* usec */
65 int ByteTimeout; /* usec */
66 int AcknTimeout; /* usec */
67 int StartTimeout; /* usec */
68
69 I2CSlaveAddr SlaveAddr;
70 I2CBusPtr pI2CBus;
71 I2CDevPtr NextDev;
72 DevUnion DriverPrivate;
73} I2CDevRec;
74
75I2CDevPtr xf86CreateI2CDevRec(void);
76void xf86DestroyI2CDevRec(I2CDevPtr pI2CDev, Bool unalloc);
77Bool xf86I2CDevInit(I2CDevPtr pI2CDev);
78I2CDevPtr xf86I2CFindDev(I2CBusPtr, I2CSlaveAddr);
79
80/* See descriptions of these functions in xf86i2c.c */
81
82Bool xf86I2CProbeAddress(I2CBusPtr pI2CBus, I2CSlaveAddr);
83Bool xf86I2CWriteRead(I2CDevPtr d, I2CByte *WriteBuffer, int nWrite,
84 I2CByte *ReadBuffer, int nRead);
85#define xf86I2CRead(d, rb, nr) xf86I2CWriteRead(d, NULL, 0, rb, nr)
86Bool xf86I2CReadStatus(I2CDevPtr d, I2CByte *pbyte);
87Bool xf86I2CReadByte(I2CDevPtr d, I2CByte subaddr, I2CByte *pbyte);
88Bool xf86I2CReadBytes(I2CDevPtr d, I2CByte subaddr, I2CByte *pbyte, int n);
89Bool xf86I2CReadWord(I2CDevPtr d, I2CByte subaddr, unsigned short *pword);
90#define xf86I2CWrite(d, wb, nw) xf86I2CWriteRead(d, wb, nw, NULL, 0)
91Bool xf86I2CWriteByte(I2CDevPtr d, I2CByte subaddr, I2CByte byte);
92Bool xf86I2CWriteBytes(I2CDevPtr d, I2CByte subaddr, I2CByte *WriteBuffer, int nWrite);
93Bool xf86I2CWriteWord(I2CDevPtr d, I2CByte subaddr, unsigned short word);
94Bool xf86I2CWriteVec(I2CDevPtr d, I2CByte *vec, int nValues);
95
96#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