0
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef __IIC_SLAVE_H__
|
|
20 |
#define __IIC_SLAVE_H__
|
|
21 |
|
|
22 |
#include <drivers/iic_channel.h>
|
|
23 |
|
|
24 |
class DIicBusChannelSlavePsl: public DIicBusChannelSlave
|
|
25 |
{
|
|
26 |
|
|
27 |
public:
|
|
28 |
static DIicBusChannelSlavePsl* New(TInt aChannelNumber, const TBusType aBusType,
|
|
29 |
const TChannelDuplex aChanDuplex);
|
|
30 |
|
|
31 |
// Gateway function for PSL implementation
|
|
32 |
virtual TInt DoRequest(TInt aOperation);
|
|
33 |
|
|
34 |
DIicBusChannelSlavePsl(TInt aChannelNumber, const TBusType aBusType,
|
|
35 |
const TChannelDuplex aChanDuplex);
|
|
36 |
|
|
37 |
private:
|
|
38 |
// Overriders for base class pure-virtual methods
|
|
39 |
virtual TInt DoCreate(); // second-stage construction,
|
|
40 |
virtual TInt CheckHdr(TDes8* aHdrBuff);
|
|
41 |
virtual void ProcessData(TInt aTrigger, TIicBusSlaveCallback* aCb);
|
|
42 |
|
|
43 |
// Internal methods..
|
|
44 |
TBool TransConfigDiffersFromPrev();
|
|
45 |
TInt ConfigureInterface();
|
|
46 |
TInt AsynchConfigureInterface();
|
|
47 |
TInt InitTransfer();
|
|
48 |
|
|
49 |
// ISR handler and other static methods..
|
|
50 |
static void IicPslIsr(TAny* aPtr);
|
|
51 |
static void TimeoutCallback(TAny* aPtr);
|
|
52 |
static inline void NotifyClientEnd(DIicBusChannelSlavePsl* aPtr);
|
|
53 |
|
|
54 |
// Register base for the Master channel
|
|
55 |
TUint iSlaveChanBase;
|
|
56 |
|
|
57 |
// Interrupt ID for the Master channel
|
|
58 |
TInt iSlaveIntId;
|
|
59 |
|
|
60 |
// Bit mask of the transfer triggers managed by the channel
|
|
61 |
TUint8 iTrigger;
|
|
62 |
|
|
63 |
// Granularity, expressed as the number of bytes in a word
|
|
64 |
TInt8 iWordSize;
|
|
65 |
|
|
66 |
// Flag indicating transmission activity - optional, may not be required for all bus types
|
|
67 |
// In the template example it is used to indicate transitions on a chip-select line, such as for SPI.
|
|
68 |
TInt8 iInProgress;
|
|
69 |
|
|
70 |
// Dummy variable used merely to demonstrate the asynchronous channel capture mechanism
|
|
71 |
// See method AsynchConfigureInterface
|
|
72 |
TInt8 iAsyncConfig;
|
|
73 |
|
|
74 |
// Pointers to buffers used for Rx and Tx transfers
|
|
75 |
TInt8 *iTxData;
|
|
76 |
TInt8 *iRxData;
|
|
77 |
TInt8 *iTxDataEnd;
|
|
78 |
TInt8 *iRxDataEnd;
|
|
79 |
|
|
80 |
// Timer to guard 'while' loops..
|
|
81 |
NTimer iHwGuardTimer;
|
|
82 |
|
|
83 |
// status of the transaction
|
|
84 |
volatile TInt iTransactionStatus;
|
|
85 |
};
|
|
86 |
|
|
87 |
#endif /*__IIC_SLAVE_H__*/
|