|
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 "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 |
|
20 #ifndef __CSI_SLAVE_H__ |
|
21 #define __CSI_SLAVE_H__ |
|
22 |
|
23 #include <assp/naviengine/naviengine.h> |
|
24 #include <drivers/iic.h> |
|
25 #include <drivers/iic_channel.h> |
|
26 #ifdef MASTER_MODE |
|
27 #include "csi_master.h" |
|
28 #endif |
|
29 class DCsiChannelSlave: public DIicBusChannelSlave |
|
30 { |
|
31 |
|
32 public: |
|
33 #ifdef STANDALONE_CHANNEL |
|
34 IMPORT_C |
|
35 #endif |
|
36 static DCsiChannelSlave* New(TInt aChannelNumber, const TBusType aBusType, |
|
37 const TChannelDuplex aChanDuplex); |
|
38 // Gateway function for PSL implementation |
|
39 virtual TInt DoRequest(TInt aOperation); |
|
40 |
|
41 DCsiChannelSlave(TInt aChannelNumber, const TBusType aBusType, |
|
42 const TChannelDuplex aChanDuplex); |
|
43 |
|
44 protected: |
|
45 // overriders for base pure-virtual methods.. |
|
46 virtual TInt DoCreate(); // second-stage construction, |
|
47 virtual TInt CheckHdr(TDes8* aHdrBuff); |
|
48 virtual void ProcessData(TInt aTrigger, TIicBusSlaveCallback* aCb); |
|
49 |
|
50 private: |
|
51 // some internal methods.. |
|
52 TBool TransConfigDiffersFromPrev(); |
|
53 TInt ConfigureInterface(); |
|
54 TInt InitTransfer(); |
|
55 |
|
56 // ISR handler and other static methods.. |
|
57 static void CsiIsr(TAny* aPtr); |
|
58 static void TimeoutCallback(TAny* aPtr); |
|
59 static inline void NotifyClientEnd(DCsiChannelSlave* aPtr); |
|
60 |
|
61 // as implementation is common/generic for both channels |
|
62 // store base register address and interruptID |
|
63 TUint iChannelBase; |
|
64 TInt iInterruptId; |
|
65 |
|
66 // to store SS pin active mode (1-active on high, 0 - active on low) |
|
67 TInt8 iSSPinActiveMode; |
|
68 TUint8 iTrigger; |
|
69 |
|
70 // granularity.. |
|
71 TInt8 iWordSize; |
|
72 |
|
73 // flags indicating transmission/operation competition |
|
74 TInt8 iInProgress; |
|
75 |
|
76 // pointers to buffers used to transfer data from/to... |
|
77 TInt8 *iTxData; |
|
78 TInt8 *iRxData; |
|
79 TInt8 *iTxDataEnd; |
|
80 TInt8 *iRxDataEnd; |
|
81 |
|
82 // Timer to guard 'while' loops.. |
|
83 NTimer iHwGuardTimer; |
|
84 // guard-timer timeout value (in ms) |
|
85 TInt32 iHwTimeoutValue; |
|
86 |
|
87 // status of the transaction |
|
88 volatile TInt iTransactionStatus; |
|
89 |
|
90 #ifdef MASTER_MODE |
|
91 public: |
|
92 DCsiChannelMaster *iMasterAddress; |
|
93 #endif |
|
94 }; |
|
95 |
|
96 |
|
97 |
|
98 #endif /*__CSI_SLAVE_H__*/ |