1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // omap3530/omap3530_drivers/i2c/omap3530_i2c.h
15 // I2C driver interface.
16 // This file is part of the Beagle Base port
19 #ifndef OMAP3530_I2C_H_
20 #define OMAP3530_I2C_H_
24 #define I2C_VERSION 0 // update if TConfigPb or TTransferPb change
35 E1, // EMaster, ESlave
36 E2, // EMaster, ESlave, ESccb
37 E3 // EMaster, ESlave, ESccb
57 typedef TInt TDeviceAddress; // range 0..1023 or 0..128
60 inline TVersion() : iVersion(I2C_VERSION){}
63 struct TConfigPb : TVersion // the parameter block used by Open()
70 void* iExclusiveClient; // Clients magic number - zero if the client doesn't require exclusive access otherwise use an owned object, code, stack or data address.
72 TDeviceAddress iOwnAddress;
73 TDeviceAddress iDeviceAddress; // if role is master
74 TDfcQue* iDfcQueue; // clients thread
76 typedef TInt THandle; // returned from Open()
77 struct TTransferPb // the parameter block used by Transfer*()
79 IMPORT_C TTransferPb();
87 TInt iLength; // in bytes.
88 const TUint8* iData; // only truly const for writes, i.e. *iData is modified bye Read transfers
90 TTransferPb* iNextPhase; // zero if a full transfer or last phase of a multiphase transfer
92 // only for asynchronous transfers i.e. WriteA() or ReadA();
96 // reserved for use by I2C driver
97 TTransferPb* iNextTransfer;
101 // call Open() for each slave device.
103 // KErrArgument if a combination of iUnit, iRole, iMode or iRate are not supported
104 // KErrInUse if already open exclusively, the configuration doesn't match or the device is already open.
105 // KErrTooBig if there are already KMaxDevicesPerUnit (currently 8) slave devices open
106 // a positive value if successful
107 IMPORT_C THandle Open(const TConfigPb&);
108 IMPORT_C void Close(THandle&);
109 IMPORT_C TInt TransferS(THandle, TTransferPb&);
110 IMPORT_C void TransferA(THandle, TTransferPb&); // TBI
111 IMPORT_C void CancelATransfer(THandle); // TBI
114 #endif // !OMAP3530_I2C_H_