Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / hidds / i2c / include / i2c.h
blob6b6b13f67b427da23f7c7523db22b3dc4acd90c6
1 #ifndef HIDD_I2C_H
2 #define HIDD_I2C_H
4 /*
5 Copyright � 2003, The AROS Development Team. All rights reserved.
6 $Id$
7 */
9 #ifndef EXEC_TYPES_H
10 #include <exec/types.h>
11 #endif
13 #ifndef HIDD_HIDD_H
14 #include <hidd/hidd.h>
15 #endif
17 #ifndef OOP_OOP_H
18 #include <oop/oop.h>
19 #endif
21 /* Base I2C class */
23 #define CLID_Hidd_I2C "hidd.i2c"
24 #define IID_Hidd_I2C "hidd.i2c"
26 #define HiddI2CAttrBase __IHidd_I2C
28 #ifndef __OOP_NOATTRBASES__
29 extern OOP_AttrBase HiddI2CAttrBase;
30 #endif
32 /* I2C Class methods */
33 enum
35 moHidd_I2C_PutBits = 0,
36 moHidd_I2C_GetBits,
37 moHidd_I2C_Start,
38 moHidd_I2C_Address,
39 moHidd_I2C_Stop,
40 moHidd_I2C_PutByte,
41 moHidd_I2C_GetByte,
42 moHidd_I2C_WriteRead,
43 moHidd_I2C_ProbeAddress,
45 NUM_I2C_METHODS
48 enum
50 aoHidd_I2C_HoldTime,
51 aoHidd_I2C_BitTimeout,
52 aoHidd_I2C_ByteTimeout,
53 aoHidd_I2C_AcknTimeout,
54 aoHidd_I2C_StartTimeout,
55 aoHidd_I2C_RiseFallTime,
56 aoHidd_I2C_Name,
58 num_Hidd_I2C_Attrs
61 #define aHidd_I2C_HoldTime (HiddI2CAttrBase + aoHidd_I2C_HoldTime)
62 #define aHidd_I2C_BitTimeout (HiddI2CAttrBase + aoHidd_I2C_BitTimeout)
63 #define aHidd_I2C_ByteTimeout (HiddI2CAttrBase + aoHidd_I2C_ByteTimeout)
64 #define aHidd_I2C_AcknTimeout (HiddI2CAttrBase + aoHidd_I2C_AcknTimeout)
65 #define aHidd_I2C_StartTimeout (HiddI2CAttrBase + aoHidd_I2C_StartTimeout)
66 #define aHidd_I2C_RiseFallTime (HiddI2CAttrBase + aoHidd_I2C_RiseFallTime)
67 #define aHidd_I2C_Name (HiddI2CAttrBase + aoHidd_I2C_Name)
69 #define IS_I2C_ATTR(attr, idx) \
70 (((idx) = (attr) - HiddI2CAttrBase) < num_Hidd_I2C_Attrs)
72 struct pHidd_I2C_PutBits
74 OOP_MethodID mID;
75 BOOL scl;
76 BOOL sda;
79 struct pHidd_I2C_GetBits
81 OOP_MethodID mID;
82 BOOL *scl;
83 BOOL *sda;
86 struct pHidd_I2C_Start
88 OOP_MethodID mID;
89 ULONG timeout;
92 struct pHidd_I2C_Address
94 OOP_MethodID mID;
95 OOP_Object *device;
96 UWORD address;
99 struct pHidd_I2C_Stop
101 OOP_MethodID mID;
102 OOP_Object *device;
105 struct pHidd_I2C_PutByte
107 OOP_MethodID mID;
108 OOP_Object *device;
109 UBYTE data;
112 struct pHidd_I2C_GetByte
114 OOP_MethodID mID;
115 OOP_Object *device;
116 UBYTE *data;
117 BOOL last;
120 struct pHidd_I2C_WriteRead
122 OOP_MethodID mID;
123 OOP_Object *device;
124 UBYTE *writeBuffer;
125 ULONG writeLength;
126 UBYTE *readBuffer;
127 ULONG readLength;
130 struct pHidd_I2C_ProbeAddress
132 OOP_MethodID mID;
133 UWORD address;
136 /* I2C device class */
138 #define CLID_Hidd_I2CDevice "hidd.i2c.device"
139 #define IID_Hidd_I2CDevice "hidd.i2c.device"
141 #define HiddI2CDeviceAttrBase __IHidd_I2CDevice
143 #ifndef __OOP_NOATTRBASES__
144 extern OOP_AttrBase HiddI2CDeviceAttrBase;
145 #endif
147 /* I2C Device Class methods */
148 enum
150 moHidd_I2CDevice_Read,
151 moHidd_I2CDevice_ReadStatus,
152 moHidd_I2CDevice_ReadByte,
153 moHidd_I2CDevice_ReadBytes,
154 moHidd_I2CDevice_ReadWord,
155 moHidd_I2CDevice_Write,
156 moHidd_I2CDevice_WriteByte,
157 moHidd_I2CDevice_WriteBytes,
158 moHidd_I2CDevice_WriteWord,
159 moHidd_I2CDevice_WriteVec,
160 moHidd_I2CDevice_WriteRead,
162 NUM_I2CDEV_METHODS
165 enum
167 aoHidd_I2CDevice_Driver,
168 aoHidd_I2CDevice_Address,
169 aoHidd_I2CDevice_HoldTime,
170 aoHidd_I2CDevice_BitTimeout,
171 aoHidd_I2CDevice_ByteTimeout,
172 aoHidd_I2CDevice_AcknTimeout,
173 aoHidd_I2CDevice_StartTimeout,
174 aoHidd_I2CDevice_RiseFallTime,
175 aoHidd_I2CDevice_Name,
177 num_Hidd_I2CDevice_Attrs
180 #define aHidd_I2CDevice_Driver (HiddI2CDeviceAttrBase + aoHidd_I2CDevice_Driver)
181 #define aHidd_I2CDevice_Address (HiddI2CDeviceAttrBase + aoHidd_I2CDevice_Address)
182 #define aHidd_I2CDevice_HoldTime (HiddI2CDeviceAttrBase + aoHidd_I2CDevice_HoldTime)
183 #define aHidd_I2CDevice_BitTimeout (HiddI2CDeviceAttrBase + aoHidd_I2CDevice_BitTimeout)
184 #define aHidd_I2CDevice_ByteTimeout (HiddI2CDeviceAttrBase + aoHidd_I2CDevice_ByteTimeout)
185 #define aHidd_I2CDevice_AcknTimeout (HiddI2CDeviceAttrBase + aoHidd_I2CDevice_AcknTimeout)
186 #define aHidd_I2CDevice_StartTimeout (HiddI2CDeviceAttrBase + aoHidd_I2CDevice_StartTimeout)
187 #define aHidd_I2CDevice_RiseFallTime (HiddI2CDeviceAttrBase + aoHidd_I2CDevice_RiseFallTime)
188 #define aHidd_I2CDevice_Name (HiddI2CDeviceAttrBase + aoHidd_I2CDevice_Name)
190 #define IS_I2CDEV_ATTR(attr, idx) \
191 (((idx) = (attr) - HiddI2CDeviceAttrBase) < num_Hidd_I2CDevice_Attrs)
193 struct pHidd_I2CDevice_Read
195 OOP_MethodID mID;
196 UBYTE *readBuffer;
197 ULONG readLength;
200 struct pHidd_I2CDevice_ReadStatus
202 OOP_MethodID mID;
203 UBYTE *status;
206 struct pHidd_I2CDevice_ReadByte
208 OOP_MethodID mID;
209 UBYTE subaddr;
210 UBYTE *data;
213 struct pHidd_I2CDevice_ReadBytes
215 OOP_MethodID mID;
216 UBYTE subaddr;
217 UBYTE *data;
218 ULONG length;
221 struct pHidd_I2CDevice_ReadWord
223 OOP_MethodID mID;
224 UBYTE subaddr;
225 UWORD *data;
228 struct pHidd_I2CDevice_Write
230 OOP_MethodID mID;
231 UBYTE *writeBuffer;
232 ULONG writeLength;
235 struct pHidd_I2CDevice_WriteByte
237 OOP_MethodID mID;
238 UBYTE subaddr;
239 UBYTE data;
242 struct pHidd_I2CDevice_WriteBytes
244 OOP_MethodID mID;
245 UBYTE subaddr;
246 UBYTE *data;
247 ULONG length;
250 struct pHidd_I2CDevice_WriteWord
252 OOP_MethodID mID;
253 UBYTE subaddr;
254 UWORD data;
257 struct pHidd_I2CDevice_WriteVec
259 OOP_MethodID mID;
260 UBYTE *data;
261 ULONG length;
264 struct pHidd_I2CDevice_WriteRead
266 OOP_MethodID mID;
267 UBYTE *writeBuffer;
268 ULONG writeLength;
269 UBYTE *readBuffer;
270 ULONG readLength;
273 BOOL HIDD_I2C_ProbeAddress(OOP_Object *obj, UWORD address);
275 #endif