epoc32/include/assp/omap3530_assp/omap3530_i2c.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@4
     1
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@4
     2
// All rights reserved.
williamr@4
     3
// This component and the accompanying materials are made available
williamr@4
     4
// under the terms of the License "Eclipse Public License v1.0"
williamr@4
     5
// which accompanies this distribution, and is available
williamr@4
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@4
     7
//
williamr@4
     8
// Initial Contributors:
williamr@4
     9
// Nokia Corporation - initial contribution.
williamr@4
    10
//
williamr@4
    11
// Contributors:
williamr@4
    12
//
williamr@4
    13
// Description:
williamr@4
    14
// omap3530/omap3530_drivers/i2c/omap3530_i2c.h
williamr@4
    15
// I2C driver interface.
williamr@4
    16
// This file is part of the Beagle Base port
williamr@4
    17
//
williamr@4
    18
williamr@4
    19
#ifndef OMAP3530_I2C_H_
williamr@4
    20
#define OMAP3530_I2C_H_
williamr@4
    21
williamr@4
    22
#include <e32def.h>
williamr@4
    23
williamr@4
    24
#define I2C_VERSION 0 // update if TConfigPb or TTransferPb change
williamr@4
    25
williamr@4
    26
class TDfc;
williamr@4
    27
class TDfcQue;
williamr@4
    28
williamr@4
    29
namespace I2c
williamr@4
    30
{
williamr@4
    31
class TDeviceControl;
williamr@4
    32
williamr@4
    33
enum TUnit
williamr@4
    34
	{
williamr@4
    35
	E1, // EMaster, ESlave
williamr@4
    36
	E2, // EMaster, ESlave, ESccb
williamr@4
    37
	E3 // EMaster, ESlave, ESccb
williamr@4
    38
	};
williamr@4
    39
enum TRole
williamr@4
    40
	{
williamr@4
    41
	EMaster
williamr@4
    42
//	ESlave - TBI
williamr@4
    43
	};
williamr@4
    44
enum TMode
williamr@4
    45
	{
williamr@4
    46
	E7Bit
williamr@4
    47
//	E10Bit  - TBI
williamr@4
    48
//	EHs - TBI
williamr@4
    49
//	ESccb - TBI
williamr@4
    50
	};
williamr@4
    51
enum TRate
williamr@4
    52
	{
williamr@4
    53
	E100K,
williamr@4
    54
	E400K
williamr@4
    55
//	E3M31 - TBI
williamr@4
    56
	};
williamr@4
    57
typedef TInt TDeviceAddress; // range 0..1023 or 0..128
williamr@4
    58
struct TVersion
williamr@4
    59
	{
williamr@4
    60
	inline TVersion() : iVersion(I2C_VERSION){}
williamr@4
    61
	TInt iVersion;
williamr@4
    62
	};
williamr@4
    63
struct TConfigPb : TVersion // the parameter block used by Open()
williamr@4
    64
	{
williamr@4
    65
	IMPORT_C TConfigPb();
williamr@4
    66
williamr@4
    67
	TUnit iUnit;
williamr@4
    68
	TRole iRole;
williamr@4
    69
	TMode iMode;
williamr@4
    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.
williamr@4
    71
	TRate iRate;
williamr@4
    72
	TDeviceAddress iOwnAddress;
williamr@4
    73
	TDeviceAddress iDeviceAddress; // if role is master
williamr@4
    74
	TDfcQue* iDfcQueue; // clients thread
williamr@4
    75
	};
williamr@4
    76
typedef TInt THandle; // returned from Open()
williamr@4
    77
struct TTransferPb // the parameter block used by Transfer*()
williamr@4
    78
	{
williamr@4
    79
	IMPORT_C TTransferPb();
williamr@4
    80
williamr@4
    81
	enum
williamr@4
    82
		{
williamr@4
    83
		ERead,
williamr@4
    84
		EWrite
williamr@4
    85
		} iType;
williamr@4
    86
williamr@4
    87
	TInt iLength; // in bytes.
williamr@4
    88
	const TUint8* iData; // only truly const for writes, i.e. *iData is modified bye Read transfers
williamr@4
    89
williamr@4
    90
	TTransferPb* iNextPhase; // zero if a full transfer or last phase of a multiphase transfer
williamr@4
    91
williamr@4
    92
	// only for asynchronous transfers i.e. WriteA() or ReadA();
williamr@4
    93
	TDfc* iCompletionDfc;
williamr@4
    94
	TInt iResult;
williamr@4
    95
williamr@4
    96
	// reserved for use by I2C driver
williamr@4
    97
	TTransferPb* iNextTransfer;
williamr@4
    98
	TDeviceControl* iDcb;
williamr@4
    99
	};
williamr@4
   100
williamr@4
   101
// call Open() for each slave device.
williamr@4
   102
// returns:
williamr@4
   103
// KErrArgument if a combination of iUnit, iRole, iMode or iRate are not supported
williamr@4
   104
// KErrInUse if already open exclusively, the configuration doesn't match or the device is already open.
williamr@4
   105
// KErrTooBig if there are already KMaxDevicesPerUnit (currently 8) slave devices open
williamr@4
   106
// a positive value if successful
williamr@4
   107
IMPORT_C THandle Open(const TConfigPb&); 
williamr@4
   108
IMPORT_C void Close(THandle&);
williamr@4
   109
IMPORT_C TInt TransferS(THandle, TTransferPb&);
williamr@4
   110
IMPORT_C void TransferA(THandle, TTransferPb&); // TBI
williamr@4
   111
IMPORT_C void CancelATransfer(THandle); // TBI
williamr@4
   112
}
williamr@4
   113
williamr@4
   114
#endif // !OMAP3530_I2C_H_